diff --git a/CHANGELOG.md b/CHANGELOG.md index 11d680df693..b00f600ac6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ Contributors: ### Fixes - Fix bug causing empty node level meta, snapshot config errors ([#4459](https://github.com/dbt-labs/dbt-core/issues/4459), [#4726](https://github.com/dbt-labs/dbt-core/pull/4726)) +- Fix slow `dbt run` when using Postgres adapter, by deduplicating relations in `postgres_get_relations` ([#3058](https://github.com/dbt-labs/dbt-core/issues/3058), [#4521](https://github.com/dbt-labs/dbt-core/pull/4521)) ## dbt-core 1.0.3 (TBD) diff --git a/plugins/postgres/dbt/include/postgres/macros/relations.sql b/plugins/postgres/dbt/include/postgres/macros/relations.sql index cc971f88932..a553f768148 100644 --- a/plugins/postgres/dbt/include/postgres/macros/relations.sql +++ b/plugins/postgres/dbt/include/postgres/macros/relations.sql @@ -22,7 +22,7 @@ from pg_class ), dependency as ( - select + select distinct pg_depend.objid as id, pg_depend.refobjid as ref from pg_depend