dbt-labs / dbt-labs/dbt

[Feature] Create indexes also without full refresh

Open
#9,510 3 comments 12 reactions 0 assignees View on GitHub
engine:v1 index materialized_views type:feature
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

### Is this your first time submitting a feature request?

- [X] I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
- [X] I have searched the existing issues, and I could not find an existing issue for this feature
- [X] I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

### Describe the feature

I have an incremental table or a materialized view and create a new index for this via `config(indexes=[{'columns': ['column_a']}])`. Then, this index is only created if the model is run with `full-refresh`.
It would be better, if the index is created with every run. I.e, if I add an index to a model, this is created with the next run.

I'm using PostgreSQL.

### Describe alternatives you've considered

Alternatives:
* Do a full refresh, which can be expensive
* Create an index "by hand" in SQL

### Who will this benefit?

Subsequenctly adding an index for incremental models, which are expensive to fully refresh.

### Are you interested in contributing this feature?

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.