Optimize your Model with Keys and Indexes
This article describes how to optimize a model using keys and indexes. Adding keys and is an advanced optimization technique. Please see the performance guide for when you should add keys and indexes.
Add or modify pipeline keys
Add or change the primary key
Open an existing model.
On the model screen, select a pipeline from the Pipelines section.
Ensure you are on the step you wish to add the key to and Select the column that will become the main key column of the primary Pipeline Key.
In the design panel, click Make Primary key.
Click Save.
A blue key icon is added to the column.
Edit the key column
Click the primary column (indicated with a blue key icon).
In the design panel, you can perform any of the following actions:
Add additional key columns to the primary key column to create or change a composite key.
Remove additional key columns from the primary key.
Remove the primary key from the pipeline.
Add additional columns to the pipeline key
On the model screen, select a Pipeline from the Pipelines section.
Select the current Primary key column (indicated with a blue key icon).
In the design panel, begin typing the column's name that you want to add in the Additional keycolumns text box.
Select the appropriate column. The selected column is now marked with a yellow key icon.
Repeat steps 2 and 3 until all the desired columns are added to the main key column.
Click Save.
Remove additional columns from the primary key
On the model screen, select a Pipeline from the Pipelines section.
Select Primary key column.
In the Primary key text box in the design panel, click x on the column to be deleted.
Click Save.
Remove the primary key
On the model screen, select a pipeline from the Pipelines section.
Select the primary key column.
Click the Clear Primary Key link in the General section of the Properties pane.
Click Save.
Note
If the primary key contains additional columns, they remain part of the main column's attribute key, indented beneath it in the pipeline schema.
Add an index
To add a new index to the pipeline:
On the model screen, select a Pipeline from the Pipelines section.
Select the INDEXES tab.
Collapse the design panel and click ➕ Index.
Open the design panel and click ➕ Column.
Select a pipeline column from the drop-down list to add to the new index. More columns can be added to the index by repeating this step.
Click Save.
Note
When one or more columns have been added to the index, this warning may appear on the pipeline:
The index won't be created in the warehouse unless the pipeline is created as a table.
Create a pipeline as a table
Select the COLUMNS tab, expand the Database section on the design panel, and set Create Pipeline As to Table.
Click Save.
Click Process Pipeline.