Re: Trying to track down weird query stalls

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: dan(at)sidhe(dot)org
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Trying to track down weird query stalls
Date: 2009-03-30 20:39:39
Message-ID: 20090330203939.GF23023@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

dan(at)sidhe(dot)org escribió:

> where libinstance.libdate <= 1238445044
> and libinstance.enddate > 1238445044
> and libinstance.libinstanceid = libobject.libinstanceid
> and libinstance.architecture = ?

How are you generating the explain? My bet is that you're just
substituting a literal in the architecture condition, but if the driver
is smart then maybe it's preparating the query beforehand. You'll get a
different plan in that case. Try something like this:

prepare foo(smallint) as ...
where libinstance.architecture = $1
...

explain analyze execute foo(1);

If the plan you get from that is bad (and it often is), you should look
at avoiding a query prepare.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message dan 2009-03-30 20:49:55 Re: Trying to track down weird query stalls
Previous Message dan 2009-03-30 20:33:14 Re: Trying to track down weird query stalls