Re: Suboptimal execution plan for simple query

Поиск
Список
Период
Сортировка
От Markus Wollny
Тема Re: Suboptimal execution plan for simple query
Дата
Msg-id 28011CD60FB1724DBA4442E38277F6260AF9915F@hermes.computec.de
обсуждение исходный текст
Ответ на Re: Suboptimal execution plan for simple query  (Sam Mason <sam@samason.me.uk>)
Ответы Re: Suboptimal execution plan for simple query
Список pgsql-general
Hi!

Sam Mason wrote:
> You may have some luck with increasing the statistics target on the
> entry_id and last_updated columns and re-ANALYZING the table.  Then
> again, the fact that it thinks it's only going to get a single row
> back when it searches for the entity_id suggests that it's all a bit
> confused!

Thank you for that suggestion. Increasing the statistics target on entity_id from the default 10 to 30 and re-analyzing
didthe trick: 

"Limit  (cost=340.75..340.75 rows=1 width=12) (actual time=0.084..0.085 rows=1 loops=1)"
"  ->  Sort  (cost=340.75..341.00 rows=103 width=12) (actual time=0.081..0.081 rows=1 loops=1)"
"        Sort Key: last_updated"
"        ->  Index Scan using idx_image_relation_entity_id on image_relation  (cost=0.00..337.30 rows=103 width=12)
(actualtime=0.059..0.065 rows=3 loops=1)" 
"              Index Cond: (entity_id = 69560)"
"Total runtime: 0.121 ms"

Kind regards

   Markus


Computec Media AG
Sitz der Gesellschaft und Registergericht: Fürth (HRB 8818)
Vorstandsmitglieder: Johannes S. Gözalan (Vorsitzender) und Rainer Rosenbusch
Vorsitzender des Aufsichtsrates: Jürg Marquard
Umsatzsteuer-Identifikationsnummer: DE 812 575 276



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

Предыдущее
От: "Jean-Christophe Arnu"
Дата:
Сообщение: pg_lesslog/pg_standby
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Stored function - send array as parameter to stored function