Get startedGet started for free

Query Performance in Snowflake

1. Query Performance in Snowflake

Hello again! Let's explore Snowflake's architecture and understand how we benefit from it. We'll discuss characteristics that make Snowflake stand out over other technologies to handle computationally demanding queries. Let's start.

2. Data storage

Understanding data storage and retrieval impacts query performance. Traditional databases often use a row-based model for writing and fetching complete records. Think of scanning a list top to bottom for details; that's row-based storage. For example, finding Mary's address requires checking each row, which can be time-consuming if we are looking for only specific data, such as the address, and not all of Mary's data.

3. Data storage (1)

One system that follows this model is PostgreSQL, a commonly used data storage and retrieval option that is a familiar point of comparison when we discuss Snowflake.

4. Data storage (2)

On the other hand, Snowflake uses a columnar storage approach, which is a game-changer for read performance, especially for analytical queries targeting specific data columns. Snowflake goes straight down the relevant column instead of scanning rows . So, when we need to know Mary's address, Snowflake can directly access the address column, making the process much faster and more efficient. This fundamental difference gives Snowflake an edge in delivering faster query results than traditional row-based systems like PostgreSQL.

5. Massively parallel processing

Snowflake has another significant advantage over traditional relational database management systems like PostgreSQL. Snowflake uses Massively Parallel Processing, or MPP, to manage and analyze large volumes of data with impressive speed. Massively Parallel Processing is the force behind Snowflake's exceptional performance, distributing data processing tasks across numerous servers in the cloud, all operating concurrently. This parallel approach significantly reduces query times, which is particularly beneficial for any data model we create that expects to handle data that is continuously expanding.

6. MPP's role in data storage

Snowflake's data storage is efficient due to micro-partitions. When data enters Snowflake, it's split into these small units. Each contains a tiny data subset, enabling effective large-volume processing. Snowflake accesses only the needed micro-partitions for queries, using a well-organized index for exact data location.

7. MPP's role in data storage (1)

In contrast, systems like PostgreSQL store data in larger blocks, less efficient for specific queries. For example, PostgreSQL might scan larger data sections for small subsets. This traditional storage method underscores Snowflake's edge in handling analytical queries on large datasets.

8. Visualizing query execution times

Let's look closer into executing a query on a large dataset with Snowflake. Its user interface shows detailed performance metrics of queries. When you run a query, Snowflake's UI displays the execution time in milliseconds, providing essential feedback for performance assessment and benchmarking against other systems. It also shows the number of rows returned, indicating the data volume processed. Moreover, Snowflake offers a Query Profile tool for a glance at the performance of your queries.

9. Visualizing query execution times (1)

You can reach it in the Query Details and select View Query Profile.

10. Visualizing query execution times (2)

The Query Profile is a powerful tool for visualizing and comprehending the execution process of our queries. We can see detailed statistics such as Input/Output, the amount of data processed, and more, which helps benchmark and report your query's performance. It's a straightforward way to identify your query's most resource-intensive parts and find potential optimization areas.

11. Terminology overview

Take note of the new terminology we have learned during this video.

12. Let's practice!

It is time to review what we have learned about query performance in Snowflake. Let's go!