Re: Slow query

Поиск
Список
Период
Сортировка
От Tomasz Myrta
Тема Re: Slow query
Дата
Msg-id 3E2FFF91.7020700@klaster.net
обсуждение исходный текст
Ответ на Slow query  (Ricardo Javier Aranibar León<ricardo_jal@hotmail.com>)
Список pgsql-sql
Ricardo Javier Aranibar León wrote:
> I run Explain and this is the result:
> EXPLAIN SELECT * from simon where fecha='20030122' order by hora desc;
> NOTICE:  QUERY PLAN:
> Sort  (cost=57700.73..57700.73 rows=23682 width=46)
>  ->  Seq Scan on simon  (cost=0.00..55591.05 rows=23682 width=46)
> 
> and when I run explain for another table this is te result:
> EXPLAIN SELECT * from llamada where fecha='20030122' order by hora desc;
> NOTICE:  QUERY PLAN:
> Sort  (cost=41102.70..41102.70 rows=12413 width=82)
>  ->  Index Scan using fecha_lla on llamada  (cost=0.00..39944.95 
> rows=12413 width=82)

I'm not sure if there is much to help. You have a lots of rows in result -
23k rows and 12k rows. The problem is in output, not in query or indexing.

Do you really use such queries?
Anyway, did you vaccum analyze before testing?

Regards,
Tomasz Myrta




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

Предыдущее
От: Ricardo Javier Aranibar León
Дата:
Сообщение: Slow query
Следующее
От: Tom Lane
Дата:
Сообщение: Re: calling function from rule