Any point in using LIMIT in EXISTS query?
Fiddling with my query a bit, I noticed that EXISTS
still returns 1 if LIMIT
is set to 0. I assume this indicates that it's being ignored.
The purpose of EXISTS()
is to perform the query only until it can decide if there are any rows in that table matching the WHERE
clause. That is, it logically does the same thing as LIMIT 1
. EXISTS
is probably called semi-join
in some circles.
Bottom line: Don't use LIMIT 1
inside EXISTS()
.
Addenda: As Paul points out, a LIMIT
with an OFFSET
(or LIMIT m,n
) does have meaning.