Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redshift: Use QUALIFY statement instead of prep-CTEs to enhance performance #302

Merged
merged 4 commits into from
Jan 10, 2025

Conversation

tkiehn
Copy link
Collaborator

@tkiehn tkiehn commented Jan 10, 2025

Description

All macros that need to get the latest existing records now use QUALIFY instead of an additional CTE with ROW_NUMBER() and WHERE. This massively boosts performance.

Fixes #298

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have performed a self-review of my code

@tkiehn tkiehn requested a review from tkirschke January 10, 2025 11:52
@tkiehn tkiehn linked an issue Jan 10, 2025 that may be closed by this pull request
@tkiehn tkiehn added the testing To trigger the automated test workflow as internal User. label Jan 10, 2025
latest_entries_in_sat AS (

SELECT
{{ parent_hashkey }},
{{ ns.hdiff_alias }}
FROM
latest_entries_in_sat_prep
WHERE rn = 1
{{ this }} redshift_requires_an_alias_if_the_qualify_is_directly_after_the_from
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aaaaha

@remoteworkflow
Copy link

remoteworkflow bot commented Jan 10, 2025

Link to workflow summary: https://github.com/ScalefreeCOM/datavault4dbt-ci-cd/actions/runs/12708999828


RESULTS for Synapse:
✅ dbt-tests
✅ dbt-macro-tests


RESULTS for Postgres:
✅ dbt-tests
✅ dbt-macro-tests


RESULTS for BigQuery:
✅ dbt-tests
✅ dbt-macro-tests


RESULTS for Redshift:
✅ dbt-tests
✅ dbt-macro-tests


RESULTS for Snowflake:
✅ dbt-tests
✅ dbt-macro-tests


RESULTS for Exasol:
✅ dbt-tests
✅ dbt-macro-tests


RESULTS for Fabric:
Fabric had a misconfiguration, fixed run here


RESULTS for Oracle:
✅ dbt-tests
✅ dbt-macro-tests


RESULTS for Databricks:
✅ dbt-tests
✅ dbt-macro-tests

@remoteworkflow remoteworkflow bot removed the testing To trigger the automated test workflow as internal User. label Jan 10, 2025
@tkiehn tkiehn merged commit 27f64ae into main Jan 10, 2025
1 check passed
@tkiehn tkiehn deleted the 298-bug-redshift-not-using-qualify-for-latest-records branch January 10, 2025 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Redshift not using QUALIFY for latest records
2 participants