Deleting old indexes on updates

Hi, when inserting a new object, adding a matching index is straightforward. However, what about updating an existing object? Is the idea to:

  1. Start transaction
  2. Fetch existing object & compare with new one
  3. Delete some indexes that may have changed
  4. Create new indexes
  5. Commit?


Yes, what you’ve described is correct. With indexes, an update works like a delete of the old object followed by an insert of the new object, which requires reading the old object. You can save some work and bandwidth if you only modify the indexes that were affected by the update, as the naive approach would delete data from an unaffected index and then re-insert the same data.