FT_StoreIndexSnapshot#

Summary#

FT_StoreIndexSnapshot collects and stores statistical data related to the index structure. It returns true if the storing is successfully performed and false otherwise.

Signatures#

Bool FT_StoreIndexSnapshot(text index_name, text index_directory, integer execution_id, bool print_index=false, integer loc_stat_data=1, text file=NULL);

Bool FT_StoreIndexSnapshot(text apath, integer execution_id, bool print_index=false, integer loc_stat_data=1, text file=NULL);

Description#

FT_StoreIndexSnapshot collects and stores statistical data related to the index structure. It returns true if the storing is successfully performed and false otherwise.

This operation has two versions and its parameters are:

  • index_name is the name of the index file.
  • index_directory is the directory path that stores the index file.
  • apath is the absolute path of the index file.
  • execution_id is the primary key value of the table Execution. The statistical data collected and stored by FT_StoreIndexSnapshot is always associated to a tuple in the table Execution.
  • print_index is a flag that indicates if the nodes of the index should be also be stored. Its default is false, indicating that this collection should not be performed.
  • loc_stat_data defines where the statistical data should be stored. If its value is equal to 1, its default value, the statistical data is stored directly in the FESTIval’s data schema. If its value is equal to 2, the statistical data is stored in a SQL file that can be latter loaded into the FESTIval’s data schema.
  • file is the absolute path of the SQL file that will store the statistical data, if loc_stat_data is equal to 2. This file will be created if it does not exist. This parameter is not used if loc_stat_data is equal to 1.

Note

We recommend that you see the FESTIval's data schema in order to understand the types of statistical data that can be managed.

Caution

If loc_stat_data is equal to 2, the connected user of the database must be permission to write in the directory storing this SQL file. Otherwise, an error is returned.

Examples#

--setting the execution name
SELECT FT_SetExecutionName('a workload focused on queries');

--performing the operations
SELECT FT_AInsert('/opt/festival_indices/rstartree-brazil_points2017', 1000, 
    (SELECT way FROM brazil_points2017 WHERE id = 1000)
    );
SELECT FT_AInsert('/opt/festival_indices/rstartree-brazil_points2017', 1001, 
    (SELECT way FROM brazil_points2017 WHERE id = 1001)
    );
SELECT FT_AInsert('/opt/festival_indices/rstartree-brazil_points2017', 1002, 
    (SELECT way FROM brazil_points2017 WHERE id = 1002)
    );
--queries could be performed here

--storing statistical data related to the index structure to analyze the impact of the last insertion on the structure of the index
SELECT FT_StoreIndexSnapshot('/opt/festival_indices/r-tree', 
    (SELECT max(pe_id) FROM fds.execution), 
    false, 2, '/opt/statistical_data.sql');

See Also#