Re: Poor query plan chosen in 9.0.3 vs 8.3.7

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Poor query plan chosen in 9.0.3 vs 8.3.7
Дата
Msg-id 9177.1304627235@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Poor query plan chosen in 9.0.3 vs 8.3.7  (Brian Connolly <bconn@labkey.com>)
Список pgsql-performance
Brian Connolly <bconn@labkey.com> writes:
> Any help that you can provide would be greatly appreciated.

I'd suggest trying to get rid of the weird little subselects, like this
one:

>  ... SELECT * FROM assayresult."c69d129_particle_size_result_fields"
>  WHERE (((SELECT Container FROM exp.Data WHERE RowId = DataId) IN
> ('d938da12-1b43-102d-a8a2-78911b79dd1c'))) ...

If you turned that into a regular join between
c69d129_particle_size_result_fields and Data, the planner probably
wouldn't be nearly as confused about how many rows would result.
It's the way-off rowcount estimate for this construct that's
causing most of the problem, AFAICS:

                                       ->  Seq Scan on c69d129_particle_size_result_fields  (cost=0.00..229742.02
rows=348width=59) (actual time=0.018..572.402 rows=69654 loops=1) 
                                             Filter: (((SubPlan 3))::text =
'd938da12-1b43-102d-a8a2-78911b79dd1c'::text)
                                             SubPlan 3
                                               ->  Index Scan using pk_data on data  (cost=0.00..3.27 rows=1 width=37)
(actualtime=0.004..0.005 rows=1 loops=69654) 
                                                     Index Cond: (rowid = $2)

            regards, tom lane

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

Предыдущее
От: Bosco Rama
Дата:
Сообщение: Re: Poor query plan chosen in 9.0.3 vs 8.3.7
Следующее
От: Dimitri
Дата:
Сообщение: Re: VX_CONCURRENT flag on vxfs( 5.1 or later) for performance for postgresql?