No index maximum? (was Re: No merge sort?)
От | Taral |
---|---|
Тема | No index maximum? (was Re: No merge sort?) |
Дата | |
Msg-id | 20030314201946.GA1882@taral.net обсуждение исходный текст |
Ответ на | No merge sort? (Taral <taral@taral.net>) |
Ответы |
Re: No index maximum? (was Re: No merge sort?)
|
Список | pgsql-hackers |
Same setup, different query: test=> explain select max(time) from test where id = '1'; NOTICE: QUERY PLAN: Aggregate (cost=5084.67..5084.67 rows=1 width=0) -> Index Scan using idx on test (cost=0.00..5081.33 rows=1333 width=0) Since the index is (id, time), why isn't the index being used to retrieve the maximum value? On Thu, Mar 13, 2003 at 03:10:49PM -0600, Taral wrote: > I have a table "test" that looks like this: > > CREATE TABLE test ( > id BIGINT, > time INTEGER > ); > > There is an index: > > CREATE INDEX idx ON test(id, time); > > The table has been loaded with 2M rows, where time ranges sequentially > from 0 to 1999999 and id is random values from 0 to 49999. -- Taral <taral@taral.net> This message is digitally signed. Please PGP encrypt mail to me. "Most parents have better things to do with their time than take care of their children." -- Me
В списке pgsql-hackers по дате отправления: