Select to view content in your preferred language

Tips for Compressing with Existing Geodatabase Replicas

5599
3
03-24-2015 04:42 AM
Labels (1)
TinaMorgan1
Frequent Contributor
3 3 5,599
In a versioned environment, all edits are stored in what we call delta tables, or Adds and Deletes tables, and these tables are assigned to a unique state ID. Edits are held in the delta tables to handle any conflicts in a multi-user enterprise geodatabase. A compress operation trims the delta tables of any unreferenced state ids, consolidating the states lineage down to one state. If a state is still being referenced, it will remain in the delta tables, resulting in a partial compress.

In a fully compressed geodatabase, there are no rows in the delta tables, and the state tree is trimmed back to one state, state_id=0. Although a full compress is ideal, it is not always necessary and in some cases may not even be practical. For example, if there are many multi-generation replicas in your geodatabase that are not unregistered before the compress, you will need to send changes for all of these replicas to achieve a full compress. If there are many Two-way replicas, and you intend to fully compress both the parent and the child geodatabases, this process of synchronization will need to be done separately from both geodatabases, even if there are no changes to be sent.



Two important things are needed to get a full compress on a geodatabase that still has replicas registered.
  • The existing replicas must be the data sender in the replica relationship.
  • Every replica version must be at the same state as DEFAULT version.

This means that for Two-way replicas, there can be no SYNC_RECEIVE or SYNC_RECEIVE_REC versions in the geodatabase that need to be compressed.

The example below shows the parent geodatabase versions table. All versions associated with a single replica will contain a synchronization version id number in the version names. There are two replicas in this versions table. The One way replica, represented by the synchronization version ID number 10554, is a parent to child replica. Notice the DEFAULT state_id is 398, while this synchronization version is only at state_id 395. One-way replicas will only contain an associated replica version in the data sending geodatabase.

Going on, the replica with synchronization version 10552 is a two-way replica. Two-way replicas can be more complicated since the edits may travel in either direction, frequently switching the data sender and receiver roles. Notice that this two-way replica does have the SYNC_RECEIVE and SYNC_RECEIVE_REC versions associated with it, meaning that this version is in the data receiver role.

This example is making the assumption that there are no named child versions, and that connected synchronization is being used.11.jpg

To prepare this geodatabase for a full compress, I must do the following.
  1. Synchronize the one-way replica.
  2. Synchronize the two-way replica, sending changes from this geodatabase to its partner geodatabase. The image above shows the versions table in the parent geodatabase, and tells me that this parent is currently set as the data receiver; therefore, I will synchronize parent to child, in effect making this geodatabase the data sender.

The results of these two steps are shown in the image below.2.jpg

With all of my versions set as acknowledged data senders and with the state_id equal to the DEFAULT version, my geodatabase is ready for a full compress.3.jpg

Note that it is common to see these two requirements met, and yet only get a partial compress. If this is the case, synchronize the replicas in the geodatabase that need a full compress again. Even though no changes are being sent, acknowledgements are being sent that will tell the geodatabase that the edits are recognized and can be flushed from the delta tables.

In general, look to achieve some level of compress rather than a full compress. Attempting to achieve a full compress may lead to many additional synchronizations which may not be practical in your particular business workflow.
Tina M. - Geodata Support Analyst
3 Comments
pfoppe
by MVP
MVP

Thank you Tina Morgan‌ ... this was very helpful obtaining a full compress on a national/central geodatabase that has (14) 2-way and 1-way connected replicas (in place for the past 5 years).  This information was the key in the puzzle to obtain a state 0 compress.  We were able to demonstrate a 10-15% performance gain on this geodatabase.  

We were also able to demonstrate an 85% gain on a different geodatabase that was using versioning with large bulk replace operations (no connected replicas).  More sharing the gains that can be had for a properly tuned geodatabase. 

This information should be highlighted further! 

TinaMorgan1
Frequent Contributor

Thank you for the feedback! 

JoeBorgione
MVP Emeritus

Tina Morgan‌ - great article as usual.

We use this article in the help docs as a guide for our compress scripts and it works great for us.  However, we now have the need to compress an Enterprise GDB that is the child in a two-replication scenario.  I don't have access through SSMS to the gdb tables, and when I use arcpy.ListVersions() with the SDE user connection, I only see sde.default (at least at this moment).

Syncing between this child and it's parent is taken care of as a scheduled task which happens every Friday evening.  What considerations would you recommend for me to modify the existing script?

About the Author
Hello! I am a senior geodata support analyst with Esri Support Services in Redlands, California. Originally I am from Baton Rouge, Louisiana, and as you can imagine I love food and hurricanes. Most of my time in university was spent eating food and studying hurricanes...once I ate food while studying hurricanes during a hurricane. I also love animals...all of them. Regardless of the subject, I love learning new things, and as soon as I learn something new I want to share it with the world. Thank you for letting me share!