> All:
> I need to check a database for readability before my application
> starts.  I was originally going to keep an MD5 on the database and
> check it each time at powerup.  This seems to take a great deal of
> time so instead I thought abou having the database do an integrity
> check at powerup, however this too takes a great deal of time.  My
> last idea was to issue a set of simple select statements against the
> database and check if they are successful.  I realize this doesnt
> 'guarantee' my data is fine like an MD5 would, nor does it really
> validate the integrity of the database like an integrity check
> would.... but can I assume to some degree of comfort that if these
> select statements succeed then I can access these tables in the
> database error free?

Probably. But there is always the possibility that an index has
become corrupted. Linear scans of database tables won't touch the
indexes, so you won't know for sure.

Another option, which is clearly marked as an experimental feature
in the source code (interpret that as you will), is "PRAGMA  
quick_check".
This is similar to integrity_check, but not as rigorous or time
consuming.

Dan.




> I ran some test cases (I know you guys and gals like actual numbers
> and not theory), and came up with the following
> sqlite3 'pragma integrity_check'
> real    0m 11.20s
> user    0m 1.85s
> sys     0m 8.70s
>
> md5sum -c ...
> real    0m 10.07s
> user    0m 1.32s
> sys     0m 8.16s
>
> sqlite3 'SELECT STATEMENTS FROM IMPORTANT TABLES'
> real    0m 2.34s
> user    0m 0.19s
> sys     0m 1.74s
>
>
> Now for clarity.... The database contains AV metadata and data.  I
> have tables such as ImageData, ImageDescription, AudioData, and so on.
>  I also have tables that are not 'important' (suffice it to say, I
> wont access them during runtime under normal conditions).  I care
> about the AV data being accessible.... I am optimistically assuming
> that if the data is corrupt, the image will still display (with
> perhaps some bad pixels) and / or the audio has some unwanted clicks
> or pops.
>
>
> The big question.... Using a group of select statements to check the
> database for accessibility seem reasonable?  Or am I taking a large
> gamble doing so?
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to