16. Using the Query Optimizer : Database Statistics : Resources Required During Optimization
 
Share this page                  
Resources Required During Optimization
Optimizing a database generally requires disk space, because system catalog tables are created.
While the optimization process is running, the locking system takes an exclusive lock for a brief period on the user table being optimized. Whenever possible, tables on which statistics are created are not locked while statistics are gathered. This means that updates to the optimized table are not disabled for long periods. However, it is recommended that you optimize the database during off-hours.
When running optimizedb from the command line, the “-o filename” option can be used to write the statistics to an external file rather than to the system catalogs, so as to not require any catalog locks. At a later, more convenient time, the statistics can be loaded into the catalog with the “-i filename” option, using the same external file. Optimizedb -o requires read locks and optimizedb -i requires a brief exclusive lock on the user table. For more information on the optimizedb command, see the Command Reference.