跳至內容

Redshift Materialized View doesn't incrementally refresh

0

I have two materialized views in redshift.
The first uses an outer join, and thus is not eligible for incremental refresh. We'll call this lookup_view.

The second view joins lookup_view to another table. It does not use any of the features listed as limitations to redshift's incremental refresh capability.

I was expecting, because the lookup_view is materialized, that the details of how that view is built would have no impact on whether the second view could be incrementally updated. However, if I remove the join on lookup_view form the definition of the second view, then it suddenly shows a "state" of 1, indicating it can be incrementally refreshed.

Is this expected behavior, and if so, can anyone explain why limitation exists?

已提問 1 年前檢視次數 240 次
1 個回答
0

You’re conceptualizing an incremental refresh wrong. Let’s say you set up an incremental refresh on a table, then remove all the rows from that table, and add the rows back in. When the view refreshes, it looks for changed data. All the data has now changed, so it’s no different than a full refresh. That’s what’s going to happen in your scenario.

The other issue is your conceptualizing of materialized views incorrectly. Look at pg_tables, it’ll show all the physical tables. You’ll notice that some start with mv_ these are what redshift uses under the hood to represent the physical table in a materialized view. Views are just pointers, they don’t “contain” data that can change. And even if u could I wouldn’t recommend pointing anything directly at an mv_ table, they might get randomly whacked or something. Mat views aren’t smart enough to go down the chain and say “oh I’m referencing view a that references view b that references table c, something in table c changes so I have to change something too” so they just do full refresh.

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。