[odb-users] Recommendations for Mass-Deleting from SQLite Database table

Sum, Eric B eric.b.sum at lmco.com
Wed Aug 17 14:02:22 EDT 2011


I am trying to delete a group of objects(previously persisted in odb) from a table in a SQLite database that match a certain condition.

I can think of two ways to do this:


1.       Use the query API from ODB to get all objects that match that condition and store them in an ODB result.  Then, call the ODB erase function to delete the persistent object from the database.

2.       Call the execute function in ODB, and execute a native SQL statement such as "DELETE FROM <Tablename> WHERE <condition expression>" such that the condition expression matches the same query in the first option .

There will be MANY entries in the table, and there are going to be MANY objects to delete based on the condition, so I am going to be performing a massive delete in the database.

Which of these options would you recommend for speed/efficiency/performance since I am going to be performing such a massive delete?  Any other suggestions for performing such an operation?

Thanks,
Eric


More information about the odb-users mailing list