Thread: prepared statement support?

prepared statement support?

From
Christopher Lee
Date:
Hello,

I'm new to postgresql and RDBMS in general and was wondering if it supported
"prepared statements" or some equivalent.

BACKGROUND:

I understand that if you are going to do a large number of repetitions of a
query, some databaes offer pre-parsed "prepared statements" objects for
greater speed.  I haven't seen any mention of these though in the manuals
though.  I have postgresql 7.0.2 installed and working, and I've read
through a good deal of the documentation.

Thanks in advance,

-chris


p.s. Many thanks to the postgresql team- the support of "REFERENCES"
column constraints is especially nifty.

Re: prepared statement support?

From
Tom Lane
Date:
Christopher Lee <clee@gnwy100.wuh.wustl.edu> writes:
> I'm new to postgresql and RDBMS in general and was wondering if it supported
> "prepared statements" or some equivalent.

Not directly, but PLPGSQL-language functions cache plans for their
contained queries, so you can get the effect if you can push your
computation into function calls, triggers, etc.

Also, the backend's SPI interface for C-coded functions supports cached
plans, but that's got a bit of a steep learning curve ...

            regards, tom lane