pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Carey <scott@richrelevance.com>
To: dan@sidhe.org <dan@sidhe.org>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Scott Marlowe <scott.marlowe@gmail.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Trying to track down weird query stalls
Date: Mon, 30 Mar 2009 14:44:50 -0700
Message-ID: <C5F68B62.3EC2%scott@richrelevance.com> (raw)
In-Reply-To: <50477.199.172.169.35.1238448857.squirrel@localhost>


On 3/30/09 2:34 PM, "dan@sidhe.org" <dan@sidhe.org> wrote:

>> dan@sidhe.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.





view thread (19+ messages)

Message-ID: <C5F68B62.3EC2%scott@richrelevance.com>
Permalink:  ../C5F68B62.3EC2%25scott@richrelevance.com/
Also on:    postgresql.org/message-id/C5F68B62.3EC2%scott@richrelevance.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: scott@richrelevance.com, dan@sidhe.org, alvherre@commandprompt.com, robertmhaas@gmail.com, scott.marlowe@gmail.com
  Subject: Re: Trying to track down weird query stalls
  In-Reply-To: <C5F68B62.3EC2%scott@richrelevance.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