Re: Reasons for choosing one execution plan over another?

From: Giuseppe Broccolo <giuseppe(dot)broccolo(at)2ndquadrant(dot)it>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Reasons for choosing one execution plan over another?
Date: 2013-09-11 16:55:38
Message-ID: 5230A08A.7050001@2ndquadrant.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Il 11/09/2013 13:16, Mikkel Lauritsen ha scritto:
> Hi all,
>
> 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).
>
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.

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.

--
Giuseppe Broccolo - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
giuseppe(dot)broccolo(at)2ndQuadrant(dot)it | www.2ndQuadrant.it

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Andres Freund 2013-09-11 17:17:36 Re: Intermittent hangs with 9.2
Previous Message Jeff Janes 2013-09-11 16:20:40 Re: Reasons for choosing one execution plan over another?