pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig A. James <cjames@modgraph-usa.com>
To: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Identical Queries
Date: Thu, 01 Mar 2007 14:41:39 -0800
Message-ID: <45E756A3.5020604@modgraph-usa.com> (raw)
In-Reply-To: <45E73DA5.40808@callone.net>
References: <45E6F49D.3010707@callone.net>
	<20070301112948.R45862@megazone.bigpanda.com>
	<45E73DA5.40808@callone.net>

Stephan Szabo wrote:
> I tried posting to the bugs, and they said this is a better question for here.
> I have to queries. One runs in about 2 seconds. The other takes upwards
> of 2 minutes. I have a temp table that is created with 2 columns. This
> table is joined with the larger database of call detail records.
> However, these 2 queries are handled very differently.

Even for a temporary table, you should run ANALYZE on it after you fill it but before you query or join to it.  I found out (the hard way) that a temporary table of just 100 rows will generate dramatically different plans before and after ANALYZE.

Craig




view thread (6+ messages)

Message-ID: <45E756A3.5020604@modgraph-usa.com>
Permalink:  ../45E756A3.5020604@modgraph-usa.com/
Also on:    postgresql.org/message-id/45E756A3.5020604@modgraph-usa.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: cjames@modgraph-usa.com, sszabo@megazone.bigpanda.com
  Subject: Re: Identical Queries
  In-Reply-To: <45E756A3.5020604@modgraph-usa.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