Re: index being ignored for "limit n" queries - Mailing list pgsql-general

From Piotr Sulecki
Subject Re: index being ignored for "limit n" queries
Date
Msg-id 42F9A25B.5070907@sybilla.traxelektronik.pl
Whole thread Raw
In response to Re: index being ignored for "limit n" queries  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Ave!

Tom Lane wrote:
>>trax=# explain select * from pakiety where stid = 234::smallint order by
>>received desc limit 1;
>
> The reason this won't use the (stid, received) index is that the
> requested sort order doesn't match that index.  Try
>
> select * from pakiety where stid = 234::smallint
> order by stid desc, received desc
> limit 1;

Thanks. It works. And the speedup was from 2 minutes 32.13 seconds to
0.69 seconds (in a worst case for the previous scenario).

Thanks again for your help.

Piotr Sulecki.

pgsql-general by date:

Previous
From: "Pit M."
Date:
Subject: libpy and ENABLE_THREAD_SAFETY=1
Next
From: "Pit M."
Date:
Subject: Howto build libpq.dll using VC2003 and ENABLE_THREAD_SAFETY=1