pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dawid Kuroczko <qnex42@gmail.com>
To: pgsql-performance@postgresql.org
Subject: When to bump up statistics?
Date: Fri, 19 Nov 2004 14:59:48 +0100
Message-ID: <758d5e7f04111905594cf9c9f8@mail.gmail.com> (raw)

ALTER TABLE foo ALTER COLUMN bar SET STATISTICS n; .....

I wonder what are the implications of using this statement,
I know by using, say n=100, ANALYZE will take more time,
pg_statistics will be bigger, planner will take longer time,
on the other hand it will make better decisions... Etc, etc.

I wonder however when it is most uselful to bump it up.
Please tell me what you think about it:

Is bumping up statistics is only useful for indexed columns?

When is it most useful/benefitial to bump them up:

1) huge table with huge number of distinct values (_almost_
    unique ;))

2) huge table with relatively equally distributed values
    (like each value is in between, say, 30-50 rows).

3) huge table with unequally distributed values (some
    values are in 1-5 rows, some are in 1000-5000 rows).

4) huge table with small number values (around ~100
    distinct values, equally or uneqally distributed).

5) boolean column.

I think SET STATISTICS 100 is very useful for case with
unequally distributed values, but I wonder what about
the other cases.  And as a side note -- what are the
reasonable bounds for statistics (between 10 and 100?)

What are the runtime implications of setting statistics
too large -- how much can it affect queries?

And finally -- how other RDBMS and RDBM-likes deal
with this issue? :)

   Regards,
      Dawid



view thread (3+ messages)  latest in thread

Message-ID: <758d5e7f04111905594cf9c9f8@mail.gmail.com>
Permalink:  ../758d5e7f04111905594cf9c9f8@mail.gmail.com/
Also on:    postgresql.org/message-id/758d5e7f04111905594cf9c9f8@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: qnex42@gmail.com
  Subject: Re: When to bump up statistics?
  In-Reply-To: <758d5e7f04111905594cf9c9f8@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox