Search Postgresql Archives

Re: Suboptimal execution plan for simple query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 did the 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) (actual time=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



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux