Skip to content

Commit 305a305

Browse files
Update cost-per-query-in-snowflake-using-credits_attributed_compute-metric-in-query_attribution_history-view.md
1 parent eb5cc60 commit 305a305

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cost-per-query-in-snowflake-using-credits_attributed_compute-metric-in-query_attribution_history-view.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ This View can be joined with `QUERY_HISTORY` View using [query_parameterized_has
1515
```sql
1616
select
1717
query_parameterized_hash
18+
, query_history.warehouse_size
1819
, avg(credits_attributed_compute)
1920
, max(credits_attributed_compute)
2021
, min(credits_attributed_compute)
22+
, left(any_value(query_history.query_text), 80) as query_text
2123
from SNOWFLAKE.ACCOUNT_USAGE.QUERY_ATTRIBUTION_HISTORY
2224
inner join SNOWFLAKE.ACCOUNT_USAGE.query_history using (query_parameterized_hash)
2325
group by all;
26+
order by credits_attributed_compute desc;
2427
```
25-
|![carbon(8)](https://github.com/user-attachments/assets/3ca2007e-5650-4e1d-a0fb-8d2749ce1a6e)|
28+
29+
|![carbon(9)](https://github.com/user-attachments/assets/94d0b35d-e188-47bd-aa41-70c44b081831)|
2630
|:-:|
2731
|Using `query_parameterized_hash` to JOIN `QUERY_ATTRIBUTION_HISTORY` and `QUERY_HISTORY` |
2832

0 commit comments

Comments
 (0)