5.11. Tables #

This section explains how to manage tables. It contains the following instructions:

Creating a Table

  1. In the navigation panel, go to Databases.

  2. (Optional) To display system databases, turn on Show system databases.

  3. Click the name of the database.

  4. Click the name of the schema.

  5. In the top-right corner of the page, click Create table.

  6. Enter parameters of the new table (parameters marked with an asterisk are required):

    • Name.

    • Tablespace: The tablespace where the table will be created.

    • Columns: Columns of the created table.

      To add a column:

      1. Click Add +.

      2. Enter parameters of the new column (parameters marked with an asterisk are required):

        • Name.

        • Type: The type of the column data.

        • NOT NULL: Specifies whether the column accepts NULL values.

        • Default value: The default value of the column.

        • Primary key: Specifies whether the column can contain only unique (non-repeating) values different from NULL.

          To add a primary key storage parameter, click Add + and specify the required parameters:

          • Name: The name of the primary key storage parameter.

            Possible values:

          • Value: The value of the primary key storage parameter.

        • Unique key: Specifies whether the column can contain only unique values.

          To add a unique key storage parameter, click Add + and specify the required parameters:

          • Name: The name of the unique key storage parameter.

            Possible values:

          • Value: The value of the unique key storage parameter.

        • Check expression: The constraint of the column.

        • Compression method: The compression method for the column.

          Possible values:

          • pglz

          • lz4

      3. Click Save.

    • Storage parameters: Storage parameters of the table.

      To add a storage parameter:

      1. Click Add +.

      2. Select the parameter.

      3. Specify the value.

    • UNLOGGED: Specifies whether the created table is unlogged.

    • lock_timeout, s: Abort any statement that waits longer than the specified time while attempting to acquire a lock on a table, index, row, or other database object. The time limit applies separately to each lock acquisition attempt.

      For more information about this parameter, refer to the official Postgres Pro documentation.

  7. Click Save.

Viewing Tables

  1. In the navigation panel, go to Databases.

  2. (Optional) To display system databases, turn on Show system databases.

  3. Click the name of the database.

  4. Click the name of the schema.

The schema page with the selected Tables tab will be displayed. This tab includes the following columns:

  • Tables: The unique name of the table within the schema.

  • Total size: The size of the table in bytes.

    The horizontal indicator displays the following:

    • the size of the table user data and bloating

    • the total size of all table indexes, including the index bloat

    • the size of the service TOAST storage without bloating

  • CFS: Specifies whether the CFS compression is used for the table. Applicable only for the Postgres Pro Enterprise edition.

  • Data: The size of data in bytes, with the bloat percentage indicated separately.

  • Indexes: The total number of indexes, size of indexes in bytes, and bloating percentage.

  • TOAST: The size of the service TOAST storage without bloating.

  • Actions.

    For more information about available actions, refer to other instructions in this section.

Collecting the Planner Statistics for a Table

The ANALYZE SQL command is executed when collecting the planner statistics.

To collect the planner statistics for a table:

  1. In the navigation panel, go to Databases.

  2. (Optional) To display system databases, turn on Show system databases.

  3. Click the name of the database.

  4. Click the name of the schema.

  5. Click Three vertical dots iconAnalyze next to the table.

  6. Specify the statistics collection parameters (parameters marked with an asterisk are required):

    • Set cron-string execution: Allows specifying the time interval for collecting statistics in the crontab format.

      If you turn on this toggle, in Execution, enter the string.

    • Task planning: The type of the statistics collection task.

      Possible values:

      • Execute now: The statistics will be collected immediately after you perform this instruction.

      • Time-delayed: The statistics will be collected at the specified date and time.

      • On schedule: The statistics will be collected at the specified time interval.

        For this value, specify the following parameters:

        • Interval: The unit of measurement of the time interval.

          Possible values:

          • Minutes

          • Hours

          • Days

        • Repeat every: The time interval for collecting statistics by minutes or hours.

          This parameter is available only if you select Minutes or Hours from Interval.

        • Execution days: The days when statistics will be collected.

        • Cron total line: The string in the crontab format that specifies the time interval for collecting statistics.

          The value is entered automatically.

      This parameter is available only if you turn off Set cron-string execution.

    • Name: The unique name of the statistics collection task.

      This parameter is available only if you turn on Set cron-string execution or select Time-delayed / On schedule from Task planning.

    • Time: The date and/or time when statistics will be collected.

      This parameter is available only if you select Time-delayed from Task planning or Days from Interval.

    • Start and Repeat untill: The start and end date and time for the statistics collection.

      These parameters are available only if you turn on Set cron-string execution or select On schedule from Task planning.

  7. Click Apply.

  8. Confirm the operation.

The statistics collection will start in the asynchronous mode.

Note

Depending on the number of tables and columns, this operation may require significant resources so it is recommended to track it.

Reindexing a Table

The REINDEX SQL command is executed when reindexing.

To reindex a table:

  1. In the navigation panel, go to Databases.

  2. (Optional) To display system databases, turn on Show system databases.

  3. Click the name of the database.

  4. Click the name of the schema.

  5. Click Three vertical dots iconReindex next to the table.

  6. Specify the reindexing parameters (parameters marked with an asterisk are required):

    • Set cron-string execution: Allows specifying the time interval for reindexing in the crontab format.

      If you turn on this toggle, in Execution, enter the string.

    • Task planning: The type of the reindexing task.

      Possible values:

      • Execute now: Reindexing will be performed immediately after you perform this instruction.

      • Time-delayed: Reinxdexing will be performed at the specified date and time.

      • On schedule: Reindexing will be performed at the specified time interval.

        For this value, specify the following parameters:

        • Interval: The unit of measurement of the time interval.

          Possible values:

          • Minutes

          • Hours

          • Days

        • Repeat every: The time interval for reindexing by minutes or hours.

          This parameter is available only if you select Minutes or Hours from Interval.

        • Execution days: The days when reindexing will be performed.

        • Cron total line: The string in the crontab format that specifies the time interval for reindexing.

          The value is entered automatically.

      This parameter is available only if you turn off Set cron-string execution.

    • Name: The unique name of the reindexing task.

      This parameter is available only if you turn on Set cron-string execution or select Time-delayed / On schedule from Task planning.

    • Time: The date and/or time when reindexing will be performed.

      This parameter is available only if you select Time-delayed from Task planning or Days from Interval.

    • Start and Repeat untill: The start and end date and time for reindexing.

      These parameters are available only if you turn on Set cron-string execution or select On schedule from Task planning.

  7. Confirm the operation.

The reindexing task will start.

Note

Depending on the number and size of indexes, this operation may require significant resources so it is recommended to track it.

Vacuuming a Table

The VACUUM SQL command is executed when vacuuming.

To vacuum a table:

  1. In the navigation panel, go to Databases.

  2. (Optional) To display system databases, turn on Show system databases.

  3. Click the name of the database.

  4. Click the name of the schema.

  5. Click Three vertical dots iconVacuum next to the table.

  6. Specify the vacuum parameters (parameters marked with an asterisk are required):

    • Modes: The vacuum modes.

      Possible values:

      • Analyze: Updates the statistics that the planner uses for selecting the most efficient way of query execution.

      • Full: Performs a full vacuum via reindexing all table files.

        Note

        While the vacuum is being performed in this mode, all sessions working with tables that are being reindexed will be blocked.

      • Freeze: Performs an aggressive tuple freeze to expand freezing and release transaction IDs for further reuse.

        The aggressive freeze is always performed when overwriting the table, so do not select Freeze if Full is already selected.

    • Set cron-string execution: Allows specifying the time interval for vacuuming in the crontab format.

      If you turn on this toggle, in Execution, enter the string.

    • Task planning: The type of the vacuuming task.

      Possible values:

      • Execute now: Vacuuming will be performed immediately after you perform this instruction.

      • Time-delayed: Vacuuming will be performed at the specified date and time.

      • On schedule: Vacuuming will be performed at the specified time interval.

        For this value, specify the following parameters:

        • Interval: The unit of measurement of the time interval.

          Possible values:

          • Minutes

          • Hours

          • Days

        • Repeat every: The time interval for vacuuming by minutes or hours.

          This parameter is available only if you select Minutes or Hours from Interval.

        • Execution days: The days when vacuuming will be performed.

        • Cron total line: The string in the crontab format that specifies the time interval for vacuuming.

          The value is entered automatically.

      This parameter is available only if you turn off Set cron-string execution.

    • Name: The unique name of the vacuuming task.

      This parameter is available only if you turn on Set cron-string execution or select Time-delayed / On schedule from Task planning.

    • Time: The date and/or time when vacuuming will be performed.

      This parameter is available only if you select Time-delayed from Task planning or Days from Interval.

    • Start and Repeat untill: The start and end date and time for vacuuming.

      These parameters are available only if you turn on Set cron-string execution or select On schedule from Task planning.

  7. Click Apply.

  8. Confirm the operation.

Note

Depending on the number and size of tables, this operation may require significant resources so it is recommended to track it.

Viewing Table Constraints

  1. In the navigation panel, go to Databases.

  2. (Optional) To display system databases, turn on Show system databases.

  3. Click the name of the database.

  4. Click the name of the schema.

  5. Click the name of the table.

  6. Select Constraints.

The table of constaints with the following columns will be displayed:

  • Name.

  • Definition.

Viewing Table Storage Layers

  1. In the navigation panel, go to Databases.

  2. (Optional) To display system databases, turn on Show system databases.

  3. Click the name of the database.

  4. Click the name of the schema.

  5. Click the name of the table.

  6. Select Storage.

The table of storage layers with the following columns will be displayed:

  • Size.

  • Tablespace: The tablespace where the storage layer is located.

  • File path: The path to the storage layer file.

The following storage layers are displayed in the table:

  • Main data: The layer for storing the main user data.

  • Free space map: The service layer for storing information about free space segments of the main storage layer.

  • Visibility map: The service layer for storing information about visiable rows of the main storage layer.

  • CFM: The service layer for the CFS compression.

  • TOAST: The service layer for storing large values exceeding the standard page data storage restrictions.

Editing a Table

  1. In the navigation panel, go to Databases.

  2. (Optional) To display system databases, turn on Show system databases.

  3. Click the name of the database.

  4. Click the name of the schema.

  5. Click Edit next to the table.

  6. Edit table parameters.

    Available storage parameters are listed in Table Storage Parameters.

  7. Click Save.

Viewing Table Columns

  1. In the navigation panel, go to Databases.

  2. (Optional) To display system databases, turn on Show system databases.

  3. Click the name of the database.

  4. Click the name of the schema.

  5. Click the name of the table.

The table page with the selected Structure tab will be displayed. This tab includes the following columns:

  • Number: The ordinal number of the table column.

  • Name.

  • Type: The type of the table column data.

  • Nullable: Specifies whether the table column can contain NULL values.

  • Default value: The default value of the table column.

  • Description.

  • Actions.

    For more information about available actions, refer to other instructions in this section.

Editing a Table Column

  1. In the navigation panel, go to Databases.

  2. (Optional) To display system databases, turn on Show system databases.

  3. Click the name of the database.

  4. Click the name of the schema.

  5. Click the name of the table.

  6. Click Edit next to the table column.

  7. Edit table column parameters.

  8. Click Save.

Deleting a Table Column

  1. In the navigation panel, go to Databases.

  2. (Optional) To display system databases, turn on Show system databases.

  3. Click the name of the database.

  4. Click the name of the schema.

  5. Click the name of the table.

  6. Click Delete next to the table column.

  7. Click Delete.

Deleting a Table

Important

Deleted tables cannot be restored.

To delete a table:

  1. In the navigation panel, go to Databases.

  2. (Optional) To display system databases, turn on Show system databases.

  3. Click the name of the database.

  4. Click the name of the schema.

  5. Click Delete next to the table.

  6. Click Delete.