From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | Marcos José Setim <mjs_ops(at)gmx(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Performance Low Using the Prepare and Execute |
Date: | 2006-01-08 04:04:30 |
Message-ID: | 1136693070.9135.19.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, 2006-01-07 at 20:38 +0000, Marcos José Setim wrote:
> I want to use the Prepare and Execute resources of PostgreSQL to
> increment the performance of my SQL's.
> $sSQL = 'INSERT INTO teste (nome) VALUES( ? )';
>
> $oDB->Prepare( $sSQL );
The PREPARE documentation states:[1]
Prepared statements have the largest performance advantage when
a single session is being used to execute a large number of
similar statements. The performance difference will be
particularly significant if the statements are complex to plan
or rewrite, for example, if the query involves a join of many
tables or requires the application of several rules. If the
statement is relatively simple to plan and rewrite but
relatively expensive to execute, the performance advantage of
prepared statements will be less noticeable.
Since an INSERT ... VALUES without a subselect or any applicable rules
requires very little parsing, planning, or rewriting time,
PREPARE/EXECUTE is unlikely to improve performance.
-Neil
[1] http://developer.postgresql.org/docs/postgres/sql-prepare.html
From | Date | Subject | |
---|---|---|---|
Next Message | Postgres User | 2006-01-08 04:19:16 | Installing Postgres 8.1 on Windows Server 2003 R2 |
Previous Message | Neil Conway | 2006-01-08 04:00:52 | Re: Create one prepared function |