pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gregory S. Williamson <gsw@globexplorer.com>
To: Robert Davis <robert@faithwestinc.com>
To: pgsql-sql@postgresql.org
Subject: Re: explain analyze results are different for each iteration
Date: Tue, 14 Sep 2004 18:33:11 -0700
Message-ID: <71E37EF6B7DCC1499CEA0316A256832801D4B7D4@loki.wc.globexplorer.net> (raw)


Are you forcing stuff out of cache (both postgres and OS) ? I've found that this can make a huge difference with some queries ... not sure that this would make it have different plans, though.

My ill-informied $0.02 worth ... fwiw

Greg Williamson
DBA
GlobeXplorer LLC

-----Original Message-----
From:	Robert Davis [mailto:robert@faithwestinc.com]
Sent:	Tue 9/14/2004 6:21 PM
To:	pgsql-sql@postgresql.org
Cc:	
Subject:	[SQL] explain analyze results are different for each iteration
I'm trying to benchmark some complex sql queries.  One query, in 
particular, is causing problems -- its cost values can vary from 228 
to 907, its Total Runtimes from 60 ms to 5176 ms.  The query plans 
show that the optimizer is choosing different plans for different 
iterations of the same query.  Does anyone have any idea what's 
going on here or maybe how I can force Postgres to prefer the faster 
plan?

The query plans are very long (11 tables joined) but I can include 
them if it might help.  Thanks for any advice,

Roberto

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html






view thread (3+ messages)  latest in thread

Message-ID: <71E37EF6B7DCC1499CEA0316A256832801D4B7D4@loki.wc.globexplorer.net>
Permalink:  ../71E37EF6B7DCC1499CEA0316A256832801D4B7D4@loki.wc.globexplorer.net/
Also on:    postgresql.org/message-id/71E37EF6B7DCC1499CEA0316A256832801D4B7D4@loki.wc.globexplorer.net

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: gsw@globexplorer.com, robert@faithwestinc.com
  Subject: Re: explain analyze results are different for each iteration
  In-Reply-To: <71E37EF6B7DCC1499CEA0316A256832801D4B7D4@loki.wc.globexplorer.net>
  References: <71E37EF6B7DCC1499CEA0316A256832801D4B7D4@loki.wc.globexplorer.net>

* 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