You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _search-plugins/sql/limitation.md
+37-3Lines changed: 37 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -29,10 +29,44 @@ FROM (
29
29
30
30
But, if the outer query has `GROUP BY` or `ORDER BY`, then it's not supported.
31
31
32
-
## JOIN does not support aggregations on the joined result
32
+
## JOIN queries
33
33
34
-
The `join` query does not support aggregations on the joined result.
35
-
For example, e.g. `SELECT depo.name, avg(empo.age) FROM empo JOIN depo WHERE empo.id == depo.id GROUP BY depo.name` is not supported.
34
+
Because OpenSearch doesn't natively support relational operations, `JOIN` queries are supported on a best-effort basis.
35
+
36
+
### JOIN does not support aggregations on the joined result
37
+
38
+
The `JOIN` query does not support aggregations on the joined result.
39
+
40
+
For example, `SELECT depo.name, avg(empo.age) FROM empo JOIN depo WHERE empo.id = depo.id GROUP BY depo.name` is not supported.
41
+
42
+
### Performance
43
+
44
+
`JOIN` queries are prone to expensive index scanning operations.
45
+
46
+
`JOIN` queries may experience performance issues when working with result sets larger than 5 million matching records.
47
+
To improve `JOIN` performance, reduce the number of records being joined by filtering your data first. For example, limit the join to a specific range of key values:
48
+
49
+
```sql
50
+
SELECTl.key, l.spanId, r.spanId
51
+
FROM logs_left AS l
52
+
JOIN logs_right AS r
53
+
ONl.key=r.key
54
+
WHEREl.key>=17491637400000
55
+
ANDl.key<17491637500000
56
+
ANDr.key>=17491637400000
57
+
ANDr.key<17491637500000
58
+
LIMIT10
59
+
```
60
+
{% include copy.html %}
61
+
62
+
By default, JOIN queries will automatically terminate after 60 seconds to prevent excessive resource consumption. You can adjust this timeout period using a hint in your query. For example, to set a 5-minute (300-second) timeout, use the following code:
63
+
64
+
```sql
65
+
SELECT/*! JOIN_TIME_OUT(300) */left.a, right.bFROMleft JOIN right ONleft.id=right.id;
66
+
```
67
+
{% include copy.html %}
68
+
69
+
These performance restrictions don't apply when [querying external data sources]({{site.url}}{{site.baseurl}}/dashboards/management/query-data-source/).
0 commit comments