0
votes

I am looking at the queries performed against my warehouse and finding the credit calculation I'm using doesn't add up to what's being shown in snowflake. As I understand it, it is supposed to use credits per second of query time with a minimum of 60s. So if a query runs for 5s it would use 60s worth of credits, but if a query runs for 61s it will use 61s worth of credits.

Looking at the query history, limiting only to queries performed on my warehouse, I am only seeing 5 queries for the hour in question (12).

These queries copy their results into an S3 bucket in my AWS account.

query history

If I take the starts and ends of each of these queries and chart time, I am only seeing a total of 455 seconds of query time. With the X-Small warehouse that I'm using (1 credit per hour), that should be only 0.126 credits used for that hour.

enter image description here

But I am seeing 0.66 credits used here:

enter image description here

What am I missing about snowflake credit usage? Why does it appear that I am using more credits than I should?

1
Snowflake doesn't meter by query times. It meters by the sizes and times warehouses run. If you have a running warehouse with no active query, it's still on the meter. You may or may not want to have the warehouse suspend quickly when done with a query. The main reason to keep it running while waiting for another query is because it keeps its cache. I recommend discussing how Snowflake bills and usage considerations with your Sales Engineer. - Greg Pavlik
You have to consider the time your warehouse's nodes have been running, not the queries. And check what your warehouse's AUTO_SUSPEND option is set to - the lowest you can set it is 60 seconds btw. - Francesco Quaratino
@FrancescoQuaratino and Greg Pavlik - That makes more sense. We will try setting it to 60s and see how that affects query performance - micah

1 Answers

1
votes

Moving answer from comments to an actual answer (for completeness):

  • Snowflake costs don't reflect queries time, but warehouses being run.

AUTO_SUSPEND can be set to 60 seconds to match the desired behavior if desired.

https://docs.snowflake.com/en/user-guide/warehouses-considerations.html#how-are-credits-charged-for-warehouses