Re: Trying to track down weird query stalls

From: Scott Carey <scott(at)richrelevance(dot)com>
To: "dan(at)sidhe(dot)org" <dan(at)sidhe(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Trying to track down weird query stalls
Date: 2009-03-30 21:44:50
Message-ID: C5F68B62.3EC2%scott@richrelevance.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


On 3/30/09 2:34 PM, "dan(at)sidhe(dot)org" <dan(at)sidhe(dot)org> wrote:

>> dan(at)sidhe(dot)org escribió:
>>
>>>> So what's the "?" in the query you pasted earlier?
>>>
>>> The first ? (for architecture) is 1, the second ? (for branchid) is 0.
>>> They both should get passed to Postgres as $1 and $2, respectively,
>>> assuming DBD::Pg does its substitution right. (They're both supposed to
>>> go
>>> in as placeholders)
>>
>> Right, so how about you reread what I wrote above?
>>
>> Oh, hmm, so to be more clear: I don't think DBD::Pg is actually sending
>> EXECUTE PREPARE. You need to do this over psql.
>
> Fair enough. (And sorry about the mis-read) Next time this occurs I'll try
> and duplicate this in psql. FWIW, a quick read of the C underlying the
> DBD::Pg module shows it using PQexecPrepared, so I'm pretty sure it is
> using prepared statements with placeholders, but double-checking seems
> prudent.
>
> -Dan
>

Regardless, its always a good idea to do a manual explain analyze with and
without parameterization in psql if prepared statements are involved. The
query planner functions very differently with and without them, almost
always with a performance detriment to query execution times when
parameterized.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Matthew Wakeling 2009-03-31 11:54:44 Re: Very specialised query
Previous Message Alvaro Herrera 2009-03-30 21:38:39 Re: Trying to track down weird query stalls