Skip to content

fix: Remove `limit 1` condition for EXISTS subqueries on Many datatype

Andrii Bezuglyi requested to merge fix/sql_remove_many_limit_1 into master

The "limit 1" INSIDE exists subquery does not have any sense. At fact, it make query worse, because it prevents Postrgres from building good plan and it scans table instead.

I found this reference: https://stackoverflow.com/questions/37660320/logic-changing-exists-vs-exists-limit-1

And I am observing exactly the same problem - query with that "limit 1" turns out to be 25secound long query, which it shall be <100ms, as it is without the "limit 1" inside "exists".

Merge request reports

Loading