From: | "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com> |
---|---|
To: | theo(at)flame(dot)co(dot)za |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Performance problems with prepared statements |
Date: | 2007-10-10 19:55:07 |
Message-ID: | 36e682920710101255n5760a009v8fdbf42e4599f16f@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On 10/10/07, Theo Kramer <theo(at)flame(dot)co(dot)za> wrote:
> When running the query directly from psql it returns the required rows
> in less than 100 milli-seconds.
>
> However, when using a prepared statement from my C application on the
> above query and executing it the query duration is as follows
> ...
> Row[s] = 25, Duration = 435409.474 ms
>
How are you timing it? Does it really take 435 seconds to complete?
Try the following in psql:
postgres# PREPARE yourplan (VARCHAR, INT, INT) AS
SELECT oid, * FROM calllog
WHERE calllog_mainteng = $1
AND calllog_phase = $2
AND calllog_self < $3
OR calllog_mainteng = $1
AND calllog_phase < 8
ORDER BY calllog_mainteng DESC,
calllog_phase DESC,
calllog_self DESC limit 25;
postgres# EXECUTE yourplan('124 ', 8, 366942);
--
Jonah H. Harris, Sr. Software Architect | phone: 732.331.1324
EnterpriseDB Corporation | fax: 732.331.1301
499 Thornall Street, 2nd Floor | jonah(dot)harris(at)enterprisedb(dot)com
Edison, NJ 08837 | http://www.enterprisedb.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Theo Kramer | 2007-10-10 20:08:30 | Re: Performance problems with prepared statements |
Previous Message | Simon Riggs | 2007-10-10 19:52:25 | Re: hashjoin chosen over 1000x faster plan |