Re: Identical Queries

From: "Craig A(dot) James" <cjames(at)modgraph-usa(dot)com>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Identical Queries
Date: 2007-03-01 22:41:39
Message-ID: 45E756A3.5020604@modgraph-usa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2007-03-01 22:44:29 Re: stats collector process high CPU utilization
Previous Message hatman 2007-03-01 22:28:09 Re: performances with Pentium D