List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 7 1999 11:48pm
Subject:Re: DBI::quote problem
View as plain text  
At 6:35 PM -0500 9/7/99, Joshua Chamas wrote:
>> I didn't think you could prepare *any* queries with mysql.  I thought
>> that DBI::prepare was basically a no-op when using the Mysql driver
>> (well, not quite - it stores the string locally, and does the ?
>> substitution, but that's a local perl-side issue) - and I'd be surprised
>> if it affected query speed much at all.  (Unless, of course your
>> overhead is perl, but that'd be surprising)
>>
>> Jules
>>
>
>I don't know what's going on in the background, but between DBD::mysql
>& mysqld, there is a 35% speedup when preparing & caching cursors
>for simple insert statements.  Supposedly there are no
>"server-side cursors" so I'm guessing its a client side thing.


What happens if you run your sets of statements in a different order?
You may simply be seeing an effect of OS-level disk cacheing.

>
>Here's a little benchmark that you can run:
>
>use Benchmark;
>
># you supply the $dbi connection
># create a database called spiders with a spider_id auto
># incrementing column
>
>timethis(2000, sub {
>	     my $isth = $dbi->prepare("insert into spiders (spider_id)
>values (NULL)");
>	     my $nsth = $dbi->prepare("select last_insert_id()");
>	     $isth->execute();
>	     $nsth->execute();
>	     $nsth->fetchrow_array;
>	     $nsth->finish;
>	 });
>timethis(2000, sub {
>	     my $isth = $dbi->prepare_cached("insert into spiders
>(spider_id) values (NULL)");
>	     my $nsth = $dbi->prepare_cached("select last_insert_id()");
>	     $isth->execute();
>	     $nsth->execute();
>	     $nsth->fetchrow_array;
>	     $nsth->finish;
>	 });
>
>prompt> bench_insert.pl
>timethis 2000: 10 secs (10.32 usr  0.00 sys = 10.32 cpu)
>timethis 2000:  7 secs ( 6.63 usr  0.00 sys =  6.63 cpu)
>
>-- Joshua
>______________________________________________________________________
>Joshua Chamas                      Chamas Enterprises Inc.
>NODEWORKS - web link monitoring    Long Beach, CA  USA  1-562-432-2469
>http://www.nodeworks.com           http://www.chamas.com
>
>---------------------------------------------------------------------
>Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
>posting. To request this thread, e-mail mysql-thread12483@stripped
>
>To unsubscribe, send a message to the address shown in the
>List-Unsubscribe header of this message. If you cannot see it,
>e-mail mysql-unsubscribe@stripped instead.


--
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/
Thread
DBI::quote problemEugene Miretskiy8 Sep
  • Re: DBI::quote problemJoshua Chamas8 Sep
  • Re: DBI::quote problemEugene Miretskiy8 Sep
  • Re: DBI::quote problemJoshua Chamas8 Sep
  • Re: DBI::quote problemEugene Miretskiy8 Sep
  • Re: DBI::quote problemJoshua Chamas8 Sep
  • Re: DBI::quote problemJules Bean8 Sep
  • Re: DBI::quote problemJoshua Chamas8 Sep
    • Re: DBI::quote problemPaul DuBois8 Sep
  • Re: DBI::quote problemJoshua Chamas8 Sep
  • Re: DBI::quote problemJoshua Chamas8 Sep
  • Re: DBI::quote problemJules Bean8 Sep
    • Re: DBI::quote problemMichael Widenius8 Sep
  • Re: mySQL... sitting at the FreeBSD2 command prompt unsure of what to do...Jules Bean8 Sep
Re: DBI::quote problemJoshua Chamas8 Sep