From: | Greg Smith <greg(at)2ndquadrant(dot)com> |
---|---|
To: | badair(at)epc-instore(dot)com |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Ingres statdump equivalent for postgresql |
Date: | 2010-09-17 22:13:51 |
Message-ID: | 4C93E81F.7080905@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
badair(at)epc-instore(dot)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(at)2ndQuadrant(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Kasia Tuszynska | 2010-09-17 23:30:14 | question about HA in PG 9.0 |
Previous Message | Rob Richardson | 2010-09-17 21:00:22 | How do I use Npgsql to connect to a DSN? |