24.3. Rewriting Parquet Files (axe.rewrite_data_files) #
When you delete rows from an analytical table, Postgres Pro AXE does not modify Parquet files. Instead, it creates delete files that contain the positions of the deleted rows. Rows are excluded from analytical queries based on delete files. Parquet files with a large number of deleted rows degrade analytical query performance.
The axe.rewrite_data_files stored procedure rewrites Parquet files without the deleted rows.
Required privileges: Superuser or the Postgres Pro AXE administrator.
For more information about access management, refer to Chapter 12.
Execute one of the following commands on the Postgres Pro AXE server:
SELECT axe.rewrite_data_files([table_name => 'table_name'][, schema_name => 'schema_name'][, delete_threshold =>delete_threshold]);
Where:
table_name: The name of the analytical table whose Parquet files must be rewritten. If specified withoutschema_name, thepublicschema is used.Optional parameter. If not specified, Parquet files are rewritten for all analytical tables with the
auto_compactanalytics engine option set totrue.schema_name: The name of the schema containing the analytical table.Optional parameter. If not specified, Parquet files are rewritten in all schemas for analytical tables with the
auto_compactanalytics engine option set totrue.delete_threshold: The percentage of deleted rows in a Parquet file at which the file must be rewritten.Default value:
95.Optional parameter.
Postgres Pro AXE will return the number of delete files removed and the number of Parquet files rewritten.
Example 24.3. Rewriting Parquet Files
To rewrite Parquet files for all analytical tables:
SELECT axe.rewrite_data_files();
To rewrite Parquet files of the axe_table analytical table when 50% of its rows are deleted:
SELECT axe.rewrite_data_files(table_name => 'axe_table', delete_threshold => 50);