So Slow delecting records.

Viewing 3 reply threads
  • Author
    Posts
  • September 30, 2011 at 1:55 AM #3491

    Simba
    Participant

    I have a 2500 record database and update it twice a week, first I delete the old records them import the new. Deleting the old records takes about almost 4-5 min, anyway we can speed this up? (I know its trivial, but why does it take to long)

    S

    September 30, 2011 at 1:57 AM #4868

    Brendan
    Keymaster

    Hello Simba,

    If you delete and add a lot of records, the database can slow down. To optimize the database, go to the Database Maintenance screen and tap “Vacuum Database”. That should speed it up again.

    Thanks,

    Brendan

    October 1, 2011 at 3:39 AM #4872

    isidore
    Participant

    don’t know if this will help, but i have a simlar situation with a similar number of records…i have a backup of the database taken with 0 records…when i want to reimport all the new records, i restore to that backup which effectively dumps all the records…then i import…so basically i skip the delete step by restoring from a backup

    October 1, 2011 at 3:45 AM #4873

    Brendan
    Keymaster

    When you vacuum the database, it creates a new copy of the database into a new file, deletes the old file, then uses the new file. So in this way, it’s like starting from scratch. Except any data you have in there is still available. The issue is that when a row is deleted, it’s not physically deleted. It’s marked as being deleted. This is an SQLite3 thing and not something I’m doing in my own code. This can cause the database file to grow and grow. When you vacuum the database, all those old deleted rows are physically discarded. When a row in a table is marked for deletion, it can be reused by the database, but typically the database just grows and grows. So it’s a good idea to run Vacuum from time to time.

    Thanks!

    Brendan

Viewing 3 reply threads

You must be logged in to reply to this topic.