Trimming the tree

Quote from GlenB on 2020-02-18, 1:43 amI have discovered an error deep in my tree. I got the parents wrong for a person. But from that error, I have gone back several more generations AND - as is my habit - with each generation I have enumerated the siblings and their spouses and descendants.
So what I need to do is, from a certain point, delete everyone who is an ancestor of them AND also delete all descendants of such people UNLESS such descendant reconnects back into the part of the tree I'm trying to keep.
I'm not expecting this to be a simple SQL query!!! And if it takes many steps in RM and SQL combined then so be it. I guess I'm mostly looking for a well informed opinion of the various steps that I need to do, in the right order.
I have discovered an error deep in my tree. I got the parents wrong for a person. But from that error, I have gone back several more generations AND - as is my habit - with each generation I have enumerated the siblings and their spouses and descendants.
So what I need to do is, from a certain point, delete everyone who is an ancestor of them AND also delete all descendants of such people UNLESS such descendant reconnects back into the part of the tree I'm trying to keep.
I'm not expecting this to be a simple SQL query!!! And if it takes many steps in RM and SQL combined then so be it. I guess I'm mostly looking for a well informed opinion of the various steps that I need to do, in the right order.

Quote from GlenB on 2020-02-19, 2:28 amDo you think this might work?
1 - Set Color = Red for everyone who is an Ancestor of the root person and their Descendants
2 - Unlink the problem person from their parents. I don't have the new correct parents in the database yet, that comes later.
3 - Set Color = Green using exact same parameters as #1.
4 - use SQL script to delete everyone who is still Red. They should be the ancestors and descendants that I need to chop off but if they somehow reconnected with the part of the tree I want to keep them that part will have been set Green.
5 - standard database cleanup afterwards to get rid of unused entries in lists, rebuild indices and compress.
What am I missing?
Do you think this might work?
1 - Set Color = Red for everyone who is an Ancestor of the root person and their Descendants
2 - Unlink the problem person from their parents. I don't have the new correct parents in the database yet, that comes later.
3 - Set Color = Green using exact same parameters as #1.
4 - use SQL script to delete everyone who is still Red. They should be the ancestors and descendants that I need to chop off but if they somehow reconnected with the part of the tree I want to keep them that part will have been set Green.
5 - standard database cleanup afterwards to get rid of unused entries in lists, rebuild indices and compress.
What am I missing?

Quote from GlenB on 2020-02-22, 2:41 amBasically, did the steps above and it seems to be OK:
Start - database has 18553 people in it, all in one tree
1a - Clear all colors
1b - Set Color=RED for defined group of people closely connected but not related
1c - Set Color=RED for people from a list and mark everyone in base person's tree2 - unlink individual from her parents incorrect parents
3a - Set Color=GREEN for defined group of people closely connected but not related
3b - Set Color=GREEN for people from a list and mark all Ancestors and their descendants from the base person4a - Count of GREEN = 16502, count of RED = 2051, total = DB size = 18553
4b - SQL delete for Color=RED
4c - SQL DeletePhanton3
4d - SQL DeletePhantomLinkstoFSFT
4e - Use RM tools to clean and reindex databaseDatabase has 16502 people in it, but 27 trees (most of which have only a single left over person)
Delete the 26 one-person trees (isolated leftover spouses)
Repeat 4e
End - database has 16475 people in it
Basically, did the steps above and it seems to be OK:
Start - database has 18553 people in it, all in one tree
1a - Clear all colors
1b - Set Color=RED for defined group of people closely connected but not related
1c - Set Color=RED for people from a list and mark everyone in base person's tree
2 - unlink individual from her parents incorrect parents
3a - Set Color=GREEN for defined group of people closely connected but not related
3b - Set Color=GREEN for people from a list and mark all Ancestors and their descendants from the base person
4a - Count of GREEN = 16502, count of RED = 2051, total = DB size = 18553
4b - SQL delete for Color=RED
4c - SQL DeletePhanton3
4d - SQL DeletePhantomLinkstoFSFT
4e - Use RM tools to clean and reindex database
Database has 16502 people in it, but 27 trees (most of which have only a single left over person)
Delete the 26 one-person trees (isolated leftover spouses)
Repeat 4e
End - database has 16475 people in it

Quote from Tom Holden on 2020-02-22, 7:04 amWell done, GlenB! You've answered your own questions and it appears you got the result you wanted. Your section 4 steps look to be following the procedure I described on Delete Many #delete. I am puzzled, tho', by your reference to SQL DeletePhantomLinkstoFSFT: is that your own script? Is it something missing from the script DeletePhantoms3.sql?
Tom
Well done, GlenB! You've answered your own questions and it appears you got the result you wanted. Your section 4 steps look to be following the procedure I described on Delete Many #delete. I am puzzled, tho', by your reference to SQL DeletePhantomLinkstoFSFT: is that your own script? Is it something missing from the script DeletePhantoms3.sql?
Tom