Tuning a Snowflake Database for Improved Performance and Cost Savings

Tuning a Snowflake Database for Improved Performance and Cost Savings

Moser Consulting was recently tasked with reducing costs and ensuring more consistent SLA compliance in a company's Snowflake environment. While Snowflake differs from traditional and other cloud databases, it is still a SQL-based database, and many of the same tuning techniques apply. However, understanding Snowflake's architecture is crucial, as it offers unique cost-saving opportunities not found in traditional databases.

Snowflake is arguably the most usage-based database on the market. Its pricing model, which charges based on compute usage at a minimum of one minute, is essential to comprehend for cost savings. As a database tuner, this is great news because poorly written queries will cost more in real dollars, making it easier to demonstrate return on investment (ROI) after optimization.

For example, the following two queries return the same result set. However, the first one uses a range search on date and the other uses a function on the data to return all June 2022 data. There is a significant performance difference between these two.

Traditional database tuning involves a combination of query tuning and index tuning. While index tuning is less relevant in Snowflake due to its data handling, query tuning remains crucial, and Snowflake introduces warehouse tuning as an additional factor.

Moser Consulting aimed to save money and more consistently meet SLAs for a client that loaded over 40 million rows of data daily from SQL Server. With a multi-phase approach, we identified several areas for improvement and conducted a series of tests to verify initial findings and determine the best way forward.

Our first win was to improve the performance of the heaviest queries, which also increased SLA consistency. The most significant cost-saving measure was reducing warehouse size, as they were over-provisioned, and the majority of data loading processes ran single-threaded. We were able to cut warehouse size in half, resulting 60% cost savings from the peak.

One common misconception about Snowflake is that it has auto-tuning and doesn't require query tuning. This is not true. To save money in Snowflake, it's crucial to understand that it's a true usage-based database, charging for the resources used for as long as they are used.

In conclusion, optimizing a Snowflake database involves understanding its unique architecture and pricing model. By focusing on query tuning and warehouse tuning, organizations can reduce costs and improve performance, ensuring more consistent SLA compliance.

Contact Moser Consulting for more information.

Andy Wickman

Seasoned technology leader with over 20 years of experience in the IT industry, has consistently demonstrated success in various leadership roles. With a strong background in databases and a proven track record of delivering projects on time, Andy has a keen ability to identify and execute corporate strategic goals.

A forward-thinking innovator known for strong problem-solving skills and unwavering work ethic, enable him to effectively manage multiple complex projects for a diverse range of customers. Extensive experience in the IT domain allows him to provide valuable insights and share his technical expertise with clients and senior management alike.

Andy’s ability to "coach up" staff, coupled with his strong business acumen and technical vision, have contributed to his success in improving processes across the board. His effective people skills have also made him a sought-after leader and collaborator in the industry.

In his technical blog posts, Andy shares his wealth of knowledge and experience, providing readers with valuable insights into the rapidly evolving world of technology and database management. As a self-motivated professional who requires minimal supervision, Andy continues to pave the way for innovation and progress in the IT sector.

Previous
Previous

Developing a Jira App: Design Consistency and Team Collaboration

Next
Next

Optimizing Storage Costs with Cloudflare R2 for Data Ingestion into Snowflake