Skip to content

Commit 7f8c14c

Browse files
Update whats-eating-up-your-snowflake-warehouse-part-2.md
1 parent e55358b commit 7f8c14c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

whats-eating-up-your-snowflake-warehouse-part-2.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ select * from customers where full_name = 'Ali';
1212

1313
## match_recognize
1414

15-
Armed with `query_parameterized_hash` we will write a `match_recognize` query to identify queries that are getting worse progressively. Snowflake’s `MATCH_RECOGNIZE` clause can perform Pattern Matching over a set of rows. `MATCH_RECOGNIZE` does this by assigning labels to events, finding the events within an ordered partition, and pulling out any sequences that match the given pattern. In our case, we need a identify a sequence of execution of the same query where the execution time is increasing each time the query is executed.
15+
Armed with `query_parameterized_hash` we will write a [MATCH_RECOGNIZE](applied-overview-of-MATCH_RECOGNIZE-clause.md) query to identify queries that are getting worse progressively. Snowflake’s [MATCH_RECOGNIZE](applied-overview-of-MATCH_RECOGNIZE-clause.md) clause can perform Pattern Matching over a set of rows. [MATCH_RECOGNIZE](applied-overview-of-MATCH_RECOGNIZE-clause.md) does this by assigning labels to events, finding the events within an ordered partition, and pulling out any sequences that match the given pattern. In our case, we need a identify a sequence of execution of the same query where the execution time is increasing each time the query is executed.
1616

1717
### match_recognize SQL query
1818

19-
The following `match_recognize` can be used to identify queries that are progessively getting worse rapidly.
19+
The following [MATCH_RECOGNIZE](applied-overview-of-MATCH_RECOGNIZE-clause.md) can be used to identify queries that are progessively getting worse rapidly.
2020

2121
```sql
2222
with query_history as (
@@ -45,15 +45,15 @@ order by query_parameterized_hash, start_time asc;
4545
;
4646
```
4747

48-
The `MATCH_RECOGNIZE` clause has several different parts. The `DEFINE` part contains the variable definition, which can later be used in the other parts. We defined the following variables:
48+
The [MATCH_RECOGNIZE](applied-overview-of-MATCH_RECOGNIZE-clause.md) clause has several different parts. The `DEFINE` part contains the variable definition, which can later be used in the other parts. We defined the following variables:
4949

5050
1. `UPTREND` – We defined as the `execution_time_in_mins` greater than the previous execution of the same query. We are also ignoring small increases of 5% or less in execution times by multiplying by `1.05`.
5151

5252
The `pattern` we used is the following: `UPTREND{3,}$`
5353

5454
It means that we are looking for queries that whose execution time increased in progression 3 or more times, and the `$` indicates that latest execution time is also slower that the previous one
5555

56-
The above `match_recognize` query will produce the following output:
56+
The above [MATCH_RECOGNIZE](applied-overview-of-MATCH_RECOGNIZE-clause.md) query will produce the following output:
5757

5858
|query_parameterized_hash|query_text|execution_time_in_mins|start_time|
5959
|------------------------|----------|----------------------|----------|

0 commit comments

Comments
 (0)