Select to view content in your preferred language

Prune Branch History not deleting records.

380
11
4 weeks ago
Labels (3)
BGEGIS
by
Occasional Contributor

Hello everyone!

The tool in question: Prune Branch History (Data Management) 

Versions:
Pro - 3.5.3
Server - 11.5.0

Trying to use the Prune Branch History tool to remove test data from a dataset. This inspections table is related to a feature that is part of a Utility Network dataset. The inspection table and the Utility Network were published as a group and are housed in the same SDE. All test Inspections have been deleted from all versions. 

When running the tool there are no errors displayed, but the records are still contained in the archive table. In fact, the logs read as below when selecting the different options available.

REPORT ONLY LOG

[10/6/2025 2:39:17 PM] Prune moment: 10/6/2025 7:39:16.980 PM
[10/6/2025 2:39:17 PM] Reporting how many rows would be pruned from each table.
[10/6/2025 2:39:17 PM] Would prune 22 rows from MUD.ABClient_Inspections_Table
[10/6/2025 2:39:20 PM] Would prune 2 rows from MUD.ABClient_Inspections_Table__ATTACH

ONLY PRUNE SYSTEM TABLES LOG

[10/6/2025 2:42:52 PM] Prune moment: 10/6/2025 7:42:52.283 PM

BOTH

[10/6/2025 2:41:16 PM] Prune moment: 10/6/2025 7:41:15.733 PM
[10/6/2025 2:41:16 PM] Reporting how many rows would be pruned from each table.

 

There is a view that returns only the most recent Inspection Record for each point that is causing the issues for me. In this view I can still see all records including deleted records. I have tried filtering out the table by the GDB_IS_DELETE, but not all of the deleted records have GDB_IS_DELETE = 1 (some are 0). My current fix is janky at best and is just filtering out the deleted records from the view using GDB_ARCHIVE_OID > xy.

Here is a list of the archive table fields and their contents:
GDB_ARCHIVE_OID - OIDs (current work around is to filter lowest values out)
GDB_FROM_DATE - Date/Times (All have values)
GDB_IS_DELETE - Not all deleted records match, there is a mix of 0s and 1s
GDB_BRANCH_ID - all equal 0
GDB_DELETED_AT - some have the time/date some are null
GDB_DELETED_BY - some have the usernames some are null

Maybe it is a problem with how the table was triggered when the deleted occurred because all of the "GDB_IS_DELETE", "GDB_DELETED_AT", and the "GDB_DELETED_BY" should have values that are exactly the same.

Thanks so much for looking into this with me!!

Esri Community posting of a similar issue -

Solved: Prune Branch History Not Working - Esri Community 

How can I prune a Branch Versioned featureclass? - Esri Community

Best,
Scott F

Tags (3)
0 Kudos
11 Replies
RobertKrisher
Esri Regular Contributor

There is no OOTB view for viewing branch versioned data, and you shouldn't be using a dynamic view. Make sure you read this branch versioning article and a description of the SQL to view branch versioned data to make sure the 'view' is correct.  There's also this presentation about how the branch versioning and the SQL works.

In terms of pruning. If you have outstanding versions that haven't been reconciled, or contain conflicts, the prune tool cannot prune those edits because they will cause inconsistencies for those historical moments. Learn more about this in the Prune branch history—ArcGIS Pro | Documentation page and the Branch history—ArcGIS Pro | Documentation page.

BGEGIS
by
Occasional Contributor

Based on the documentation it looks like my only option is to Prune Branch History (or use my work around).

I realize my OP may be a struggle to read through so here is a cliff notes version of the OP:

The Prune tool runs and gives the logs provided in OP. The records identified by the Prune tool are not removed from the table. All versions had been reconciled/posted to sync with the default before running the tool.

Looks like my work around to filter out those deleted records is my only option because the Prune Branch History tool does not prune the records that it says it will prune in the logs it makes.  Any pointers on specifically why this tool would give these logs and then not Prune the records it identified?

 

0 Kudos
RobertKrisher
Esri Regular Contributor

Can you share the SQL you are using for the view?

0 Kudos
BGEGIS
by
Occasional Contributor

Sure! Its starts like this:
BGEGIS_0-1760126503818.png

then it adds the fields needed from the device and inspection tables and reformats the domains to text then ends with this:

BGEGIS_3-1760127075921.png

 

Thanks for your help, but my original post is about how the Prune Branch History tool is not working properly.

0 Kudos
RobertKrisher
Esri Regular Contributor

Your views don't appear to be filtering out rows from default, which could be causing some of the problems that you're seeing. The rows in non-default branches may have newer gdb_from_dates that the rows in the default version.

In terms of verifying that everything is really being pruned, it's hard to do that without looking at the contents of your system tables and comparing them to the table(s) in question. You may need to open a support case on this one.

0 Kudos
BGEGIS
by
Occasional Contributor

I will set up a support ticket next week sometime. 

Here is a screenshot of the table after the Prune. All 22 records are still there. 

BGEGIS_3-1760130685491.png

Thanks again Robert and have a great weekend!

0 Kudos
RobertKrisher
Esri Regular Contributor

Can you post the command you're using to prune? I notice in the initial post it looks like when you're pruning you had the option to only prune system tables checked. If you run the tool with the "Report Only" option and "Only Prune System Tables" options unchecked, it should prune all user and system tables.

0 Kudos
BGEGIS
by
Occasional Contributor

I was using the Pro tool-box "Prune Branch History". I tried all of the different configurations possible with the results displayed below:

ONLY - Report Only Log

[10/6/2025 2:39:17 PM] Prune moment: 10/6/2025 7:39:16.980 PM
[10/6/2025 2:39:17 PM] Reporting how many rows would be pruned from each table.
[10/6/2025 2:39:17 PM] Would prune 22 rows from MUD.ABClient_Inspections_Table
[10/6/2025 2:39:20 PM] Would prune 2 rows from MUD.ABClient_Inspections_Table__ATTACH

ONLY - Only Prune System Tables Log

[10/6/2025 2:42:52 PM] Prune moment: 10/6/2025 7:42:52.283 PM

Both Checked

[10/6/2025 2:41:16 PM] Prune moment: 10/6/2025 7:41:15.733 PM
[10/6/2025 2:41:16 PM] Reporting how many rows would be pruned from each table.

Screenshot 2025-10-14 105604.png

0 Kudos
RobertKrisher
Esri Regular Contributor

@BGEGIS 

I only see three of the possibilities listed above, what about the fourth option of leaving both boxes unchecked? What I'm suggesting is that you run it with the Report Only box unchecked (so it will actually prune) AND the Only Prune System Tables box unchecked (so it will prune the data in the user tables).

0 Kudos