On Thu, Dec 16, 2010 at 4:12 PM, Marc <cpm...@gmail.com> wrote: > Hello, > > We have an application that runs under windows that use sqlite to store > data. Our application do a pragma integrity_check every time It's launched. > > One of our users have our application with a database of 180 Mb and It > takes > about 6 minutes to complete a Pragma integrity_check the first time that > our > application is launched after reboot computer. Is it normal that takes so > much time to complete the Pragma integrity check ? The application during > the pragma integrity_check do an intensive use of hard disk. Then if the > user launches the application another times without rebooting computer It > only tooks 8 seconds to complete the prama integrity_check and It don't use > the hard disk. We supose that the other times the database it's cached, but > it's a lot of difference between 6 minutes the first time we launched the > application and 8 seconds takes to completer after the first launch of our > application. > > And another is it recommended to do a pragma integrity check every time > that > our applications is launched? >
PRAGMA integrity_check is only recommended after a hard crash - that is to say an operating system lock-up or a power loss. Your application crashing is not sufficient grounds for an integrity_check. If hard-disks worked as advertised, then no integrity_check would be required even following a power loss or OS crash. But consumer-grade hard-disks cut corner to save cost, fail to honor requests to flush content to oxide, and end up losing data following a power loss. There is nothing we can do about this in software. It is a hardware bug. More recent and larger hard disks are worse about this than older and slower ones. You can run PRAGMA quick_check as an alternative to PRAGMA integrity_check. It is a little faster, but does not do as thorough of a check of the database file. > > Thanks > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users