Re: [GENERAL] Idea for the statistics collector

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] Idea for the statistics collector
Date: 2002-06-24 15:34:11
Message-ID: 18434.1024932851@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> I was thinking of writing a command line tool like 'pgtune' that looks at
> the stats views and will generate SQL code for, or do automatically the
> following:

> * Dropping indices that are never used
> * Creating appropriate indices to avoid large, expensive sequential scans.

Dropping unused indices sounds good --- but beware of dropping unique
indexes; they may be there to enforce a constraint, and not because of
any desire to use them in queries.

I'm not sure how you're going to automatically intuit appropriate
indexes to add, though. You'd need to look at a suitable workload
(ie, a representative set of queries) which is not data that's readily
available from the stats views. Perhaps we could expect the DBA to
provide a segment of log output that includes debug_print_query
and show_query_stats results.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mike Harding 2002-06-24 15:43:16 Astonishing explain...!
Previous Message Justin Clift 2002-06-24 15:27:12 PostgreSQL now part of the Lindows "Click-n-Run" Warehouse

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2002-06-24 16:18:16 Re: Our archive searching stinks
Previous Message Bruce Momjian 2002-06-24 14:39:03 Re: [GENERAL] Idea for the statistics collector