CALL recommend_ddl
can help you optimize schema configurations to enhance query performance by early data pruning. The statement finds primary indexes (PIs) and partition recommendations for the specified table tailored to the given workload.
Parameter | Description |
---|---|
<table_name> | The name of the table for which primary indexes and partition keys should be recommended. |
<select_statement> | SELECT statement that returns the workload that the DDL recommendation is based on. The <select_statement> must return exactly one column of type TEXT . |
CALL recommend_ddl
statement for a table named lineitem
tailored to the workload in the query history of the past week.
<select_statement>
returns exactly one column of type TEXT
containing the SQL statements that the CALL recommend_ddl
command should analyze.
Returns:
recommended_partition_key | recommended_primary_index | average_pruning_improvement | analyzed_queries |
---|---|---|---|
DATE_TRUNC(‘month’, l_orderdate) | l_shipmode, l_returnflag, l_shipinstruct | 0.42 | 393 |
CALL recommend_ddl
results indicate that the amount of bytes scanned can be decreased by up to 42% by configuring PRIMARY INDEX l_shipmode, l_returnflag, l_shipinstruct
and PARTITION BY DATE_TRUNC('month', l_orderdate)
.
The statement analyzed 393 queries that scanned the lineitem
table and applied filters to any of the lineitem
columns.
CALL recommend_ddl
command to find primary index and parition key configurations.
CALL recommend_ddl
command periodically to check for better table configurations.