Passer au contenu

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?

demandé il y a un an241 vues
1 réponse
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.

répondu il y a un an

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.