Re: should I increase default_statistics_target

From: Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com>
To: AI Rumman <rummandba(at)gmail(dot)com>
Cc: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: should I increase default_statistics_target
Date: 2012-09-20 11:38:53
Message-ID: CAM6mie+oj2BrJVOAjzV8gPRNDUaREdKi9sd9U0ozzjtbnaqu1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

On 20 September 2012 20:49, AI Rumman <rummandba(at)gmail(dot)com> wrote:
> Using explain analyze of a large query I found that in every step there are
> a lot difference between the number of rows between actual and estimated.
> I am using default_statistics_target 200. Should I increase it?

I would keep it at default level but I would increase it per column:
ALTER TABLE <table> ALTER <column> SET STATISTICS <number>

and you can do the same for index:

ALTER TABLE <index_name> ALTER COLUMN <column> SET STATISTICS <number>

(for function indexes you need to use \d in order to see "real" column name)

Finally, you need to run analyse on that table / column

--
Ondrej Ivanic
(ondrej(dot)ivanic(at)gmail(dot)com)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message pavithra 2012-09-20 12:07:18 Need psql send email
Previous Message AI Rumman 2012-09-20 10:49:21 should I increase default_statistics_target