Database Maintenance

I am using GRAMPS: 5.1.3
Python: 3.8.5 (default, Jul 28 2020, 12:59:40) […
BSDDB: 6.2.7 (5, 3, 28)
sqlite: 3.31.1 (2.6.0)
OS: Linux
Distribution: 5.4.0-58-generic

And have been reviewing the entries in one of my databases and have deleted a number of non related individuals.

I suspect this would have orphaned places and events so I was wondering how best to clean the database but could not find anything obvious in the Tools menu.

So would someone be able to point me to the correct tool or the best procedure for using several tools.

Thank you.

It’s under Tools -> Family Tree Repair -> Remove Unused Objects, and the help is here.

Be aware that it doesn’t look for links you may created within notes. In other words, if the only reference to an object is a link in a note, the object will appear as unused according to the tool. If you don’t create links to objects within notes, then it’s no worry.

If you want review unused objects manually, you can decide to re-use or discard by evaluating the object’s merit too.

Create a custom filter in each category looking for objects with counts less than 1 reference. (Reference count rules for Families, Events )

(It is worth doing a test to discover if this filter considers Note Links. I doubt it will … Note Links reference objects by their internal database handle rather than their Gramps IDs. People with loosely connected with Associations instead of directly related with References might also pose an issue.)

Thanks George, I was looking for something like “Reorder DB”

And you may need to run the tool a few times.

A citation attached to an event will not show as unused or an orphan until the event is deleted. And the note attached to the citation…

I never delete a Place or Source (I do delete Citations) that may become orphaned. Too much work may have gone in to creating the record and remains to be added to a record in the future.

I do this maintenance fairly often so when an object shows up to be deleted, I have a chance to remember why the object can be deleted.

Once you have deleted unused objects then you can run the Reorder Gramps IDs tool.

This can reorder the IDs reusing IDs from deleted and merged records.

Select the parts of the database to do this on, and select Change to reorder IDs. If you use a tool like GetGOV to download and merge place records, make sure to check Keep or the custom IDs will be overwritten. This is true for any custom IDs you may use.

If you have any filters built using IDs as a value, these rules will need to be adjusted.

And as always before doing a batch edit, MAKE SURE YOU HAVE A RECENT BACKUP!!! There is no undo to reverse this action.

Or a “pack & re-index”? I periodically create a new tree and import the Backup XML file. The database engine files are rebuilt that way… and it tests that my backups are actually restorable.

(How many IT people have rested easily, confident that they had automated daily backups. Then discovered, in the wake of a disaster, that the backup files had always been unusable due to misconfiguration.)

Note the internal handles remain consistent with XML imports. But you can change the ID format preferences to re-index the user-friendly auto numbered IDs. (Manually entered IDs persist too.)