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 COUNT(*) 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 #### use DBI; my $db = DBI->connect("dbi:SQLite:dbname=/root/chess/icc/chartbot/chartbot.db", "", ""); $sth = $db->prepare ("SELECT COUNT(*) AS Anzahl, handle FROM channels where timestamp >= 1310478879 and channel = 1 GROUP BY handle ORDER BY Anzahl DESC LIMIT 5"); $sth->execute (); while (my @z = $sth->fetchrow_array ()) { $handle = $z[1]; $count = $z[0]; print "$handle ($count)\n"; }