How to Stop Snowflake Serverless Compute From Melting Your Wallet: A Cheapskate’s Guide”

Igor Domrev
ITNEXT
Published in
2 min readApr 28, 2023

--

Photo by Zdeněk Macháček on Unsplash

Snowflake is a highly impressive database system that offers exceptional performance and a seamless developer experience. Nevertheless, the platform can become expensive at times, and its pricing structure can be somewhat bewildering. In this post, we will explore the intricacies of Snowflake’s billing breakdown and provide a few effortless techniques to help you reduce your Snowflake credits.

Snowflake pricing is based on Snowflake credits, which measure computing resources over time and can be charged for “Cloud” or “Compute” usage. In this post, we’ll explain everything you need to know. Let’s get started!

snowflake usage illustrating the Ukranian flag

When you open up your Snowflake usage breakdown and take a look at your credits used, you’ll see a handy visualization. Ideally, the yellow section will be much smaller than the blue section — unless, of course, you’re trying to create a Ukrainian flag with your Snowflake billing dashboard.

The blue section represents your “compute” credits, which are charged at a rate of 1 credit per active hour of your Snowflake cluster. Essentially, these are the credits you use when your cluster is up and running, doing heavy-duty work.

On the other hand, the yellow section represents your “cloud” credits. These are the credits you use for all the other Snowflake features and services that don’t require an active cluster. This includes things like data storage, data transfers, Snowflake’s web interface and Metadata queries.

  • PUT / COPY commands
  • select 1
  • BEGIN / COMMIT
  • METADATA QUERIES

While working on a project, I found metadata queries to be the costliest part. However, I came across a SQL snippet that helped me identify the queries and their associated costs in “CLOUD” credits. This information enabled me to optimize and reduce costs significantly. This SQL snippet is very handy.

The query that proved to be the most costly in my situation was deceptively simple-looking.

a very expensive query

A process that was reading from snowflake and writing to another database was executing this query for every sync job on every table it was running, in my case ~10K daily queries, which turned to cost around 6.5 snowflake “cloud” credits, DAILY , around 50% of all our snowflake daily usage ! The solution was to cache the result of this query, since we did not change the schema of our tables once created, we could cache the schema indefinitely and save precious credits that were wasted for nothing.

Summary

Beware of snowflake INFORMATION_SCHEMA its very expensive to access

--

--