Compacts a personal or file geodatabase. Compacting rearranges how the geodatabase is stored on disk, often reducing its size and improving performance.
It is recommended to compact personal geodatabases when they become larger than 250 MB.
If data entry, deletion, or general editing is frequently performed on a database, the database should be regularly compacted to ensure optimal performance.
If a database is open in ArcMap for editing, it cannot be compacted. To compact the database, remove any layers with a source table or feature class in that database from the Contents window.
The personal or file geodatabase to be compacted.
Compact example (Python window)
The following Python window script demonstrates how to use the Compact function in immediate mode.
Compact example 2 (stand-alone script)
The following stand-alone script is a simple example of how to use the Compact function in a scripting environment.
# Name: Compact_Example.py
# Description: compact a file geodatabase
# Import the system modules
# Set local variables
gdbWorkspace = "C:/data/data.gdb"
- ArcGIS Desktop Basic: Yes
- ArcGIS Desktop Standard: Yes
- ArcGIS Desktop Advanced: Yes