Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id BB8086339C4 for ; Mon, 30 Mar 2009 18:55:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 58073-02 for ; Mon, 30 Mar 2009 18:54:54 -0300 (ADT) X-Greylist: delayed 00:10:03.82863 by SQLgrey-1.7.6 Received: from EXHUB018-2.exch018.msoutlookonline.net (exhub018-2.exch018.msoutlookonline.net [64.78.17.17]) by mail.postgresql.org (Postfix) with ESMTP id 775BA63322A for ; Mon, 30 Mar 2009 18:54:59 -0300 (ADT) Received: from EXVMBX018-1.exch018.msoutlookonline.net ([64.78.17.47]) by EXHUB018-2.exch018.msoutlookonline.net ([64.78.17.17]) with mapi; Mon, 30 Mar 2009 14:44:53 -0700 From: Scott Carey To: "dan@sidhe.org" , Alvaro Herrera CC: Robert Haas , Scott Marlowe , "pgsql-performance@postgresql.org" Date: Mon, 30 Mar 2009 14:44:50 -0700 Subject: Re: Trying to track down weird query stalls Thread-Topic: [PERFORM] Trying to track down weird query stalls Thread-Index: Acmxf1Wqo3VbzBVkR7SKn+RcDD+G1gAAWrSx Message-ID: In-Reply-To: <50477.199.172.169.35.1238448857.squirrel@localhost> Accept-Language: en-US Content-Language: en X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL=0.000 X-Spam-Level: X-Archive-Number: 200903/435 X-Sequence-Number: 33357 On 3/30/09 2:34 PM, "dan@sidhe.org" wrote: >> dan@sidhe.org escribi=F3: >>=20 >>>> So what's the "?" in the query you pasted earlier? >>>=20 >>> 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) >>=20 >> Right, so how about you reread what I wrote above? >>=20 >> 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. >=20 > Fair enough. (And sorry about the mis-read) Next time this occurs I'll tr= y > 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. >=20 > -Dan >=20 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.