auto-reorg
The auto-reorg
global parameter is a Boolean that determines whether Liquibase automatically reorganizes table objects stored on disk when you modify a DB2 database. The default value is true
.
Uses
When you modify a table in your database, its indexes and data may not be stored in adjacent locations stored on disk, which wastes space.
To compact these table objects and eliminate fragmented data, DB2 databases require you to use the REORG TABLE command after you run statements like DROP COLUMN
. By default, Liquibase adds all necessary REORG TABLE
statements automatically.
If you want to handle database reorganization manually, or if you use an automated process that reorganizes your database separately from Liquibase, you can set auto-reorg
to false
.
Setting the auto-reorg
parameter
You can set auto-reorg
in four ways:
- In the Liquibase properties file
- As a global parameter in the CLI
- As a JVM system property
- As an environment variable (Liquibase Pro)
Liquibase properties file parameter
In Liquibase 4.1+, add the following to Liquibase properties file:
liquibase.autoReorg
: <true|false>
CLI global parameter
Tip: All commands and parameters use the --kebab-case
format in the CLI environment. This is the format Liquibase recommends for best results. If your preference is camelCase, it will still work in the CLI.
In your command line, use a global parameter with a single Liquibase command:
liquibase --auto-reorg
=<true|false>
update
--changelog-file=dbchangelog.xml
Java system property
In your command line, use the JAVA_OPTS Environment Variable to set a JVM system property:
Mac/Linux syntax:
JAVA_OPTS=-Dliquibase.autoReorg
=<true|false>
Windows syntax:
set JAVA_OPTS=-Dliquibase.autoReorg
=<true|false>
Note: To use a Liquibase command alongside JAVA_OPTS
, add && liquibase <command>
to the end of your input.
Environment variable (Liquibase Pro)
In Liquibase Pro, set an environment variable:
Mac/Linux syntax:
LIQUIBASE_AUTO_REORG
=<true|false>
Windows syntax:
set LIQUIBASE_AUTO_REORG
=<true|false>
Note: These environment variable commands only apply to the current shell. If you need to pass an environment variable to a child process without affecting the parent process, you can use the export
command on Mac/Linux or the setx
command on Windows.