Re: detecting poor query plans

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <gsstark(at)mit(dot)edu>, Neil Conway <neilc(at)samurai(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: detecting poor query plans
Date: 2003-11-27 02:53:52
Message-ID: 200311270253.hAR2rqO16555@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gavin Sherry wrote:
> > > On further thought the real problem is that these numbers are only available
> > > when running with "explain" on. As shown recently on one of the lists, the
> > > cost of the repeated gettimeofday calls can be substantial. It's not really
> > > feasible to suggest running all queries with that profiling.
> >
> > Yeah. You could imagine a simplified-stats mode that only collects the
> > total runtime (two gettimeofday's per query is nothing) and the row
> > counts (shouldn't be impossibly expensive either, especially if we
> > merged the needed fields into PlanState instead of requiring a
> > separately allocated node). Not sure if that's as useful though.
>
> How about a PGC_POSTMASTER GUC variable which tells postgres to collect
> details on the planner's performance and comparison to actual run times.
> Optionally, we could also have the executor run some/all of the possible
> plans (presumably only useful for SELECTs) and keep details on the
> performance of each. At postmaster shutdown (some other time?) a report
> could be produced profiling all queries.
>
> The reason I suggest this is it would have zero impact on production
> databases but would allow DBAs to profile their databases with real usage
> patterns in development environments.

Great idea. Under ideal situations, it shouldn't be needed, but things
are often less than idea.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2003-11-27 03:00:18 Re: pg_restore and create FK without verification check
Previous Message Kevin Brown 2003-11-27 02:35:32 Re: pg_restore and create FK without verification check