Create Statistics
After loading data, we recommend that you run the optimizedb command or CREATE STATISTICS statement to create statistics that tell the query optimizer what your data looks like. The query optimizer uses the statistics to generate a query execution plan (QEP) that shows how your query is executed. The QEP can be reused to execute the same query.
We highly recommend running the optimizedb command if a significant percentage of the data (ten percent or greater) in a table has changed since the last time you ran optimizedb.
You can run optimizedb for certain tables or columns, or you can run it once for the entire database, assuming all the tables are owned by you.
We recommend that you generate the statistics for all columns that appear in the qualification (WHERE clause or ON clauses) of a query. If statistics are missing or incorrect, the query will still execute, but the speed of query processing can be affected.
Vector will automatically generate statistics for columns in Vector tables that have not already had optimizedb or CREATE STATS run for them. This essentially removes the risk of not creating statistics for some columns, but it adds a slight overhead to the query that triggers the initial creation of the statistics.
Note: Optimizedb collects statistics only for the tables owned by the user who is running it. A single optimizedb command will not optimize the entire database if multiple schemas are present. You must run optimizedb individually for each schema; to do this, you must be the DBA or a privileged user and use the optimizedb ‑u flag.
To run optimizedb for your tables in the database
Enter the following command at the operating system prompt:
optimizedb -zfq dbname
To speed the building of the histogram, use the -zfq flag.
Last modified date: 11/09/2022