From: | MaXX <bs139412(at)skynet(dot)be> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Perl::DBI and interval syntax [side question] |
Date: | 2005-11-08 12:53:58 |
Message-ID: | dkq75j$ctj$1@talisker.lacave.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Martijn van Oosterhout wrote:
> On Mon, Nov 07, 2005 at 05:58:04PM -0500, Tom Lane wrote:
>> Allen <dba(at)girders(dot)org> writes:
>> > SELECT count(*) from post where post_ts >= current_date - interval ?
>> This is not right, and never has been right, even though it may have
>> accidentally failed to fail with some client libraries. Try
>> CAST(? as interval) (SQL standard)
>> ?::interval (Postgres-ism)
[...]
> This seems to be an example of breakage caused by DBI switching from
> "substitute params in client" to "use new protocol to substitute params
> in server" (prepare/execute).
[...]
Can this be the cause of a huge loss of perf? I have the following query in
a Perl script using DBI + DBD::Pg, AutoCommit => 0:
SELECT stats_put_sources(?, ?, int4(?), int4(?))
This syntax runs almost 10x faster than:
SELECT stats_put_sources(?, ?, ?::int4, ?::int4)
I can find where is the real difference, maybe this protocol stuff. In the
facts the speed difference was so great that there were no need to use
EXPLAIN to know what was the best option.
N.B.: The stats_put_source(varchar,varchar,int4,int4) function is a rewrite
of the INSERT OR UPDATE function described in the docs.
Thanks,
--
MaXX
From | Date | Subject | |
---|---|---|---|
Next Message | Evandro's mailing lists (Please, don't send personal messages to this address) | 2005-11-08 13:14:03 | Re: Beyond the 1600 columns limit on windows |
Previous Message | Tino Wildenhain | 2005-11-08 12:50:54 | Re: Beyond the 1600 columns limit on windows |