# Execution time of materialzed view and materialized table

**URL:** https://discourse.getdbt.com/t/execution-time-of-materialzed-view-and-materialized-table/8984
**Category:** Help
**Created:** [July 4, 2023, 6:01pm UTC](https://discourse.getdbt.com/t/execution-time-of-materialzed-view-and-materialized-table/8984 "2023-07-04T18:01:20Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![unknownfakir1](https://avatars.discourse-cdn.com/v4/letter/u/a4c791/32.png) [@unknownfakir1](https://discourse.getdbt.com/u/unknownfakir1)
#### Post date: [July 4, 2023, 6:01pm UTC](https://discourse.getdbt.com/t/execution-time-of-materialzed-view-and-materialized-table/8984/1 "2023-07-04T18:01:20Z")

</div>

Who takes the more time materialized table or materialized view? How can I show it?

{{ config(materialized=‘view’) }}

SELECT  
country\_code,  
country\_size  
FROM  
{{ref(‘country\_details’)}}  
how can i show it using this query for view and table? Please answer it

---

<div class="post-metadata">

### Author: ![a\_slack\_user](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/a_slack_user/32/1629_2.png) [@a\_slack\_user](https://discourse.getdbt.com/u/a_slack_user)
#### Post date: [July 5, 2023, 1:20pm UTC](https://discourse.getdbt.com/t/execution-time-of-materialzed-view-and-materialized-table/8984/2 "2023-07-05T13:20:24Z")

</div>

The “view” materialization will almost always be faster because views do not store any data. But there are situations where the “table” (or other) materializations can perform better overall, depending on the sorts of queries issued against your model.

There’s a terrific overview in the documentation here: [https://docs.getdbt.com/docs/build/materializations](https://docs.getdbt.com/docs/build/materializations)

Note: `@Owen` originally [posted this reply in Slack](https://getdbt.slack.com/archives/CBSQTAPLG/p1688563215679179?thread_ts=1688493706.037229&cid=CBSQTAPLG). It might not have transferred perfectly.

---

<div class="post-metadata">

### Author: ![akashsolanke22](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/akashsolanke22/32/2676_2.png) [@akashsolanke22](https://discourse.getdbt.com/u/akashsolanke22)
#### Post date: [July 6, 2023, 5:44am UTC](https://discourse.getdbt.com/t/execution-time-of-materialzed-view-and-materialized-table/8984/3 "2023-07-06T05:44:56Z")

</div>

If you were using backend database as snowflake then you can check who takes more time there in Query History tab. All querys you execute on dbt at the end they hits to snowflake so you can check there. It stores the details long to 7 days prior to that you can check the query details.

---

<div class="post-metadata">

### Author: ![unknownfakir1](https://avatars.discourse-cdn.com/v4/letter/u/a4c791/32.png) [@unknownfakir1](https://discourse.getdbt.com/u/unknownfakir1)
#### Post date: [July 6, 2023, 7:17am UTC](https://discourse.getdbt.com/t/execution-time-of-materialzed-view-and-materialized-table/8984/4 "2023-07-06T07:17:16Z")

</div>

I am using postgres as database,So I want to have clarity that  
Is materialised view in postgres is different from materialised view in dbt?

As u said view do not stores data ,But in materialised view of postgres data is stored that is why execution is faster in materialised view of postgres as it does not run the query again and again.  
Am I missing something ?

---

<div class="post-metadata">

### Author: ![unknownfakir1](https://avatars.discourse-cdn.com/v4/letter/u/a4c791/32.png) [@unknownfakir1](https://discourse.getdbt.com/u/unknownfakir1)
#### Post date: [July 6, 2023, 8:43am UTC](https://discourse.getdbt.com/t/execution-time-of-materialzed-view-and-materialized-table/8984/5 "2023-07-06T08:43:47Z")

</div>

> [@unknownfakir1](#):
>
> Is materialised view in postgres is different from materialised view in dbt?
> 
> As u said view do not stores data ,But in materialised view of postgres data is stored that is why execution is faster in materialised view of postgres as it does not run the query again and again.  
> Am I missing something ?

@akashsolanke22 can u address this?

---

<div class="post-metadata">

### Author: ![a\_slack\_user](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/a_slack_user/32/1629_2.png) [@a\_slack\_user](https://discourse.getdbt.com/u/a_slack_user)
#### Post date: [July 6, 2023, 12:00pm UTC](https://discourse.getdbt.com/t/execution-time-of-materialzed-view-and-materialized-table/8984/6 "2023-07-06T12:00:58Z")

</div>

As far as I know, dbt does not yet support the creation or maintenance of materialized views (but that functionality is planned for a future release). I cannot speak to to the performance characteristics of dbt’s “table” materialization vs an equivalent Postgres materialized view.

Note: `@Owen` originally [posted this reply in Slack](https://getdbt.slack.com/archives/CBSQTAPLG/p1688644837312789?thread_ts=1688493706.037229&cid=CBSQTAPLG). It might not have transferred perfectly.
