Memoizing non-place-holding sql statements to place-holding



Hello,

Is there a module already existing to memoize non-place-holding sql
statements to place-holding ones and suppress prepare to minimum?

I'm now transforming other peaple's scripts for a performance inprovement.
This system is so big, I cann't understand quickly, but I foud that all
SQL statements are made wothout place holders, and all INSERT statements
are processed by the next subrourine.

sub insert_sql {
my ($dbh, $sql) = @_;
my $sth = $dbh->prepare($sql) or die;
$sth->execute();
$sth->finish;
}

INSERT'ed tables are almost 10 tables and almost 20 kind of INSERT statements
are processed. For a small input data, about 4,000 INSERT are processed,
for big input data, about 40,000 INSERT are processed,

I think this idea can be used to memoize each INSERT statement as one with
place holders, prepare only once for each SQL and execute "execute" method
for each call.

This coding may not be so difficult, but not easy for me.

I don't think "Memoize.pm" can be used, :)

Any idea?

Regards,
Hirosi Taguti
h-taguchi@xxxxxxxxxxx

.



Relevant Pages

  • Re: Memoizing non-place-holding sql statements to place-holding
    ... > Is there a module already existing to memoize non-place-holding sql ... there are some modules out there that attempt to deconstruct SQL ... instead of the prepare/execute method. ... prepare only once for each SQL and execute "execute" method ...
    (perl.dbi.users)
  • Re: Opinions on approach, please...
    ... Create a data layer program per table, ... number of bind variable tokens in your dynamic SQL. ... then simply EXECUTE that without passing it any parameters? ... Hard code WHERE clauses. ...
    (comp.lang.cobol)
  • Re: SQL Injection- Bypassing magic_quotes
    ... Because i was trying to execute: ... Don't terminate the query and you most ... Or try something like bobcat or one of the other SQL injection tools out ... Chief Information Security Officer ...
    (Pen-Test)
  • Re: Opinions on approach, please...
    ... Create a data layer program per table, ... number of bind variable tokens in your dynamic SQL. ... then simply EXECUTE that without passing it any parameters? ... explicitly code dummy words as bind variable placekeepers, put the host variables on the ...
    (comp.lang.cobol)
  • Re: Poor performance when executing stored procedure
    ... > Generally I would write stored procedures to do only one job. ... If SQL Server ... > which is even worse those sps can execute each other. ... > then executed spOrders which is executed in spCustomers and then got stuck ...
    (microsoft.public.sqlserver.programming)