Re: Reasons for choosing one execution plan over another?
От | Gavin Flower |
---|---|
Тема | Re: Reasons for choosing one execution plan over another? |
Дата | |
Msg-id | 5230DBAE.20108@archidevsys.co.nz обсуждение исходный текст |
Ответ на | Re: Reasons for choosing one execution plan over another? (Giuseppe Broccolo <giuseppe.broccolo@2ndquadrant.it>) |
Список | pgsql-performance |
On 12/09/13 04:55, Giuseppe Broccolo wrote:
Il 11/09/2013 13:16, Mikkel Lauritsen ha scritto:Even identical content could lead to different plans, as the sampling is done randomly (or at least 'randomly' according to the documentation).Hi all,I think that your answer can be found in your statement "slightly different contents". Planner choices query execution plans basing on statistics obtained during ANALYSE operations, including the autovacuum. In this way, Planner can decide which execution plan is the most suitable. Different content of values in your table could correspond to different statistical distribution of values in your columns and of rows in your tables, bringing to different choices of the Planner. Execution times can be very different, also by factor 10-100.
I have a number of Postgres 9.2.4 databases with the same schema but with
slightly different contents, running on small servers that are basically
alike (8-16 GB ram).
There is a parameter (stat_target) which set the "selectivity" of statistical samples of a table. Maybe, but it's not necessarily true, you could obtain more comparable execution times for the two execution plans changing it, probably increasing them.
Giuseppe.
В списке pgsql-performance по дате отправления: