At 03:20 PM 21/11/2002 +0100, Eelco van Beek - IC&S wrote:
For what i know a LIMIT instruction should never result in a different query execution scheme. A limit is always a query result subset and will never involve the actual query itself. Subsequently analyze won't be able to optimize anything because a query with limit clause cannot be more efficient.

This is actually incorrect. To quote from the PostgreSQL manual:

    Also, if you limit the number of tuples to return with a LIMIT clause,
    the planner makes an appropriate interpolation between the endpoint
    costs to estimate which plan is really the cheapest

The planner does know that indexes can be used to return data in sorted order, so choosing to use the messageblk_idnr index is not a bad strategy (for small amounts of data).




----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 03 5330 3172          |                 ___________ |
Http://www.rhyme.com.au          |                /           \|
                                 |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/

Reply via email to