dbTalk Databases Forums  

Can someone explain ALTER TABLE SET STATISTICS?

comp.databases.postgresql comp.databases.postgresql


Discuss Can someone explain ALTER TABLE SET STATISTICS? in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mladen Gogala
 
Posts: n/a

Default Can someone explain ALTER TABLE SET STATISTICS? - 11-16-2009 , 12:09 PM






The documentation of this command is extremely unclear and vague? What
does the integer argument taken by this command represent? My guess is
that it is determining the percentage of the table to inspect for
calculating the statistics? If that is so, why is it integer?



--
http://mgogala.byethost5.com

Reply With Quote
  #2  
Old   
Matthew Woodcraft
 
Posts: n/a

Default Re: Can someone explain ALTER TABLE SET STATISTICS? - 11-16-2009 , 12:59 PM






Mladen Gogala <no (AT) email (DOT) here.invalid> wrote:

Quote:
The documentation of this command is extremely unclear and vague? What
does the integer argument taken by this command represent? My guess is
that it is determining the percentage of the table to inspect for
calculating the statistics? If that is so, why is it integer?
What it controls directly is the level of detail used to store summary
statistics after the table has been inspected.

It determines two things: the number of 'most common values' to store
statistics for, and the number of buckets to store statistics for in
the value frequency histogram.

Section 14.2 explains this, and there's a detailed walkthrough of the
algorithm that uses it in 55.1 (in the 8.4 docs).


I believe it does also indirectly determine the percentage of the table
inspected; that is, ANALYZE samples enough rows to get accurate
statistics at the level of detail requested. I don't think this
percentage is directly tunable.

-M-

Reply With Quote
  #3  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: Can someone explain ALTER TABLE SET STATISTICS? - 11-16-2009 , 01:45 PM



On Mon, 16 Nov 2009 18:59:04 +0000, Matthew Woodcraft wrote:

Quote:
Mladen Gogala <no (AT) email (DOT) here.invalid> wrote:

The documentation of this command is extremely unclear and vague? What
does the integer argument taken by this command represent? My guess is
that it is determining the percentage of the table to inspect for
calculating the statistics? If that is so, why is it integer?

What it controls directly is the level of detail used to store summary
statistics after the table has been inspected.

It determines two things: the number of 'most common values' to store
statistics for, and the number of buckets to store statistics for in the
value frequency histogram.

Section 14.2 explains this, and there's a detailed walkthrough of the
algorithm that uses it in 55.1 (in the 8.4 docs).


I believe it does also indirectly determine the percentage of the table
inspected; that is, ANALYZE samples enough rows to get accurate
statistics at the level of detail requested. I don't think this
percentage is directly tunable.

-M-
Ah, I got it:

"The amount of information stored in pg_statistic by ANALYZE, in
particular the maximum number of entries in the most_common_vals and
histogram_bounds arrays for each column, can be set on a column-by-column
basis using the ALTER TABLE SET STATISTICS command, or globally by
setting the default_statistics_target configuration variable."

It's the size of histogram for every column! Thanks a lot for your help.



--
http://mgogala.byethost5.com

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.