On 13 Feb 2017, at 7:12pm, Jeff B. <su...@cox.net> wrote: > The vacuum followed by a reindex seems to have fixed the db (see below). But > are there any other theories as to how we got to this point? Could I have > possibly caused this or do I just need to build in code to detect problems > like this and rebuild on the fly? I'm new to SQLite so I don't have a good > feel for what is overkill vs what is best practices.
The database was definitely corrupt. It’s quite difficult to do that. It might happen through using some of the PRAGMAs which tell SQLite not to bother doing locking/synching correctly. It might happen through a power-cut at just the wrong moment. It might happen because your hard disk is faulty and that was the first known sign of it failing. It might happen through broken software overwriting part of the database. And, for any of those it might happen just once in the lifetime of your program. But the stark fact is that many users never see this happen ever. Proper defensive action, as you suggested, is to build the integrity_check thing into some monthly/yearly maintenance routine. Or to do it weekly for a while, then monthly, then yearly, until you have confidence in your hardware. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users