On Mon, Apr 04, 2005 at 12:47:56AM -0400, Steven Lembark wrote: > > > -- Mark Stosberg <[EMAIL PROTECTED]> > > >Hello, > > > >I have a database application that selects about 50,000 rows one by one, > >does some process in Perl, and then executes a SELECT statement for each > >one, with slight variations in the SQL and parameters. > > > >I was using prepare_cached() on this repeatedly called SELECT statement. > > Depends on how you're using the caching. > > If it looks something like: > > my $sth = > prepare_cached( 'select foo from bar where ( bletch = ?)' ); > > Then this should generate a single "query" and re-cycle it for > later use. If you are using ANYthing hardcoded specific to the > query then caching will just leave a huge number of row-specific > queries lying around; which is probably not what you want. > > Q: Are the placeholders in the existing query(s) or do they use > hard-coded values?
Thanks for the response. From reviewing the code, there area small number of hard-coded values, but they never change from query to query. Example: " active = 't'" . I think there could be a dozen or two bind variables, though. There are some "IN" clauses which might have a dozen bind variables each. The good news for me has been that switching back to use prepare() has adequate performance. In fact, for the same run with 50,000 rows to process, the overall time is about the same. Mark -- . . . . . . . . . . . . . . . . . . . . . . . . . . . Mark Stosberg Principal Developer [EMAIL PROTECTED] Summersault, LLC 765-939-9301 ext 202 database driven websites . . . . . http://www.summersault.com/ . . . . . . . .
