Why is the SQLite driver over 18 times slower than sqlite3? How can I tune up the driver?
root@rschuler:~/chess/icc/chartbot# time perl testdb.pl
frank001 (463)
SidVicious (307)
Lisebeth (272)
Shawn (204)
albi (149)
real 0m6.341s
user 0m5.956s
sys 0m0.296s
root@rschuler:~/chess/icc/chartbot# time sqlite3 chartbot.db 'SELECT C
+OUNT(*) AS Anzahl, handle FROM channels where timestamp >= 1310478879
+ and channel = 1 GROUP BY handle ORDER BY Anzahl DESC LIMIT 5'
463|frank001
307|SidVicious
272|Lisebeth
204|Shawn
149|albi
real 0m0.349s
user 0m0.312s
sys 0m0.036s
testdb.pl:
use DBI;
my $db = DBI->connect("dbi:SQLite:dbname=/root/chess/icc/chartbot/char
+tbot.db", "", "");
$sth = $db->prepare ("SELECT COUNT(*) AS Anzahl, handle FROM channels
+where timestamp >= 1310478879 and channel = 1 GROUP BY handle ORDER B
+Y Anzahl DESC LIMIT 5");
$sth->execute ();
while (my @z = $sth->fetchrow_array ()) {
$handle = $z[1];
$count = $z[0];
print "$handle ($count)\n";
}
Thanks for looking!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.