Quick Tip: Identifying and Enhancing FACT Tables without Primary Index in Firebolt

The Challenge

In any data warehouse, including Firebolt, ensuring optimal query performance often requires identifying Fact tables that lack primary indexes. Fact tables without primary indexes can significantly slow down query processing times, affecting overall data analysis efficiency.

Solution

Use the information_schema tables in Firebolt to quickly identify Fact tables that do not have a primary index defined. This approach allows for a systematic review of your data warehouse schema, ensuring that all critical Fact tables are optimized for query performance.

Example

Below is a query that serves as a tool to identify all FACT tables that do not have a primary index.
This query filters out system and information_schema tables, focusing only on your FACT tables:

SELECT  *FROM  information_schema.tablesWHERE  table_type = 'FACT'  AND primary_index = ''  AND table_schema NOT IN ('information_schema', 'catalog')  AND number_of_rows > 0;

Conclusion

Once you've identified FACT tables lacking primary indexes, the recommended next step is to re-create these tables with an appropriate primary index. This action is not only a best practice but a strategic move to enhance query performance significantly.
Visit How to create a primary index docs to learn more about creating and applying primary indexes effectively.

By proactively identifying and re-creating tables without primary indexes, you ensure your Firebolt environment is optimized for high-speed analytics, and enhancing the overall performance of your data warehousing operations.