I am asking how does Berkeley DB update its secondary index?
For example, in a BDB table with key value pair ``<k,v1>``, the index database would have reversed pair like ``<v1,k>``. Upon an insert (or essentially an update) ``<k,v2>``, base table record ``<k,v1>`` should be overwritten to ``<k,v2>``.
But how would BDB deal with ``<v1,k>`` in the index table? Will it delete it immediately?
As long as you correctly open the primary database and secondary index database, and associate the secondary index database with the primary, any update on the primary database will be reflected in the secondary index.
For more information, please refer to Reference Guide for Berkeley DB -> Chapter 3. Access Method Operations -> Secondary Indexes section.