20.2. Copying the OLAP Data to an Analytical Table From Other Tables #

Execute the following query:

  SELECT metastore.copy_table('table_name', SQL_query);

Where:

  • table_name: The name of the analytical table to which the OLAP data is copied.

  • SQL_query: The SQL query that determines which OLAP data is copied, for example, SELECT * FROM my_pgtable.

    The SQL query must be a single valid SELECT statement. The UNION operation is not supported.

Example 20.2. 

  SELECT copy_table('table_example', $$select * from pg_table_example$$);

Once the query is executed, pgpro_metastore performs the following actions:

  1. Verifies user privileges.

  2. Creates a new entry in the pga_snapshot metadata table.

  3. Creates a directory for results of the SQL query that are saved as Parquet files.

  4. Executes the SQL query and writes its results to Parquet files.

  5. Adds the OLAP data to the analytical table.