| От | Alan Hodgson |
|---|---|
| Тема | Re: How to speed up min/max(id) in 50M rows table? |
| Дата | |
| Msg-id | 200710121504.40365@hal.medialogik.com обсуждение исходный текст |
| Ответ на | Re: How to speed up min/max(id) in 50M rows table? (henk de wit <henk53602@hotmail.com>) |
| Список | pgsql-performance |
On Friday 12 October 2007, henk de wit <henk53602@hotmail.com> wrote: > > select payment_id from transactions order by payment_id desc limit 1; > > This one is indeed instant! Less than 50ms. In my case I can't use it for > max though because of the fact that payment_id can be null (which is an > unfortunate design choice). The other variant however didn't become > instant. I.e. I tried: > > select time from transactions where payment_id = 67 order by time asc > limit 1; > > But this one is still really slow. If you had a compound index on payment_id,time (especially with a WHERE time IS NOT NULL conditional) it would likely speed it up. -- Ghawar is dying
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера