Re: 500x speed-down: Wrong query plan?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: 500x speed-down: Wrong query plan?
Дата
Msg-id 6914.1136833010@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: 500x speed-down: Wrong query plan?  (Alessandro Baretta <a.baretta@barettadeit.com>)
Ответы Re: 500x speed-down: Wrong statistics!
Список pgsql-performance
Alessandro Baretta <a.baretta@barettadeit.com> writes:
> Tom Lane wrote:
>> I'm curious to see how many rows the planner thinks this will produce,
>> and whether it will use the index or not.

> dmd-freerp-1-alex=# EXPLAIN ANALYZE SELECT * FROM articolo WHERE
> articolo.xdbs_modified > '2006-01-08 18:25:00+01';
>                                                                  QUERY PLAN
>
-------------------------------------------------------------------------------------------------------------------------------------------
>   Index Scan using articolo_modified_index on articolo  (cost=0.00..3914.91
> rows=17697 width=653) (actual time=0.032..0.032 rows=0 loops=1)
>     Index Cond: (xdbs_modified > '2006-01-08 18:25:00'::timestamp without time zone)
>   Total runtime: 0.150 ms
> (3 rows)

Well, there's your problem: 17697 rows estimated vs 0 actual.  With a
closer row estimate it would've probably done the right thing for the
join problem.

How many rows are really in the table, anyway?  Could we see the
pg_stats row for articolo.xdbs_modified?

            regards, tom lane

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

Предыдущее
От: Chris Hoover
Дата:
Сообщение: Memory Usage Question
Следующее
От: "Luke Lonergan"
Дата:
Сообщение: Re: help tuning queries on large database