Skip site navigation (1) Skip section navigation (2)

Re: prepare()

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: (view raw, whole thread or download thread mbox)
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!


In response to

  • prepare() at 2007-05-29 23:28:14 from Tom Allison


pgsql-general by date

Next:From: Stuart CooperDate: 2007-05-30 01:17:36
Subject: Re: prepare()
Previous:From: novnovDate: 2007-05-30 00:18:42
Subject: function retuning refcursor, order by ignored?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group