Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp> writes:
> Does using LIMIT cause query execution to stop as soon as the LIMIT
> number of matches have been found, or are *all* the matching rows found
> first and then the first LIMIT number are returned?
The current implementation actually stops after fetching, or at least
trying to fetch, one more row than the LIMIT+OFFSET sum. The extra row
is for internal convenience (keeps the direction-reversal logic in
nodeLimit.c simple). Some people have complained about that, but no
one's gotten annoyed enough to rewrite nodeLimit to avoid it.
regards, tom lane