내용으로 건너뛰기

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?

질문됨 일 년 전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.

답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.