Re: DBD-DBM too slow
- From: jeff@xxxxxxxxxxxxxx (Jeff Zucker)
- Date: Wed, 23 Aug 2006 12:21:02 -0700
ManKyu Han wrote:
Hi. I installed DBD::DBM through cpan and everything seems fine.Your tests are flawed see below. OTOH, DBD::DBM is unlikely to be able to compete with MySQL or even SQLite for speed.
I wanted to benchmark DBD::DBM's performance, so I did simple test.
I populate table that I created with 200000 integer and strings.
In mysql, it was going almost 7000 inserts / sec
but in DBD::DBM, the best I could get was 130/sec
Is there some optimization that I should do?If your SQL needs are light, use DBI::SQL::Nano instead of SQL::Statement. And, especially note the next point:
foreach my $sql (@sql_i){In DBD::DBM, prepare() takes a fair amount of time. If you prepare once outside the loop then execute many times in the loop using placeholders you will gain *lots* of time. This is true of most DBDs but especially true of DBD::DBM and other SQL::Statement based DBDs.
my $sth = $dbh->prepare($sql);
$sth->execute;
$count++;
if($count%2000 eq 0){
mkUtil::printTime("$count");
}
}
Also, you might consider using DBI's new profiling capabilities or even Benchmark when doing tests.
--
Jeff
.
- References:
- DBD-DBM too slow
- From: ManKyu Han
- DBD-DBM too slow
- Prev by Date: DBD-DBM too slow
- Next by Date: Re: Rows returned are out of sync with the request.
- Previous by thread: DBD-DBM too slow
- Next by thread: Re: DBD-DBM too slow
- Index(es):
Relevant Pages
|
|