From: Greg Smith <greg@2ndquadrant.com>
To: badair@epc-instore.com
Cc: pgsql-admin@postgresql.org
Subject: Re: Ingres statdump equivalent for postgresql
Date: Fri, 17 Sep 2010 18:13:51 -0400
Message-ID: <4C93E81F.7080905@2ndquadrant.com> (raw)
In-Reply-To: <1284745176.201931386@192.168.2.231>
References: <1284745176.201931386@192.168.2.231>
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
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-admin@postgresql.org
Cc: greg@2ndquadrant.com, badair@epc-instore.com
Subject: Re: Ingres statdump equivalent for postgresql
In-Reply-To: <4C93E81F.7080905@2ndquadrant.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