| From: | "Stuart Cooper" <stuart(dot)cooper(at)gmail(dot)com> |
|---|---|
| To: | "Tom Allison" <tom(at)tacocat(dot)net> |
| Cc: | "General PostgreSQL List" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: prepare() |
| Date: | 2007-05-30 00:53:58 |
| Message-ID: | 7fc8628a0705291753u34662484wea1da6408b6f3c05@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
> Is there an advantage to using something like $dbh->prepare($sql) if
> the SQL is going to be run once within the scope of the code? The
> code block may be run many times in a minute as in a function call ---
> while (<>) {
> insert_something($_);
> }
> Will the prepare statement be cached @ the database even if it's
> destroyed in the code/application?
The pg_prepared_statments view will give you information on prepared statments
currently resident in the database backend. I suggest you run your progam
(with a couple of "Enter to continue" breakpoints in the code) and, in another
session, select from pg_prepared_statements and see if the prepared statement
is still there.
I'll be trying this myself a bit later once I stabilise my system, so
watch this space!
Cheers,
Stuart.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Stuart Cooper | 2007-05-30 01:17:36 | Re: prepare() |
| Previous Message | novnov | 2007-05-30 00:18:42 | function retuning refcursor, order by ignored? |