Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my> writes:
> You can use limit. Postgresql is smart enough to stop once it has the
> necessary rows[1].
> [1] Or was it necessary rows + 1? Agh, something wrong with my memory.
7.4 stops at exactly the LIMIT row count. Several prior releases fetch
one more row internally ... which is hardly noticeable in most contexts,
but sure enough we got complaints ...
regards, tom lane