Hello, need some help:wave: While monitoring query...
# community-support
k
Hello, need some help👋 While monitoring query execution in Snowflake, I noticed a particular query consuming a noticeable amount of time and compute:
Copy code
SELECT COUNT(*)
FROM {database}.INFORMATION_SCHEMA.schemata
WHERE UPPER(schema_name) = UPPER('elementary_schema')
  AND UPPER(catalog_name) = UPPER('elementary_database')
After investigating, I found this query only runs on the database where I enabled the Elementary package. I'd like to better understand what this query is doing and how it's being used within the Elementary OSS framework. • Is this part of a routine metadata check or schema validation? • Is it expected to run frequently? • Are there any best practices for minimizing its impact? Appreciate any insights or pointers! Thanks in advance 🙏
d
Yes, that query is part of the Elementary OSS package's metadata checks. Specifically, it's used to validate the existence of the
elementary_schema
in the
elementary_database
before proceeding with tasks like logging, test results storage, or report generation. It's essentially a lightweight schema existence check, and the use of
UPPER()
ensures case-insensitive matching across environments. It may run once per dbt invocation that leverages Elementary's features—e.g., during
dbt test
,
dbt run
, or when generating reports. You might have a very large account. Restricting roles and access scopes so metadata scans are limited to relevant objects may help.
k
Thank you @Daniel Halabe for providing insights on this issue. I will take some time to think through the process of restricted access, as our project is quite complex. We have a single dbt project that is executed against different databases, orchestrated through Airflow. I also noticed that the issue occurs only when I do
dbt build
. In our case, we do use
dbt build
, but the way our models are executed differs . Airflow runs each dbt model as a separate task. As a result, the number of task executions is quite high which is likely causing us to hit some limits. Additionally, restricting role-based access is challenging because the project references multiple schemas and databases but will see how i could work around this. Thanks again this was very helpful!