Skip site navigation (1) Skip section navigation (2)

Re: any way to use indexscan to get last X values

From: Tomaz Borstnar <tomaz(dot)borstnar(at)over(dot)net>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: any way to use indexscan to get last X values
Date: 2003-06-15 15:17:04
Message-ID: 5.2.1.1.0.20030615171224.01c32eb0@127.0.0.1 (view raw or flat)
Thread:
Lists: pgsql-performance
At 16:31 15.6.2003, Shridhar Daithankar wrote:

>Question. The field approved seems to have boolean values. If probability of
>having either of value is 50%, I doubt planner will use index anyway.

True. It has Y or N only so index on approved is useless. But using index 
on ORDER BY part would help a lot since it knows to fetch last X ordered 
values.

>Correct me if I am wrong.
Unfortunately you are very right.

I am not sure how to stuff modifystamp and thread into WHERE clause to make 
it use indexes on thread and/or modifystamp. So far I believe this would be 
the only way to use them, right?

Tomaz 



In response to

pgsql-performance by date

Next:From: Stephan SzaboDate: 2003-06-15 16:33:45
Subject: Re: any way to use indexscan to get last X values with
Previous:From: Shridhar DaithankarDate: 2003-06-15 14:31:38
Subject: Re: any way to use indexscan to get last X values with "order by Y limit X" clause?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group