Search Postgresql Archives

Re: index being ignored for "limit n" queries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux