Re: Query gets slow when where clause increases

Поиск
Список
Период
Сортировка
От Dennis Bjorklund
Тема Re: Query gets slow when where clause increases
Дата
Msg-id Pine.LNX.4.44.0407012238120.21809-100000@zigo.dhs.org
обсуждение исходный текст
Ответ на Query gets slow when where clause increases  (James Antill <james@and.org>)
Список pgsql-performance
On Tue, 29 Jun 2004, James Antill wrote:

>                ->  Index Scan using idx_ticket_groups_assigned on ticket_groups g  (cost=0.00..241.76 rows=5
width=20)(actual time=0.13..12.67 rows=604 loops=1) 
>                      Index Cond: (assigned_to = 1540)

Here the planner estimated that it would find 5 rows, but it did find 604.
I take that as a sign that you have not ran VACUUM ANALYZE recently?

If you done that, then maybe you need to change the statistics target for
that column. Before you set it on that column you could try to just alter
the default statistics target for one session like this:

SET default_statistics_target TO 100;
ANALYZE;

and then see if you get a better plan when you run the query afterwards.

If it helps you can either set the default_statistics_target in
postgresql.conf or set it just for some column using ALTER TABLE.

--
/Dennis Björklund


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

Предыдущее
От: James Antill
Дата:
Сообщение: Query gets slow when where clause increases
Следующее
От: "Peter Alberer"
Дата:
Сообщение: Mysterious performance of query because of plsql function in where condition