pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Ingres statdump equivalent for postgresql
4+ messages / 4 participants
[nested] [flat]

* Ingres statdump equivalent for postgresql
@ 2010-09-17 17:39 badair@epc-instore.com
  2010-09-17 18:33 ` Re: Ingres statdump equivalent for postgresql Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2010-09-17 22:13 ` Re: Ingres statdump equivalent for postgresql Greg Smith <greg@2ndquadrant.com>
  0 siblings, 2 replies; 4+ messages in thread

From: badair@epc-instore.com @ 2010-09-17 17:39 UTC (permalink / raw)
  To: pgsql-admin

Hello all,
I'm looking for a tool that will enable me to dump the data frequency histograms
for a postgresql table. This assumes of course that postgresql supports compilation and use of these sort of statistics. I've had a look through the manuals but nothing springs to the eye.
TIA
Bill




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Ingres statdump equivalent for postgresql
  2010-09-17 17:39 Ingres statdump equivalent for postgresql badair@epc-instore.com
@ 2010-09-17 18:33 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2010-09-17 20:30   ` Re: Ingres statdump equivalent for postgresql Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 4+ messages in thread

From: Kevin Grittner @ 2010-09-17 18:33 UTC (permalink / raw)
  To: badair@epc-instore.com; pgsql-admin

<badair@epc-instore.com> wrote:
 
> I'm looking for a tool that will enable me to dump the data
> frequency histograms for a postgresql table. This assumes of
> course that postgresql supports compilation and use of these sort
> of statistics. I've had a look through the manuals but nothing
> springs to the eye.
 
Did you look at the system catalogs in the documentation?  It sounds
like you want some of the information from pg_statistic in pretty
form?
 
http://www.postgresql.org/docs/current/interactive/catalog-pg-statistic.html
 
You might also want to read about the ANALYZE command.
 
-Kevin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Ingres statdump equivalent for postgresql
  2010-09-17 17:39 Ingres statdump equivalent for postgresql badair@epc-instore.com
  2010-09-17 18:33 ` Re: Ingres statdump equivalent for postgresql Kevin Grittner <Kevin.Grittner@wicourts.gov>
@ 2010-09-17 20:30   ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2010-09-17 20:30 UTC (permalink / raw)
  To: Kevin Grittner <Kevin.Grittner@wicourts.gov>; +Cc: badair@epc-instore.com; pgsql-admin

"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Did you look at the system catalogs in the documentation?  It sounds
> like you want some of the information from pg_statistic in pretty
> form?

... like the pg_stats view?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Ingres statdump equivalent for postgresql
  2010-09-17 17:39 Ingres statdump equivalent for postgresql badair@epc-instore.com
@ 2010-09-17 22:13 ` Greg Smith <greg@2ndquadrant.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Greg Smith @ 2010-09-17 22:13 UTC (permalink / raw)
  To: badair@epc-instore.com; +Cc: pgsql-admin

badair@epc-instore.com wrote:
> I'm looking for a tool that will enable me to dump the data frequency histograms
> for a postgresql table.

#!/bin/bash
DB="$1"
TABLE="$2"
psql -d $DB -x -c "SELECT 
tablename,attname,null_frac,avg_width,n_distinct,correlation,most_common_vals,most_common_freqs,histogram_bounds 
FROM pg_stats where tablename='$TABLE'"

Run that, pass it database then table name, and you'll get the data for 
each column in that table.  That should get you started; refer to 
http://www.postgresql.org/docs/current/interactive/catalog-pg-statistic.html 
and to 
http://www.postgresql.org/docs/current/interactive/planner-stats-details.html 
for more details.

-- 
Greg Smith, 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD
PostgreSQL Training, Services and Support  www.2ndQuadrant.us
Author, "PostgreSQL 9.0 High Performance"    Pre-ordering at:
https://www.packtpub.com/postgresql-9-0-high-performance/book




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2010-09-17 22:13 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-09-17 17:39 Ingres statdump equivalent for postgresql badair@epc-instore.com
2010-09-17 18:33 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2010-09-17 20:30   ` Tom Lane <tgl@sss.pgh.pa.us>
2010-09-17 22:13 ` Greg Smith <greg@2ndquadrant.com>

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