Re: speed of querry? - Mailing list pgsql-performance

From Dawid Kuroczko
Subject Re: speed of querry?
Date
Msg-id 758d5e7f05041409044eadfcd1@mail.gmail.com
Whole thread Raw
In response to Re: speed of querry?  ("Joel Fradkin" <jfradkin@wazagua.com>)
Responses Re: speed of querry?
List pgsql-performance
On 4/14/05, Joel Fradkin <jfradkin@wazagua.com> wrote:
> Josh from commandprompt.com had me alter the config to have
> default_statistics_target = 250
>
> Is this somehow related to what your asking me to do?
> I did do an analyze, but have only ran the viw a few times.

well, he did suggest the right thing.  However this parameter
applies to newly created tables, so either recreate the tables
or do the ALTER TABLE I've sent eariler.

Basically it tells postgres how many values should it keep for
statistics per column.  The config default_statistics_target
is the default (= used when creating table) and ALTER... is
a way to change it later.

The more statistics PostgreSQL has means it can better
predict how much data will be returned -- and this directly
leads to a choice how to handle the data (order in which
tables should be read, whether to use index or not, which
algorithm use for join, etc.).  The more statistics, the better
PostgreSQL is able to predict.  The more statistics, the slower
planner is able to do the analysis.  So you have to find
a value which will be as much as is needed to accurately
predict the results but not more!  PostgreSQL's default of
10 is a bit conservative, hence the suggestions to increase
it. :)  [ and so is random_page_cost or some people have
found that in their cases it is beneficial to reduce the value,
even as much as below 2. ]

Hope this clairifies things a bit.

   Regards,
      Dawid

pgsql-performance by date:

Previous
From: "Matthew Nuzum"
Date:
Subject: Re: How to improve db performance with $7K?
Next
From: Stephan Szabo
Date:
Subject: Re: Foreign key slows down copy/insert