Re: to prepare_cached or not?

Joshua N Pritikin <[email protected]>
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
On Sat, Jun 16, 2007 at 02:09:44AM -0400, Rudy Lippan wrote:
> On Thu, 14 Jun 2007, Greg Sabino Mullane wrote:
> >No significant memory or computation cost. It's a fairly cheap 
> >optimization.
> >
> >It's probably fine to use it all you want.
> 
> That depends, I can think of some instances were you would not want to use 
> it:
> 
> for (1..100_000_000) {
>     eval {
>         my $sth = $dbh->prepare_cached(q{
>             INSERT INTO mytable (number) VALUES ($_);
>         });
>         $sth->excute();
>     }; if (my $e = $@) {
>         die "Hmm there was an error... Did you forget to create mytable? 
>         $e";
>     }
> }

That's pretty obvious. At least _I_ wouldn't expect it to be a win in 
such circumstances. I currently have only 51 queries in my application. 

-- 
Make April 15 just another day, visit http://fairtax.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.