Koushik Roy
Koushik Roy

Reputation: 7407

Snowflake - How the warehouse cost is calculated if multiple developers are using same warehouse simultaneously?

We have 10 developers working on snowflake. We have one small warehouse with neither clustering nor snowpark optimization. If all of them runs queries on snowflake simultaneously, will that increase the cost or queries will fail or will take more time because everyone sharing same warehouse CPU/Mem. What will it be?

Sorry if someone already answered or its an obvious answer.

Upvotes: 2

Views: 1318

Answers (3)

Simeon Pilgrim
Simeon Pilgrim

Reputation: 26078

Billing

You pay per second the warehouse is "turned on" (with a min spend of 1 minute).

The warehouse can be doing nothings, or running MAX_CONCURRENCY_LEVEL queries. You just pay for the warehouse being ON.

You also get billed for the "share services" of compiling those queries, or queries that do not need the warehouse to answer, but can be answered from the meta data. But you are also not billed for this time if it is less than 10% of your total warehouse seconds.

This is all billed in "credits"

Sharing

Many people can run queries at the same time, and the impacts those have on each other, extend to the dynamic nature of CPU load sharing, (not all long queries are CPU bound, eg when loading lots of data), and they share the Memory, which I have not ever noticed impacts of.. But they also share local data cache, so it's possible to have other queries to flush the cache.

But generally these things are not that observable. But if you trying to do check performance improvements are "real" then using a non-shared instance, can help.

Also sometime big instances can help for one off queries, and then one user making the instance bigger, or using an alternative instance for just that set of queries, can be super useful, as the billing is just the instance duration, thus two hours of working on a bigger instance is not blowing out the whole years budget..

Anyways Lukasz answer has the pages you should read to be familiar with the system.

Upvotes: 1

sprethepa
sprethepa

Reputation: 797

Warehouse cost is based on the warehouse uptime and does not depend on the queries submitted. For example, you will be charged a maximum of 1 Credit for an hour for a XSMALL warehouse if the warehouse is up and running and does not consider if there are queries executing or no queries at all.

https://docs.snowflake.com/en/user-guide/cost-understanding-compute.html#virtual-warehouse-credit-usage

Queries can fail due to reasons like reaching the waiters queue limit/timeout waiting for resources etc, basically queueing/failing based on the resource availability/timeout settings/query errors.

https://docs.snowflake.com/en/sql-reference/parameters.html#parameters

When a query is submitted, an estimation of the resource requirement happens and a query starts processing. During the runtime, if there is more need and the resources are completely used, the total execution time of the query may increase.

Upvotes: 1

Lukasz Szozda
Lukasz Szozda

Reputation: 176124

How Are Costs Incurred?:

Virtual Warehouse Compute

(...) Because Snowflake utilizes per-second billing (with a 60-second minimum each time the warehouse starts), warehouses are billed only for the credits they actually consume when they are actively working.

Virtual Warehouse Credit Usage

A virtual warehouse is one or more clusters of compute resources that enable executing queries, loading data, and performing other DML operations. Snowflake credits are used to pay for the processing time used by each virtual warehouse.

Snowflake credits are charged based on the number of virtual warehouses you use, how long they run, and their size.


If more than one query is executed at the same time(single warehouse), the MAX_CONCURRENCY_LEVEL determines how many queries could be executed before they started to be queued.

Upvotes: 2

Related Questions