17 messages in com.mysql.lists.mysqlRe: DBI::quote problem| From | Sent On | Attachments |
|---|---|---|
| d e l d h a n o a | 06 Sep 1999 21:15 | |
| Eugene Miretskiy | 07 Sep 1999 13:29 | |
| Joshua Chamas | 07 Sep 1999 13:42 | |
| Eugene Miretskiy | 07 Sep 1999 14:00 | |
| Joshua Chamas | 07 Sep 1999 14:12 | |
| Eugene Miretskiy | 07 Sep 1999 14:24 | |
| Joshua Chamas | 07 Sep 1999 14:29 | |
| Jules Bean | 07 Sep 1999 16:20 | |
| Joshua Chamas | 07 Sep 1999 16:34 | |
| Joshua Chamas | 07 Sep 1999 16:43 | |
| Paul DuBois | 07 Sep 1999 16:48 | |
| Joshua Chamas | 07 Sep 1999 16:57 | |
| Joshua Chamas | 07 Sep 1999 17:34 | |
| Jules Bean | 08 Sep 1999 01:00 | |
| Jules Bean | 08 Sep 1999 01:01 | |
| Michael Widenius | 08 Sep 1999 05:42 | |
| Joshua Chamas | 09 Sep 1999 04:20 |
| Subject: | Re: DBI::quote problem![]() |
|---|---|
| From: | Paul DuBois (pa...@snake.net) |
| Date: | 09/07/1999 04:48:24 PM |
| List: | com.mysql.lists.mysql |
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 mysq...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail mysq...@lists.mysql.com instead.
-- Paul DuBois, pa...@snake.net Northern League Chronicles: http://www.snake.net/nl/




