Question & Answer
How to compress data in a table?
Storage optimization by way of compressed data was made available as of 11.50.XC4. You can compress a table or table fragments using SQL Admin API commands. Either “task” or “admin” API functions can be used to execute SQL Admin API command. In this document we will use the task function.
As user informix or a user with connect permission to the sysadmin database, perform the following steps to compress data in a table:
1. Connect to sysadmin database
- DATABASE sysadmin;
2. Before 11.50.xC6, compression has to be enabled in order to use it. This is done using the command:
- EXECUTE FUNCTION task(“enable compression”);
3. You can perform data compression for a table or table fragments. Compression can be performed in one step or two steps. A compressed table requires a compression dictionary and the compression operation in order to complete the compression task. When the operation is done in one step, the operation will automatically create the compression dictionary, if it not already created.
Table compression syntax:
- EXECUTE FUNCTION task("table compress",
"TableName", "DatabaseName", "OwnerName");
- The name of the table that needs to compress
- The name of the database that contains the table
- The name of the database owner
Table fragmenting syntax:
- EXECUTE FUNCTION task("fragment compress",
- The list of partition numbers that belong to the same table
Use space as a delimiter
Was this topic helpful?
16 June 2018