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

Add starts with to show objects like for performance boost #1094

Closed
wants to merge 3 commits into from

Conversation

aranke
Copy link
Member

@aranke aranke commented Jun 24, 2024

Problem

show objects is slow in large schemas where many objects match name (e.g., stg_metrics).

Solution

Add starts with to the end of the query to speed it up.
On ad-hoc testing, I'm seeing a 10x speed-up (2s → 0.2s).

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

@cla-bot cla-bot bot added the cla:yes label Jun 24, 2024
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the dbt-snowflake contributing guide.

@aranke aranke changed the title Add starts with to 'show objects like' for 7x performance boost Add starts with to 'show objects like' for performance boost Jun 24, 2024
@aranke aranke changed the title Add starts with to 'show objects like' for performance boost Add starts with to show objects like for performance boost Jun 24, 2024
@aranke
Copy link
Member Author

aranke commented Jun 25, 2024

False alarm, looks like the results are dependent on whether Snowflake is throttling metadata queries: https://community.snowflake.com/s/article/metadata-operations-throttling.

I don't think I can improve this macro further, closing this PR.

@aranke aranke closed this Jun 25, 2024
@aranke aranke deleted the show_object_metadata_starts_with branch June 25, 2024 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant