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

Revert query_history_enriched script to original cost-per-query logic #35

Merged
merged 4 commits into from
Dec 13, 2024

Conversation

obashaw
Copy link
Collaborator

@obashaw obashaw commented Dec 13, 2024

This PR updates the cost-per-query calculation to use Select.dev's logic, rather than Snowflake's query_attribution_history view. It preserves the table structure of the most recent query_history_enriched script so that all previously-existing columns are present.

On Dec 11, a user noted that Snowflake's query_attribution_history was vastly undercounting the compute credits used when aggregated across warehouses and days. We were able to confirm this internally, and understand the source of the error to be the fact that query_attribution_history does not account for warehouse idle time (see Snowflake docs).

The calculations used in this version of the script tie out within a few percent of Snowflake's usage_in_currency_daily view.

@obashaw obashaw requested a review from pballai December 13, 2024 21:04
@pballai pballai merged commit d77cd25 into main Dec 13, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants