Re:
От | Philip Warner |
---|---|
Тема | Re: |
Дата | |
Msg-id | 3.0.5.32.20001031013120.028dd500@mail.rhyme.com.au обсуждение исходный текст |
Ответ на | (Lengyel Ferenc <lengyel@hell.ditec.sk>) |
Список | pgsql-sql |
At 13:36 30/10/00 +0100, Lengyel Ferenc wrote: >Hello everybody! >I need some help with a simple query. >I've got a problem with getting a maximum value from a very large table >(10000000+ rows): Unfortunately PGSQL does not use indexes for min & max. One approach that should work is: select col1 from TABLE_A WHERE COL2 = 1 order by col2, col1 desc limit 1; and you will need an index on (col2, col1). ---------------------------------------------------------------- Philip Warner | __---_____ Albatross Consulting Pty. Ltd. |----/ - \ (A.B.N. 75 008 659 498) | /(@) ______---_ Tel: (+61) 0500 83 82 81 | _________ \ Fax: (+61) 0500 83 82 82 | ___________ | Http://www.rhyme.com.au | / \| | --________-- PGP key available upon request, | / and from pgp5.ai.mit.edu:11371 |/
В списке pgsql-sql по дате отправления: