I import example.gramps (more than 2000 persons) for testing a 'handle rebuild' during a simple import/export process. I suppose it is related to the family (id=F18) where the home person is the father.
I see that there is a limitation (performance ? slow down ?) on DB transaction: "no_magic" is used with less than 1000 persons else it is ignored.
I already saw some questions about DB environment and cache.
As const.py store some variables (not only Gramps' code, I think on locales test), why not to add variables for DB ?
ie. LRU cache, no_magic on DB transaction, etc ...
This will still be hidden for users (default values), but this might be useful for testing or some improvements.