I have run some more benchmarks, first I changed the WHERE clause to use a text column and tried it using bind and using non-quoted inline, such as tye suggested was a syntax error.
This actually resulted in using bind being faster.
Results
Code> ./test.pl Benchmark: timing 50000 iterations of bind, inline... bind: 55 wallclock secs (19.04 usr + 8.97 sys = 28.01 CPU) inline: 81 wallclock secs (20.21 usr + 11.32 sys = 31.53 CPU)
So, I modified it to check how many rows were being returned, the bind version was returning 1, the inline version was returning all rows.sub xbind { my $sql = 'SELECT edited FROM faq WHERE q = ?'; my $sth = $h->prepare( $sql ); $sth->execute( 'q' ); my $res = $sth->fetchall_arrayref; $xbind = @{$res}; } sub xinline { my $sql = 'SELECT edited FROM faq WHERE q = q'; my $sth = $h->prepare( $sql ); $sth->execute; my $res = $sth->fetchall_arrayref; $xinline = @{$res}; }
My mysql version is 3.23.49, DBI version 1.30 - completely different generation of db than you, so tests are not equal.
So if you got the same results with these tests, then you should try adding back in layers such as mod_perl, to see which is to cause.
In reply to Re: Re: Re: mod_perl was hosed by a bind variable
by fireartist
in thread mod_perl was hosed by a bind variable
by phildog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |