diff --git a/.changes/unreleased/Fixes-20230923-091155.yaml b/.changes/unreleased/Fixes-20230923-091155.yaml new file mode 100644 index 000000000..055d4dc7e --- /dev/null +++ b/.changes/unreleased/Fixes-20230923-091155.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: avoid nested loop in query planner execution of redshift__get_relations +time: 2023-09-23T09:11:55.2152725-04:00 +custom: + Author: slin30 + Issue: "609" diff --git a/dbt/include/redshift/macros/relations.sql b/dbt/include/redshift/macros/relations.sql index 28c6bc377..6d83c36b9 100644 --- a/dbt/include/redshift/macros/relations.sql +++ b/dbt/include/redshift/macros/relations.sql @@ -24,6 +24,7 @@ with from pg_depend left join pg_rewrite on pg_depend.objid = pg_rewrite.oid + where coalesce(pg_rewrite.ev_class, pg_depend.objid) != pg_depend.refobjid ) select distinct @@ -36,7 +37,6 @@ join relation ref on dependency.ref_relation_id = ref.relation_id join relation dep on dependency.dep_relation_id = dep.relation_id -where ref.relation_name != dep.relation_name {%- endcall -%}