I created an SQLite database of baseball stats (based on 
data pulled from http://baseball1.info/) to show off SQLite
at a presentation yesterday.  There's enough data (over
340,000 total rows in 21 tables) to make for some pretty 
slow queries.  Download the SQL statements and set up 
the database with

wget http://danial.org/sqlite/lampsig/baseball.sql.bz2
bunzip2 -dc baseball.sql.bz2 | sqlite baseball.db
sqlite baseball.db 'create index i1 on master(playerid);'
sqlite baseball.db 'create index i2 on fielding(playerid);'
sqlite baseball.db 'create index i3 on batting(playerid);'
sqlite baseball.db 'create index i4 on fielding(lgid);'

then try queries such as

sqlite baseball.db 'select playerid,sb from batting where sb = (select
max(sb) from batting where playerid in (select playerid from fielding
where pos = "3B" and lgid = "NL"));'

which tries to answer the question "which National League third
baseman had the most stolen bases in a season?"  Then again, 
the query could be slow because I didn't formulate it correctly.     -- Al


On 5/22/05, Ludvig Strigeus <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> Can someone come up with some slow SQL statements (that execute in
> like 2 seconds) that are not disk bound but CPU bound. Preferably
> single liners.
> 
> I'm playing around with a profiler and trying to find bottlenecks in
> sqlite and optimizing them.
> 
> /Ludvig
>

Reply via email to