Add CTEs and optimize fct_daily_rt_feed_validation_notices #3509
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR is a second pass on optimizing fct_daily_rt_feed_validation_notices to fix issue #3481.
@ohrite and I split the query into 4 CTEs
This reduced the runtime to < 1m. Since the restructure represents a fundamental change in how the data is aggregated, we are working on validating the output.
Type of change
How has this been tested?
We've queried both production and staging tables, compared row values for 2023-12-28, and generated csv files for 2024-10-16, comparing both files through DIFF and had zero differences.
Used SQLFluff to check the query:
The table was successfully created on staging:
Post-merge follow-ups
Watch the next time the DAG runs to see the results and no more errors.