Enhance query efficiency with Slingshot

If you’re working with cloud based data you’ve probably been asked, “Which queries ran most frequently last quarter?” The question seems simple on its face, but could be challenging to answer without proper analytical tools & appropriate visibility into query data. 

So how do you accurately determine your most frequently run queries? And, once you’ve done that, how do you further analyze them and unlock greater savings on compute spend associated with those queries? Queries are, after all, one of the key components to compute-spend in any Snowflake cloud. 

Capital One Slingshot makes it easy for any Snowflake admin to pinpoint and optimize frequent and costly queries in a few simple steps.

Step 1: Opt In for Query Autoloading

Customers have the option to review their costliest queries in a redacted format, to analyze their queries while protecting their data.

Manage Plan page with the Opt-in to Query autoloading in the center (currently opted out)

Manage plan page with the opt-in to query autoloading in the center (currently opted out)

Once enabled, Slingshot will synchronize your query data, including query text, for the current month and the past two months. This synchronization occurs daily. Even string parameters in queries, whether enclosed in single or double quotes, as well as file and stage paths, will be redacted.

For example:
WHERE X = 'Y'` becomes WHERE X = 'REDACTED'
WHERE X = 123456 becomes WHERE X = 0
SELECT IF(X = "Y", 1, 0) becomes SELECT IF(X = 'REDACTED', 0, 0)

Step 2: Identify the Most Frequently Run Costly Queries in Snowflake

Within the Slingshot UI, you can easily visualize the costliest queries and most frequently run queries and run them through the Query Advisor with a simple click. These queries are sorted by highest cost, which are aggregated from all query runs over the past two months and the current month. When a user clicks on "analyze," the query text is retrieved and assessed by Query Advisor to identify potential inefficiencies and provide suggestions on how to improve them.

Query advisor display, highlighting an opportunity for query adjustment.

Query advisor display, highlighting an opportunity for query adjustment.

Optimize queries to operate efficiently in the cloud

As your business grows and handles greater volumes of data in the cloud, efficient queries can become even more crucial to success and scalability. Optimized queries lead to faster decision making, cost savings and improved system performance. 

Learn more about inefficiencies in cloud data platforms and how to address them in our blog: Five data platform inefficiencies that limit business value.


Brian Chong, Director of Solutions Architecture, Capital One Software

Brian Chong is the Director of Solutions Architecture at Capital One Software. In this capacity, his primary responsibility is to ensure that customers derive the most value from Capital One Slingshot. Previously Brian spent five years at AWS, where he managed the Solutions Architecture team and played a pivotal role in assisting customers in the successful implementation of cloud technologies.

Related Content