Re: index on large table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: index on large table
Дата
Msg-id 8748.1016034109@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: index on large table  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Ответы Re: index on large table  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-general
>> "explain select * from events order by oid limit 10 offset 1000000"
>> NOTICE:  QUERY PLAN:
>> Limit  (cost=424863.54..424863.54 rows=10 width=130)
>> ->  Sort  (cost=424863.54..424863.54 rows=1025245 width=130)
>> ->  Seq Scan on events  (cost=0.00..35645.45 rows=1025245 width=130)
>>
>> Bummer. This is very slow again, sequential scan again. Why the index is
>> not used for this query? Use of index would make it very fast!

Not necessarily.  Using the index for this would require fetching
1000000+10 values in the indexscan (and throwing away all but 10).

The planner is counting on its fingers and guessing that the sort
is faster.  It might or might not be right about that (have you
compared timings?) but certainly the index method won't be
instantaneous.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Benjamin Smith
Дата:
Сообщение: Installing 7.2 on RedHat 7.1
Следующее
От: news@gemini-it.postgresql.org, [removetoreply].com@postgresql.org (Neil Everton)
Дата:
Сообщение: NEWBIE: Date format/timestamp issue ?