Skip to main content

Materialize configurations

Performance optimizations


Advanced feature

Manually creating indexes in Materialize is an advanced feature that most users do not need. See the Materialize documentation for more details.

Materialized views (materializedview), views (view) and sources (source) may have a list of indexes defined. Each Materialize index can have the following components:

  • columns (list, required): one or more columns on which the index is defined
  • type (string, optional): a supported index type. The only supported type is arrangement.
{{ config(materialized='view',
indexes=[{'columns': ['symbol']}]) }}

select ...

If one or more indexes are configured on a resource, dbt will run create index DDL statement(s) as part of that resource's materialization, within the same transaction as its main create statement. For the index's name, dbt uses a hash of its properties and the current timestamp, in order to guarantee uniqueness and avoid namespace conflict with other indexes.

create index if not exists
on "my_target_database"."my_target_schema"."view_model"

You can also configure indexes for a number of resources at once:

- columns: ['symbol']