IBM Support

Compress Data in a Table

Question & Answer


Question

How to compress data in a table?

Answer

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");
      TableName
        The name of the table that needs to compress
      DatabaseName
        The name of the database that contains the table
      OwnerName
        The name of the database owner

Table fragmenting syntax:
      EXECUTE FUNCTION task("fragment compress",
        "PartnumList");
      PartnumList
        The list of partition numbers that belong to the same table
        Use space as a delimiter

[{"Product":{"code":"SSGU8G","label":"Informix Servers"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Not Applicable","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF022","label":"OS X"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"11.5;11.7","Edition":"Ultimate","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
16 June 2018

UID

swg21381306