Statistics

The Db2® Big SQL query optimizer uses statistics to determine an efficient data access strategy.

However, in some cases, Db2 Big SQL might not have sufficient statistics available, such as when the underlying data source does not provide the information.

You can run the EXPLAIN command to inspect the data access plan that is selected by the Db2 Big SQL optimizer for your query. This information helps you to tune your queries for better performance.

You can run the ANALYZE command to gather information and statistics about tables and columns. By using this command, you can see details about a table and its columns. To give the optimizer a more complete picture of the data in your tables, collect metadata statistics by using the ANALYZE command. This command is especially useful when you are dealing with large volumes of data.

Important: Running the RUNSTATS command against Hadoop and HBase tables is not recommended, because doing so clears any previously collected statistics.

Run the ANALYZE command to gather statistical data and then run the EXPLAIN command to see the improved access plan based on that statistical data. By supplying the Db2 Big SQL query optimizer with updated statistics, it can select a more effective data access strategy for your query. This can result in better runtime performance.