I have a materialized view named "hourly_metrics" on my table. It is a straightforward view that stores max, min, avg, stdedev and so on at hourly intervals. The thing here is that I also had some CASE
statements to pivot some data and I didn't store the SQL for my view.
It was all working perfectly, but I truncated some data from my base table and now the materialized view is not refreshing anymore. The web console shows the view is invalidated due to table truncate.
I was thinking I could just drop the materialize view and recreate it, but since I don't have the original SQL, I would like to know if there is some way to retrieve it, as I want to make sure I have all the CASE
conditions right.