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
For example, the query SELECT station.name FROM \"weather-data-2016\" WHERE LENGTH(station.name) > 10 LIMIT 10 takes more than 60s on the NOAA benchmark dataset. The equivalent search request on the other hand only takes a few ms:
Note, the search request does not open a scroll context but SQL does. Opening the scroll context causes ES to count all matching documents which requires to evaluate the script on every doc.
This issue could be addressed by using PIT instead of scroll contexts (see #61873).
The text was updated successfully, but these errors were encountered:
Opening the scroll context causes ES to count all matching documents which requires to evaluate the script on every doc.
Curious how is the result evaluated when not opening a scroll context (or with PIT), if not going through every doc?
Is the size considered in one case (scroll/PIT), but not the other?
Sorry, only saw your question today @bpintea. The script filter only needs to be applied until you have 10 matches. If the script is not too selective, you might only have to go through a few docs.
It seems to be a peculiarity of the scroll functionality that it includes a match count. Maybe that's not even necessary and a bug. PIT does not have this issue.
Luegg
linked a pull request
Feb 8, 2022
that will
close
this issue
Resolves#61873
The goal of this PR is to remove the use of the deprecated scroll
cursors in SQL. Functionality and APIs should remain the same with one
notable difference: The last page of a search hit query used to always
include a scroll cursor if it is non-empty. This is no longer the case,
if a result set is exhausted, the PIT will be closed and the last page
does not include a cursor.
Note, PIT can also be used for aggregation and PIVOT queries but this is
not in the scope of this PR and will be implemented in a follow up.
Additionally, this PR resolves#80523 because the total doc count is no
longer required.
For example, the query
SELECT station.name FROM \"weather-data-2016\" WHERE LENGTH(station.name) > 10 LIMIT 10
takes more than 60s on the NOAA benchmark dataset. The equivalent search request on the other hand only takes a few ms:Note, the search request does not open a scroll context but SQL does. Opening the scroll context causes ES to count all matching documents which requires to evaluate the script on every doc.
This issue could be addressed by using PIT instead of scroll contexts (see #61873).
The text was updated successfully, but these errors were encountered: