Compact_management in Python makes the geodatabase larger

1889
3
02-04-2016 10:52 AM
MarkMiller4
New Contributor III

When using Compact_management in Python it actually makes the geodatabase larger. Has anyone else noticed this, or any ideas as to why this might be happening?

I'm using it on a file geodatabase. When I right-click on it in ArcCatalog and use the Administration>Compact Database command it compacts down to about 6.6 MB. When I run the Python script it inflates it to about 9 MB.

Any ideas or suggestions would be greatly appreciated!

0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

Which python script? the one at the end of the help topic? Did you run it twice...once through catalog then again via script?  Some detail is missing in your described steps Compact—Help | ArcGIS for Desktop

0 Kudos
MarkMiller4
New Contributor III

Not the exact script from the Help, but a similar one:

import arcpy

from arcpy import env

env.workspace = {full path to the database}

arcpy.Compact_management(env.workspace)

I also tried setting a variable equal to the workspace and then running the Compact on the variable rather than directly on the env.workspace with the same results.

I initially ran the above script on the database after adding some non-spatial tables to it and noticed the size increase. I then compacted the database using ArcCatalog, right-click, Administration>Compact database and found that it dropped the size by 1/3. I then reran the same script on the same database and it inflated the size. Compacting through ArcCatalog dropped it back down.

If it helps, I'm running Windows 7 and ArcGIS 10.2.2.3552.

0 Kudos
DanPatterson_Retired
MVP Emeritus

and it was obviously not open all the time...?  There is nothing in the help topic that would suggest why if anything, would cause this.  Oddly, I the only thing I could suggest is to reboot completely between attempts and try reversing the order of you compaction attempts to see if the inflation/deflation process is due to the order of the use of catalog/script ... or just the order of doing it...itself.

0 Kudos