I run a service that creates many SQLITE3 databases and later on removes them again, they live for about a day maybe. They all have the same schema and start empty.
I use this to create a new blank SQLITE3 database:
sqlite3 newDatabase.db < myschema.sql
The myschema.sql file contains three table schemas or so, nothing fancy, no data. When I execute the above command on my rather fast, dedicated linux server, it takes up to 5 minutes to complete. There’s processes running in the background, like a couple of PHP scripts using CPU time, but everything else is fast, like other commands or inserting data into the DB later on. It’s just the creation that takes forever.
This is so weird, I have absolutely no idea what’s wrong here. So my only resort right now is to create a blank.db once, and just make a fresh copy from that rather than importing from a SQL schema.
Any idea what I messed up? I initially thought the noatime settings on linux were messing with it, but no, disabling didn’t change anything.
Willing to provide any configuration/data you need.
Edit:
This is what strace hangs at:
12:29:45.460852 fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=1073741824, len=1}) = 0
12:29:45.460965 fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=1073741826, len=510}) = 0
12:29:45.461079 lseek(4, 512, SEEK_SET) = 512
12:29:45.461550 read(4, "", 8) = 0
12:29:45.462639 fdatasync(4
A possibility is to use the
stracecommand to see what’s happens :If it hangs somewhere, you will see.
Is your schema is HUGE ?
NOTE
I/Odisk, try the commandiotop -oPa, you will see “who’s” put the mess in your system