Index Backward Scan fast / Index Scan slow !

Поиск
Список
Период
Сортировка
От Pailloncy Jean-Gérard
Тема Index Backward Scan fast / Index Scan slow !
Дата
Msg-id 8A2105D4-8C63-11D8-80FD-000A95DE2550@ifrance.com
обсуждение исходный текст
Ответы Re: Index Backward Scan fast / Index Scan slow !
Список pgsql-performance
Hi,

I test many times the foolowing query.

dps=# explain analyze select next_index_time from url order by
next_index_time desc limit 1;

QUERY PLAN
------------------------------------------------------------------------
------------------------------------------------------------------------
----
  Limit  (cost=0.00..2.62 rows=1 width=4) (actual time=56.615..56.616
rows=1 loops=1)
    ->  Index Scan Backward using url_next_index_time on url
(cost=0.00..768529.55 rows=293588 width=4) (actual time=56.610..56.610
rows=1 loops=1)
  Total runtime: 56.669 ms
(3 rows)

dps=# explain analyze select next_index_time from url order by
next_index_time asc limit 1;

QUERY PLAN
------------------------------------------------------------------------
------------------------------------------------------------------------
-
  Limit  (cost=0.00..2.62 rows=1 width=4) (actual
time=94879.636..94879.637 rows=1 loops=1)
    ->  Index Scan using url_next_index_time on url
(cost=0.00..768529.55 rows=293588 width=4) (actual
time=94879.631..94879.631 rows=1 loops=1)
  Total runtime: 94879.688 ms
(3 rows)

How to optimize the last query ? (~ 2000 times slower than the first
one)
I suppose there is some odd distribution of data in the index ?
Is the solution to reindex data ?

Cordialement,
Jean-Gérard Pailloncy

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

Предыдущее
От: "Andrew Matthews"
Дата:
Сообщение: Re: Wierd issues
Следующее
От: Rajesh Kumar Mallah
Дата:
Сообщение: Effect of too many columns