Search Postgresql Archives

Re: why is the LIMIT clause slowing down this SELECT?

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

 



Jeff Davis <pgsql@xxxxxxxxxxx> writes:
> On Wed, 2007-08-01 at 15:56 -0500, Mason Hale wrote:
>> SELECT *
>> FROM topic_feed
>> WHERE topic_id = 106947234
>> ORDER BY score DESC
>> LIMIT 25

> In plan 1, the planner thinks that it will find 25 tuples matching that
> topic_id quickly during the backwards index scan on
> topic_feed_score_index. Instead, it looks like it has to go through a
> lot of tuples before it finds the necessary 25.

Yeah.  An index on (topic_id, score) would perhaps be helpful.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[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