The behavior when dbt issuing numerous SHOW OBJECTS IN <database>.<schema>
queries when interfacing with Snowflake—is a recognized concern, especially in projects with a large number of schemas. This approach can introduce significant overhead due to the sequential execution of these commands, each requiring a separate connection to Snowflake.
Optimization Strategies:
- Aggregate Object Retrieval:
- Current Behavior: dbt executes individual
SHOW OBJECTS
commands for each schema, which can be time-consuming in environments with many schemas. - Proposed Improvement: Modify dbt to retrieve all objects at the database level using a single
SHOW OBJECTS IN DATABASE
command, then filter the results for the relevant schemas locally. This method reduces the number of queries sent to Snowflake, thereby decreasing latency and computational overhead.
- Current Behavior: dbt executes individual
- Considerations: The
SHOW OBJECTS
command has a limit of returning a maximum of 10,000 records. In databases with a vast number of o