SlideShare uma empresa Scribd logo
1 de 92
Baixar para ler offline
Row Pattern Matching
@MarkusWinand
Image: 72hoursamericanpower.com
Row Pattern Matching Availability
1999
2001
2003
2005
2007
2009
2011
2013
2015
MariaDB
MySQL
PostgreSQL
SQLite
DB2 LUW
12cR1 Oracle
SQL Server
Grouping Consecutive Events
Time
30 minutes
Example: Logfile
Grouping Consecutive Events
Example: Logfile
Time
30 minutes
Session 1 Session 2
Session 3
Session 4
Example problems:
‣ Count sessions
‣ Average session duration
Two approaches:
‣ Start-of-group tagging
‣ Row pattern matching
SELECT	COUNT(grp_start)	groups	
		FROM	(SELECT	CASE	WHEN	ts	>	LAG(	ts,	1,	DATE'1900-01-01'	)	
																														OVER(	ORDER	BY	ts	)	
																														+	INTERVAL	'30'	minute	
																				THEN	1	
																END	grp_start	
										FROM	log	
							)	T
Consecutive Events: Counting Start-of-group tagging
Time
30 minutes
SELECT	COUNT(grp_start)	groups	
		FROM	(SELECT	CASE	WHEN	ts	>	LAG(	ts,	1,	DATE'1900-01-01'	)	
																														OVER(	ORDER	BY	ts	)	
																														+	INTERVAL	'30'	minute	
																				THEN	1	
																END	grp_start	
										FROM	log	
							)	T
Consecutive Events: Counting Start-of-group tagging
Time
30 minutes
count the

non-NULL

values
SELECT	COUNT(*)	sessions	
		FROM	log	
							MATCH_RECOGNIZE(	
								ORDER	BY	ts	
								PATTERN	(	new	)	
								DEFINE	new	AS	ts	>	COALESCE(	PREV(ts)	
																																			,	DATE	'1900-01-01'	
																																			)	
																											+	INTERVAL	'30'	minute		
							)	t
Consecutive Events: Counting Row Pattern Matching
Time
30 minutes
SELECT	COUNT(*)	sessions	
		FROM	log	
							MATCH_RECOGNIZE(	
								ORDER	BY	ts	
								PATTERN	(	new	)	
								DEFINE	new	AS	ts	>	COALESCE(	PREV(ts)	
																																			,	DATE	'1900-01-01'	
																																			)	
																											+	INTERVAL	'30'	minute		
							)	t
Consecutive Events: Counting Row Pattern Matching
Time
30 minutes
row pattern
variable
SELECT	COUNT(*)	sessions	
		FROM	log	
							MATCH_RECOGNIZE(	
								ORDER	BY	ts	
								PATTERN	(	new	)	
								DEFINE	new	AS	ts	>	COALESCE(	PREV(ts)	
																																			,	DATE	'1900-01-01'	
																																			)	
																											+	INTERVAL	'30'	minute		
							)	t
Consecutive Events: Counting Row Pattern Matching
Time
30 minutes
match

only “new”
rows
SELECT	COUNT(*)	sessions	
		FROM	log	
							MATCH_RECOGNIZE(	
								ORDER	BY	ts	
								PATTERN	(	new	)	
								DEFINE	new	AS	ts	>	COALESCE(	PREV(ts)	
																																			,	DATE	'1900-01-01'	
																																			)	
																											+	INTERVAL	'30'	minute		
							)	t
Consecutive Events: Counting Row Pattern Matching
Time
30 minutes
count

rows
SELECT	COUNT(*)	sessions	
					,	AVG(duration)	avg_duration	
		FROM	log	
							MATCH_RECOGNIZE(	
								ORDER	BY	ts	
								MEASURES	
									LAST(ts)	-	FIRST(ts)	AS	duration	
								ONE	ROW	PER	MATCH	
								PATTERN	(	new	cont*	)	
								DEFINE	cont	AS	ts	<	PREV(ts)	
																										+	INTERVAL	'30'	minute		
							)	t
Row Pattern MatchingConsecutive Events: Statistics
Time
30 minutes
define

continuation
Oracle doesn’t support avg on intervals — query doesn’t work as shown
SELECT	COUNT(*)	sessions	
					,	AVG(duration)	avg_duration	
		FROM	log	
							MATCH_RECOGNIZE(	
								ORDER	BY	ts	
								MEASURES	
									LAST(ts)	-	FIRST(ts)	AS	duration	
								ONE	ROW	PER	MATCH	
								PATTERN	(	new	cont*	)	
								DEFINE	cont	AS	ts	<	PREV(ts)	
																										+	INTERVAL	'30'	minute		
							)	t
Row Pattern MatchingConsecutive Events: Statistics
Time
30 minutes
undefined

pattern variable:
matches any row
Oracle doesn’t support avg on intervals — query doesn’t work as shown
SELECT	COUNT(*)	sessions	
					,	AVG(duration)	avg_duration	
		FROM	log	
							MATCH_RECOGNIZE(	
								ORDER	BY	ts	
								MEASURES	
									LAST(ts)	-	FIRST(ts)	AS	duration	
								ONE	ROW	PER	MATCH	
								PATTERN	(	new	cont*	)	
								DEFINE	cont	AS	ts	<	PREV(ts)	
																										+	INTERVAL	'30'	minute		
							)	t
Row Pattern MatchingConsecutive Events: Statistics
Time
30 minutes
any number

of “cont”

rows
Oracle doesn’t support avg on intervals — query doesn’t work as shown
SELECT	COUNT(*)	sessions	
					,	AVG(duration)	avg_duration	
		FROM	log	
							MATCH_RECOGNIZE(	
								ORDER	BY	ts	
								MEASURES	
									LAST(ts)	-	FIRST(ts)	AS	duration	
								ONE	ROW	PER	MATCH	
								PATTERN	(	new	cont*	)	
								DEFINE	cont	AS	ts	<	PREV(ts)	
																										+	INTERVAL	'30'	minute		
							)	t
Row Pattern MatchingConsecutive Events: Statistics
Time
30 minutes
Very much

like GROUP BY
Oracle doesn’t support avg on intervals — query doesn’t work as shown
SELECT	COUNT(*)	sessions	
					,	AVG(duration)	avg_duration	
		FROM	log	
							MATCH_RECOGNIZE(	
								ORDER	BY	ts	
								MEASURES	
									LAST(ts)	-	FIRST(ts)	AS	duration	
								ONE	ROW	PER	MATCH	
								PATTERN	(	new	cont*	)	
								DEFINE	cont	AS	ts	<	PREV(ts)	
																										+	INTERVAL	'30'	minute		
							)	t
Row Pattern MatchingConsecutive Events: Statistics
Time
30 minutes
Very much

like SELECT
Oracle doesn’t support avg on intervals — query doesn’t work as shown
SELECT	COUNT(*)	sessions	
					,	AVG(duration)	avg_duration	
		FROM	log	
							MATCH_RECOGNIZE(	
								ORDER	BY	ts	
								MEASURES	
									LAST(ts)	-	FIRST(ts)	AS	duration	
								ONE	ROW	PER	MATCH	
								PATTERN	(	new	cont*	)	
								DEFINE	cont	AS	ts	<	PREV(ts)	
																										+	INTERVAL	'30'	minute		
							)	t
Row Pattern MatchingConsecutive Events: Statistics
Time
30 minutes
Oracle doesn’t support avg on intervals — query doesn’t work as shown
Consecutive Events: Statistics Start-of-group tagging
Time
30 minutes
Now, let’s try using window functions
SELECT	count(*)	sessions,	avg(duration)	avg_duration	
		FROM	(SELECT	MAX(ts)	-	MIN(ts)	duration	
										FROM	(SELECT	ts,	COUNT(grp_start)	OVER(ORDER	BY	ts)	session_no	
																		FROM	(SELECT	ts,	CASE	WHEN	ts	>=	LAG(	ts,	1,	DATE’1900-01-1'	)	
																																																			OVER(	ORDER	BY	ts	)	
																																																			+	INTERVAL	'30'	minute	
																																								THEN	1	
																																				END	grp_start	
																										FROM	log	
																							)	tagged	
															)	numbered	
									GROUP	BY	session_no	
							)	grouped
Consecutive Events: Statistics Start-of-group tagging
Time
30 minutes
Start-of-group
tags
SELECT	count(*)	sessions,	avg(duration)	avg_duration	
		FROM	(SELECT	MAX(ts)	-	MIN(ts)	duration	
										FROM	(SELECT	ts,	COUNT(grp_start)	OVER(ORDER	BY	ts)	session_no	
																		FROM	(SELECT	ts,	CASE	WHEN	ts	>=	LAG(	ts,	1,	DATE’1900-01-1'	)	
																																																			OVER(	ORDER	BY	ts	)	
																																																			+	INTERVAL	'30'	minute	
																																								THEN	1	
																																				END	grp_start	
																										FROM	log	
																							)	tagged	
															)	numbered	
									GROUP	BY	session_no	
							)	grouped
Consecutive Events: Statistics Start-of-group tagging
Time
30 minutes
number
sessions
2222 2 33 3 44 42 3 4
1
SELECT	count(*)	sessions,	avg(duration)	avg_duration	
		FROM	(SELECT	MAX(ts)	-	MIN(ts)	duration	
										FROM	(SELECT	ts,	COUNT(grp_start)	OVER(ORDER	BY	ts)	session_no	
																		FROM	(SELECT	ts,	CASE	WHEN	ts	>=	LAG(	ts,	1,	DATE’1900-01-1'	)	
																																																			OVER(	ORDER	BY	ts	)	
																																																			+	INTERVAL	'30'	minute	
																																								THEN	1	
																																				END	grp_start	
																										FROM	log	
																							)	tagged	
															)	numbered	
									GROUP	BY	session_no	
							)	grouped
Consecutive Events: Statistics Start-of-group tagging
Time
30 minutes 2222 2 33 3 44 42 3 4
1
SELECT	count(*)	sessions,	avg(duration)	avg_duration	
		FROM	(SELECT	MAX(ts)	-	MIN(ts)	duration	
										FROM	(SELECT	ts,	COUNT(grp_start)	OVER(ORDER	BY	ts)	session_no	
																		FROM	(SELECT	ts,	CASE	WHEN	ts	>=	LAG(	ts,	1,	DATE’1900-01-1'	)	
																																																			OVER(	ORDER	BY	ts	)	
																																																			+	INTERVAL	'30'	minute	
																																								THEN	1	
																																				END	grp_start	
																										FROM	log	
																							)	tagged	
															)	numbered	
									GROUP	BY	session_no	
							)	grouped
Consecutive Events: Statistics Start-of-group tagging
Time
30 minutes
4 Levels:
2 with window functions
2 for grouping


What about performance?
2222 2 33 3 44 42 3 4
1
Tolerating Gaps
Example: Comments (new vs. read)
Tolerating Gaps
Example: Comments (new vs. read)
Show comments which…
‣ …are new or
‣ …between two new ones

(show the comment instead of a “load more” button)
Two approaches:
‣ Start-of-group tagging
‣ Row pattern matching
Comments
new commentread comment
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	new+	(read	new+)*	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps Row Pattern Matching
Comments
Start with one

or more NEW

comment(s)
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	new+	(read	new+)*	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps Row Pattern Matching
Comments
Start with one

or more NEW

comment(s)
Doesn’t match
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	new+	(read	new+)*	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps Row Pattern Matching
Comments
Start with one

or more NEW

comment(s)
Two rows
match “new+”
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	new+	(read	new+)*	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps Row Pattern Matching
Comments
Match exactly

one row (any)
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	new+	(read	new+)*	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps Row Pattern Matching
Comments
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	new+	(read	new+)*	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps Row Pattern Matching
Comments
Repeat group

any number

of times
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	new+	(read	new+)*	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps Row Pattern Matching
Comments
Repeat group

any number

of times
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	new+	(read	new+)*	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps Row Pattern Matching
Comments
First match
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	new+	(read	new+)*	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps Row Pattern Matching
CommentsSecond

match
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	new+	(read	new+)*	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps Row Pattern Matching
Comments
Tolerating Gaps (also first/last) Row Pattern Matching
Comments
What about
this?
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	(^read)?	new+	(read	new+)*	(read$)?	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	thread_id,	id
Tolerating Gaps (also first/last) Row Pattern Matching
Comments
What about
this?
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	(^read)?	new+	(read	new+)*	(read$)?	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	thread_id,	id
Tolerating Gaps (also first/last) Row Pattern Matching
Comments
Match

“read” at the very

beginning
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	(^read)?	new+	(read	new+)*	(read$)?	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	thread_id,	id
Tolerating Gaps (also first/last) Row Pattern Matching
Comments
Optionally match

“read” at the very

beginning
SELECT	id,	marker	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	(^read)?	new+	(read	new+)*	(read$)?	)	
								DEFINE	
									new	AS	(marker	=	'X')	
							)	T	
ORDER	BY	thread_id,	id
Tolerating Gaps (also first/last) Row Pattern Matching
Comments
Tolerating Gaps lead & lag
Comments
Now, let’s try using window functions
SELECT	t.*	
		FROM	(SELECT	msg.*	
													,	LAG	(	marker,	1,	'X'	)	OVER(	ORDER	BY	id	)	prev_marker	
													,	LEAD(	marker,	1,	'X'	)	OVER(	ORDER	BY	id	)	next_marker	
										FROM	msg	
							)	t	
WHERE	marker	=	'X'	
			OR	(prev_marker	=	'X'	and	next_marker	=	‘X')	
ORDER	BY	id
Tolerating Gaps lead & lag
Comments
I don't care what anything was designed to do,
I care about what it can do.
—Apollo 13, Universal Pictures
Tolerating Gaps (with grouped gaps) Row Pattern Matching
Comments
Tolerating Gaps (with grouped gaps) Row Pattern Matching
Comments
Load 2 more Load 9 more
Tolerating Gaps (with grouped gaps) Row Pattern Matching
Comments
Load 2 more Load 9 more
Tell me how many rows you skipped in between
SELECT	id,	marker,	gap_length	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								MEASURES	
										FINAL	COUNT(more.*)	AS	gap_length	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	(^read)?	new+	(read	new+)*	(read$)?	|	more	{-	more*	-}	)	
								DEFINE	new		AS	(marker		=	'X'),	
															more	AS	(marker	!=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps (with grouped gaps) Row Pattern Matching
Comments
Load 2 more Load 9 more
SELECT	id,	marker,	gap_length	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								MEASURES	
										FINAL	COUNT(more.*)	AS	gap_length	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	(^read)?	new+	(read	new+)*	(read$)?	|	more	{-	more*	-}	)	
								DEFINE	new		AS	(marker		=	'X'),	
															more	AS	(marker	!=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps (with grouped gaps) Row Pattern Matching
Comments
Load 2 more Load 9 more
Alternative
Match, but
don’t return
SELECT	id,	marker,	gap_length	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								MEASURES	
										FINAL	COUNT(more.*)	AS	gap_length	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	(^read)?	new+	(read	new+)*	(read$)?	|	more	{-	more*	-}	)	
								DEFINE	new		AS	(marker		=	'X'),	
															more	AS	(marker	!=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps (with grouped gaps) Row Pattern Matching
Comments
Load 2 more Load 9 more
Consider

all rows
SELECT	id,	marker,	gap_length	
		FROM	msg	
							MATCH_RECOGNIZE	(	
								ORDER	BY	id	
								MEASURES	
										FINAL	COUNT(more.*)	AS	gap_length	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	(^read)?	new+	(read	new+)*	(read$)?	|	more	{-	more*	-}	)	
								DEFINE	new		AS	(marker		=	'X'),	
															more	AS	(marker	!=	'X')	
							)	T	
ORDER	BY	id
Tolerating Gaps (with grouped gaps) Row Pattern Matching
Comments
Load 2 more Load 9 more
Only rows
matched to the
pattern variable
“more”
SELECT	id,	marker	
													,	CASE	WHEN	marker	!=	'X'	AND	gap_length	>	2	
																				THEN	gap_length	
																END	gap_length	
										FROM	(SELECT	t2.*,	COUNT(	CASE	WHEN	marker	!=	'X'	THEN	1	END	)	
																														OVER(	PARTITION	BY	new_counter	)	gap_length			
																		FROM	(SELECT	msg.*,	COUNT(	CASE	WHEN	marker	=	'X'	THEN	1	END	)	
																																							OVER(	ORDER	BY	id	)	new_counter	
																																				,	LAG		(	marker,	1,	'X'	)	
																																							OVER(	ORDER	BY	id	)	prev_marker	
																										FROM	msg	
																							)	t2	
															)	t3	
									WHERE	marker	=	'X'	OR	gap_length	=	1	OR	prev_marker=	'X'	
									ORDER	BY	id
Start-of-group taggingTolerating Gaps (with grouped gaps)
Comments
Top-N Per Group
Example: List 3 most recent comments per topic
Top-N Per Group
Example: List 3 most recent comments per topic
Time
Topic 3
Topic 2
Topic 1
Top-N Per Group
Example: List 3 most recent comments per topic
Three approaches:
‣ lateral sub-query (requires specific indexing)
‣ Row pattern matching (requires 12c)
‣ row_number() window function
Time
Topic 3
Topic 2
Topic 1
SELECT	*	
		FROM	t	
							MATCH_RECOGNIZE(	
								PARTITION	BY	topic	
								ORDER	BY	val	
								MEASURES	
									RUNNING	COUNT(*)	AS	rn	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	^a{1,3}	)	
								DEFINE	
									a	AS	1=1	
							)
Time
Topic 3
Topic 2
Topic 1
Top-N Per Group
per “topic”
processing
SELECT	*	
		FROM	t	
							MATCH_RECOGNIZE(	
								PARTITION	BY	topic	
								ORDER	BY	val	
								MEASURES	
									RUNNING	COUNT(*)	AS	rn	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	^a{1,3}	)	
								DEFINE	
									a	AS	1=1	
							)
Time
Topic 3
Topic 2
Topic 1
Top-N Per Group
Consider rows
up till current
row
SELECT	*	
		FROM	t	
							MATCH_RECOGNIZE(	
								PARTITION	BY	topic	
								ORDER	BY	val	
								MEASURES	
									RUNNING	COUNT(*)	AS	rn	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	^a{1,3}	)	
								DEFINE	
									a	AS	1=1	
							)
Time
Topic 3
Topic 2
Topic 1
Top-N Per Group
1, 2, or 3 times
SELECT	*	
		FROM	t	
							MATCH_RECOGNIZE(	
								PARTITION	BY	topic	
								ORDER	BY	val	
								MEASURES	
									RUNNING	COUNT(*)	AS	rn	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	^a{1,3}	)	
								DEFINE	
									a	AS	1=1	
							)
Time
Topic 3
Topic 2
Topic 1
Top-N Per Group
DEFINE is
non-optional:
Use dummy
SELECT	*	
		FROM	t	
							MATCH_RECOGNIZE(	
								PARTITION	BY	topic	
								ORDER	BY	val	
								MEASURES	
									RUNNING	COUNT(*)	AS	rn	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	^a{1,3}	)	
								DEFINE	
									a	AS	1=1	
							)
SELECT	*		
		FROM	(	
			SELECT	t.*	
								,	ROW_NUMBER()	
											OVER	(PARTITION	BY	topic	
																	ORDER	BY	val)	rn	
				FROM	t	
		)	t	
	WHERE	rn	<=	3
Time
Topic 3
Topic 2
Topic 1
Top-N Per Group
SELECT	*	
		FROM	t	
							MATCH_RECOGNIZE(	
								PARTITION	BY	topic	
								ORDER	BY	val	
								MEASURES	
									RUNNING	COUNT(*)	AS	rn	
								ALL	ROWS	PER	MATCH	
								PATTERN	(	^a+	)	
								DEFINE	
									a	AS	count(*)	<=	3	
							)
SELECT	*		
		FROM	(	
			SELECT	t.*	
								,	ROW_NUMBER()	
											OVER	(PARTITION	BY	topic	
																	ORDER	BY	val)	rn	
				FROM	t	
		)	t	
	WHERE	rn	<=	3
Time
Topic 3
Topic 2
Topic 1
Top-N Per Group
Always
RUNNING
semantic
Time Intervals (non-overlapping)
Example: Bookings are stored as [begin; end[ intervals
Time Intervals (non-overlapping)
Example: Bookings are stored as [begin; end[ intervals
Two problems:
‣ Find free time-slots
‣ Close free time-slots
Time
Busy Busy Busy
Time
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
Time Intervals (non-overlapping)
Time
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
a b
Time Intervals (non-overlapping)
Time
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
a b
Time Intervals (non-overlapping)
Time
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
a b
Time Intervals (non-overlapping)
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
a b
Time Intervals (non-overlapping)
Time
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
a b
Time Intervals (non-overlapping)
Time
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
a b
Time Intervals (non-overlapping)
Time
Default is to

continue AFTER

last matched row
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
Time Intervals (non-overlapping)
Time
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
Time Intervals (non-overlapping)
Time
a b
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
Time Intervals (non-overlapping)
a b
Time
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
Time Intervals (non-overlapping)
Time
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
Time Intervals (non-overlapping)
Time
SELECT	*	
		FROM	reservations	
							MATCH_RECOGNIZE(	
								ORDER	BY	begin	
								MEASURES	
									a.end			AS	begin,	
									b.begin	AS	end	
								ONE	ROW	PER	MATCH	
								AFTER	MATCH	SKIP	TO	b	
								PATTERN	(	a	b	)	
								DEFINE	
									b	AS	a.end	<	begin	
							)
Time Intervals (non-overlapping)
Time
SELECT	*	
		FROM	(SELECT	end	begin	
													,	LEAD(begin)	
															OVER(ORDER	BY	begin)	end	
										FROM	reservations	
							)	
	WHERE	begin	<	end
Row Pattern Matching
Time
Time Intervals (close gaps)
SELECT	b	begin,	e	end,	type	
		FROM	reservations	MATCH_RECOGNIZE(	
																						ORDER	BY	begin	
																						MEASURES	CASE	WHEN	free.begin	IS	NULL	THEN	busy.begin	
																																																												ELSE	busy.end	
																																END	AS	b	
																														,	COALESCE(free.begin,	busy.end)	AS	e	
																														,	CLASSIFIER()	as	type	
																						ALL	ROWS	PER	MATCH	
																						AFTER	MATCH	SKIP	TO	NEXT	ROW	
																						PATTERN	(	busy	free?	)	
																						DEFINE	free	AS	begin	>	PREV(end)	
																				)
Row Pattern Matching
Time
Time Intervals (close gaps)
Always match

one row. Second only

if there is a gap
Busy Free
SELECT	b	begin,	e	end,	type	
		FROM	reservations	MATCH_RECOGNIZE(	
																						ORDER	BY	begin	
																						MEASURES	CASE	WHEN	free.begin	IS	NULL	THEN	busy.begin	
																																																												ELSE	busy.end	
																																END	AS	b	
																														,	COALESCE(free.begin,	busy.end)	AS	e	
																														,	CLASSIFIER()	as	type	
																						ALL	ROWS	PER	MATCH	
																						AFTER	MATCH	SKIP	TO	NEXT	ROW	
																						PATTERN	(	busy	free?	)	
																						DEFINE	free	AS	begin	>	PREV(end)	
																				)
Row Pattern Matching
Time
Time Intervals (close gaps)
Busy Free
SELECT	b	begin,	e	end,	type	
		FROM	reservations	MATCH_RECOGNIZE(	
																						ORDER	BY	begin	
																						MEASURES	CASE	WHEN	free.begin	IS	NULL	THEN	busy.begin	
																																																												ELSE	busy.end	
																																END	AS	b	
																														,	COALESCE(free.begin,	busy.end)	AS	e	
																														,	CLASSIFIER()	as	type	
																						ALL	ROWS	PER	MATCH	
																						AFTER	MATCH	SKIP	TO	NEXT	ROW	
																						PATTERN	(	busy	free?	)	
																						DEFINE	free	AS	begin	>	PREV(end)	
																				)
Row Pattern Matching
Time
Time Intervals (close gaps)
Busy Free
If it is not a

“free” row, pass

row through
SELECT	b	begin,	e	end,	type	
		FROM	reservations	MATCH_RECOGNIZE(	
																						ORDER	BY	begin	
																						MEASURES	CASE	WHEN	free.begin	IS	NULL	THEN	busy.begin	
																																																												ELSE	busy.end	
																																END	AS	b	
																														,	COALESCE(free.begin,	busy.end)	AS	e	
																														,	CLASSIFIER()	as	type	
																						ALL	ROWS	PER	MATCH	
																						AFTER	MATCH	SKIP	TO	NEXT	ROW	
																						PATTERN	(	busy	free?	)	
																						DEFINE	free	AS	begin	>	PREV(end)	
																				)
Row Pattern MatchingTime Intervals (close gaps)
Busy Free
Time
SELECT	b	begin,	e	end,	type	
		FROM	reservations	MATCH_RECOGNIZE(	
																						ORDER	BY	begin	
																						MEASURES	CASE	WHEN	free.begin	IS	NULL	THEN	busy.begin	
																																																												ELSE	busy.end	
																																END	AS	b	
																														,	COALESCE(free.begin,	busy.end)	AS	e	
																														,	CLASSIFIER()	as	type	
																						ALL	ROWS	PER	MATCH	
																						AFTER	MATCH	SKIP	TO	NEXT	ROW	
																						PATTERN	(	busy	free?	)	
																						DEFINE	free	AS	begin	>	PREV(end)	
																				)
Row Pattern MatchingTime Intervals (close gaps)
Busy Free
Time
Free
SELECT	b	begin,	e	end,	type	
		FROM	reservations	MATCH_RECOGNIZE(	
																						ORDER	BY	begin	
																						MEASURES	CASE	WHEN	free.begin	IS	NULL	THEN	busy.begin	
																																																												ELSE	busy.end	
																																END	AS	b	
																														,	COALESCE(free.begin,	busy.end)	AS	e	
																														,	CLASSIFIER()	as	type	
																						ALL	ROWS	PER	MATCH	
																						AFTER	MATCH	SKIP	TO	NEXT	ROW	
																						PATTERN	(	busy	free?	)	
																						DEFINE	free	AS	begin	>	PREV(end)	
																				)
Row Pattern MatchingTime Intervals (close gaps)
Busy Free
Time
Free
SELECT	b	begin,	e	end,	type	
		FROM	reservations	MATCH_RECOGNIZE(	
																						ORDER	BY	begin	
																						MEASURES	CASE	WHEN	free.begin	IS	NULL	THEN	busy.begin	
																																																												ELSE	busy.end	
																																END	AS	b	
																														,	COALESCE(free.begin,	busy.end)	AS	e	
																														,	CLASSIFIER()	as	type	
																						ALL	ROWS	PER	MATCH	
																						AFTER	MATCH	SKIP	TO	NEXT	ROW	
																						PATTERN	(	busy	free?	)	
																						DEFINE	free	AS	begin	>	PREV(end)	
																				)
Row Pattern MatchingTime Intervals (close gaps)
Busy
Time
Free
SELECT	b	begin,	e	end,	type	
		FROM	reservations	MATCH_RECOGNIZE(	
																						ORDER	BY	begin	
																						MEASURES	CASE	WHEN	free.begin	IS	NULL	THEN	busy.begin	
																																																												ELSE	busy.end	
																																END	AS	b	
																														,	COALESCE(free.begin,	busy.end)	AS	e	
																														,	CLASSIFIER()	as	type	
																						ALL	ROWS	PER	MATCH	
																						AFTER	MATCH	SKIP	TO	NEXT	ROW	
																						PATTERN	(	busy	free?	)	
																						DEFINE	free	AS	begin	>	PREV(end)	
																				)
Row Pattern MatchingTime Intervals (close gaps)
Busy
Time
Busy FreeFree
SELECT	b	begin,	e	end,	type	
		FROM	reservations	MATCH_RECOGNIZE(	
																						ORDER	BY	begin	
																						MEASURES	CASE	WHEN	free.begin	IS	NULL	THEN	busy.begin	
																																																												ELSE	busy.end	
																																END	AS	b	
																														,	COALESCE(free.begin,	busy.end)	AS	e	
																														,	CLASSIFIER()	as	type	
																						ALL	ROWS	PER	MATCH	
																						AFTER	MATCH	SKIP	TO	NEXT	ROW	
																						PATTERN	(	busy	free?	)	
																						DEFINE	free	AS	begin	>	PREV(end)	
																				)
Row Pattern MatchingTime Intervals (close gaps)
Busy Busy FreeFree
Time
Free
SELECT	b	begin,	e	end,	type	
		FROM	reservations	MATCH_RECOGNIZE(	
																						ORDER	BY	begin	
																						MEASURES	CASE	WHEN	free.begin	IS	NULL	THEN	busy.begin	
																																																												ELSE	busy.end	
																																END	AS	b	
																														,	COALESCE(free.begin,	busy.end)	AS	e	
																														,	CLASSIFIER()	as	type	
																						ALL	ROWS	PER	MATCH	
																						AFTER	MATCH	SKIP	TO	NEXT	ROW	
																						PATTERN	(	busy	free?	)	
																						DEFINE	free	AS	begin	>	PREV(end)	
																				)
Row Pattern MatchingTime Intervals (close gaps)
Busy BusyFree
Time
Free Busy
SELECT	begin,	end,	type	
		FROM	(SELECT	end	begin	
													,	LEAD(begin)	OVER(ORDER	BY	begin)	end	
													,	'FREE'	type	
										FROM	reservations	
							)	
	WHERE	begin	<	end	
	UNION	ALL	
SELECT	begin	
					,	end	
					,	'BUSY'	type	
		FROM	reservations
Busy BusyFree
Time
Free Busy
Time Intervals (close gaps) Window function
Endless possibilitesRow Pattern Matching
GROUP	BY

			➡	ONE	ROW	PER	MATCH
OVER	()

			➡	ALL	ROWS	PER	MATCH,	FINAL,	RUNNING
HAVING,	WHERE

			➡	PATTERN (unmatched, suppressed {-	…	-})
Mixing GROUP	BY and OVER()

			➡	ALL	ROWS	PER	MATCH + all-but-one rows suppressed
Data-driven match length 

			➡ SUM, COUNT, … in DEFINE
Duplicating rows (to some extend)

			➡ ALL	ROWS	PER	MATCH + AFTER	MATCH	SKIP	TO	…
What if I told you,
you can also
find patterns?
Not/Barely covered in this presentationRow Pattern Matching
‣ Reluctant (non-greedy) matching
‣ SHOW/OMIT	EMPTY	MATCHES

WITH	UNMATCHED	ROWS
‣ SUBSET (define pattern-vars for use in MEASURES,

							DEFINE and AFTER	MATCH	SKIP	TO)
‣ PREV, NEXT, FIRST, LAST (with some nesting!)
‣MATCH_NUMBER()
Obstacles and Issues (as of 12r1)Row Pattern Matching
‣ JDBC !!!!!

Tokens ?, {, } have special meaning in JDBC.

You have to escape them using {	...	}

https://docs.oracle.com/database/121/JJDBC/apxref.htm#CHECHCJH
‣ ORA-62513: Quantified subpatterns that can have empty matches are not yet supported



PATTERN	(	x	(a*	b*)+	y	)
‣ ORA-62512: This aggregate is not yet supported in MATCH_RECOGNIZE clause.

(only COUNT, SUM, AVG, MIN, and MAX)
About @MarkusWinand
‣Training for Developers
‣ SQL Performance (Indexing)
‣ Modern SQL
‣ On-Site or Online
‣SQL Tuning
‣ Index-Redesign
‣ Query Improvements
‣ On-Site or Online
http://winand.at/
About @MarkusWinand
€0,-
€10-30
sql-performance-explained.com
About @MarkusWinand
@ModernSQL
http://modern-sql.com

Mais conteúdo relacionado

Mais procurados

Common Strategies for Improving Performance on Your Delta Lakehouse
Common Strategies for Improving Performance on Your Delta LakehouseCommon Strategies for Improving Performance on Your Delta Lakehouse
Common Strategies for Improving Performance on Your Delta LakehouseDatabricks
 
Introduction to apache spark
Introduction to apache spark Introduction to apache spark
Introduction to apache spark Aakashdata
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuningelliando dias
 
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLTop 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLJim Mlodgenski
 
Physical Plans in Spark SQL
Physical Plans in Spark SQLPhysical Plans in Spark SQL
Physical Plans in Spark SQLDatabricks
 
Cassandra internals
Cassandra internalsCassandra internals
Cassandra internalsnarsiman
 
Optimizing Delta/Parquet Data Lakes for Apache Spark
Optimizing Delta/Parquet Data Lakes for Apache SparkOptimizing Delta/Parquet Data Lakes for Apache Spark
Optimizing Delta/Parquet Data Lakes for Apache SparkDatabricks
 
The Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization OpportunitiesThe Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization OpportunitiesDatabricks
 
Introduction to PySpark
Introduction to PySparkIntroduction to PySpark
Introduction to PySparkRussell Jurney
 
Introducing the eDB360 Tool
Introducing the eDB360 ToolIntroducing the eDB360 Tool
Introducing the eDB360 ToolCarlos Sierra
 
How We Optimize Spark SQL Jobs With parallel and sync IO
How We Optimize Spark SQL Jobs With parallel and sync IOHow We Optimize Spark SQL Jobs With parallel and sync IO
How We Optimize Spark SQL Jobs With parallel and sync IODatabricks
 
Processing Large Data with Apache Spark -- HasGeek
Processing Large Data with Apache Spark -- HasGeekProcessing Large Data with Apache Spark -- HasGeek
Processing Large Data with Apache Spark -- HasGeekVenkata Naga Ravi
 
Simplify CDC Pipeline with Spark Streaming SQL and Delta Lake
Simplify CDC Pipeline with Spark Streaming SQL and Delta LakeSimplify CDC Pipeline with Spark Streaming SQL and Delta Lake
Simplify CDC Pipeline with Spark Streaming SQL and Delta LakeDatabricks
 
Modern SQL in Open Source and Commercial Databases
Modern SQL in Open Source and Commercial DatabasesModern SQL in Open Source and Commercial Databases
Modern SQL in Open Source and Commercial DatabasesMarkus Winand
 
Parquet performance tuning: the missing guide
Parquet performance tuning: the missing guideParquet performance tuning: the missing guide
Parquet performance tuning: the missing guideRyan Blue
 
Change Data Capture to Data Lakes Using Apache Pulsar and Apache Hudi - Pulsa...
Change Data Capture to Data Lakes Using Apache Pulsar and Apache Hudi - Pulsa...Change Data Capture to Data Lakes Using Apache Pulsar and Apache Hudi - Pulsa...
Change Data Capture to Data Lakes Using Apache Pulsar and Apache Hudi - Pulsa...StreamNative
 

Mais procurados (20)

Common Strategies for Improving Performance on Your Delta Lakehouse
Common Strategies for Improving Performance on Your Delta LakehouseCommon Strategies for Improving Performance on Your Delta Lakehouse
Common Strategies for Improving Performance on Your Delta Lakehouse
 
Introduction to apache spark
Introduction to apache spark Introduction to apache spark
Introduction to apache spark
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuning
 
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLTop 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
 
Intro to Apache Spark
Intro to Apache SparkIntro to Apache Spark
Intro to Apache Spark
 
Physical Plans in Spark SQL
Physical Plans in Spark SQLPhysical Plans in Spark SQL
Physical Plans in Spark SQL
 
Postgresql tutorial
Postgresql tutorialPostgresql tutorial
Postgresql tutorial
 
Cassandra internals
Cassandra internalsCassandra internals
Cassandra internals
 
Optimizing Delta/Parquet Data Lakes for Apache Spark
Optimizing Delta/Parquet Data Lakes for Apache SparkOptimizing Delta/Parquet Data Lakes for Apache Spark
Optimizing Delta/Parquet Data Lakes for Apache Spark
 
The Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization OpportunitiesThe Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization Opportunities
 
Introduction to PySpark
Introduction to PySparkIntroduction to PySpark
Introduction to PySpark
 
Introducing the eDB360 Tool
Introducing the eDB360 ToolIntroducing the eDB360 Tool
Introducing the eDB360 Tool
 
How We Optimize Spark SQL Jobs With parallel and sync IO
How We Optimize Spark SQL Jobs With parallel and sync IOHow We Optimize Spark SQL Jobs With parallel and sync IO
How We Optimize Spark SQL Jobs With parallel and sync IO
 
Processing Large Data with Apache Spark -- HasGeek
Processing Large Data with Apache Spark -- HasGeekProcessing Large Data with Apache Spark -- HasGeek
Processing Large Data with Apache Spark -- HasGeek
 
Simplify CDC Pipeline with Spark Streaming SQL and Delta Lake
Simplify CDC Pipeline with Spark Streaming SQL and Delta LakeSimplify CDC Pipeline with Spark Streaming SQL and Delta Lake
Simplify CDC Pipeline with Spark Streaming SQL and Delta Lake
 
Modern SQL in Open Source and Commercial Databases
Modern SQL in Open Source and Commercial DatabasesModern SQL in Open Source and Commercial Databases
Modern SQL in Open Source and Commercial Databases
 
Deep Dive on Amazon Redshift
Deep Dive on Amazon RedshiftDeep Dive on Amazon Redshift
Deep Dive on Amazon Redshift
 
Parquet performance tuning: the missing guide
Parquet performance tuning: the missing guideParquet performance tuning: the missing guide
Parquet performance tuning: the missing guide
 
Apache Spark Overview
Apache Spark OverviewApache Spark Overview
Apache Spark Overview
 
Change Data Capture to Data Lakes Using Apache Pulsar and Apache Hudi - Pulsa...
Change Data Capture to Data Lakes Using Apache Pulsar and Apache Hudi - Pulsa...Change Data Capture to Data Lakes Using Apache Pulsar and Apache Hudi - Pulsa...
Change Data Capture to Data Lakes Using Apache Pulsar and Apache Hudi - Pulsa...
 

Destaque

Harnessing the Power of Optimizer Hints
Harnessing the Power of Optimizer HintsHarnessing the Power of Optimizer Hints
Harnessing the Power of Optimizer HintsMaria Colgan
 
Am I reading GC logs Correctly?
Am I reading GC logs Correctly?Am I reading GC logs Correctly?
Am I reading GC logs Correctly?Tier1 App
 
RxNetty vs Tomcat Performance Results
RxNetty vs Tomcat Performance ResultsRxNetty vs Tomcat Performance Results
RxNetty vs Tomcat Performance ResultsBrendan Gregg
 
Troubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationTroubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationAlexey Lesovsky
 
G1 Garbage Collector: Details and Tuning
G1 Garbage Collector: Details and TuningG1 Garbage Collector: Details and Tuning
G1 Garbage Collector: Details and TuningSimone Bordet
 
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame GraphsJava Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame GraphsBrendan Gregg
 
Shell,信号量以及java进程的退出
Shell,信号量以及java进程的退出Shell,信号量以及java进程的退出
Shell,信号量以及java进程的退出wang hongjiang
 
SREcon 2016 Performance Checklists for SREs
SREcon 2016 Performance Checklists for SREsSREcon 2016 Performance Checklists for SREs
SREcon 2016 Performance Checklists for SREsBrendan Gregg
 
Performance Tuning EC2 Instances
Performance Tuning EC2 InstancesPerformance Tuning EC2 Instances
Performance Tuning EC2 InstancesBrendan Gregg
 
Blazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBlazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBrendan Gregg
 
Linux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF SuperpowersLinux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF SuperpowersBrendan Gregg
 
Container Performance Analysis
Container Performance AnalysisContainer Performance Analysis
Container Performance AnalysisBrendan Gregg
 

Destaque (12)

Harnessing the Power of Optimizer Hints
Harnessing the Power of Optimizer HintsHarnessing the Power of Optimizer Hints
Harnessing the Power of Optimizer Hints
 
Am I reading GC logs Correctly?
Am I reading GC logs Correctly?Am I reading GC logs Correctly?
Am I reading GC logs Correctly?
 
RxNetty vs Tomcat Performance Results
RxNetty vs Tomcat Performance ResultsRxNetty vs Tomcat Performance Results
RxNetty vs Tomcat Performance Results
 
Troubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationTroubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming Replication
 
G1 Garbage Collector: Details and Tuning
G1 Garbage Collector: Details and TuningG1 Garbage Collector: Details and Tuning
G1 Garbage Collector: Details and Tuning
 
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame GraphsJava Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame Graphs
 
Shell,信号量以及java进程的退出
Shell,信号量以及java进程的退出Shell,信号量以及java进程的退出
Shell,信号量以及java进程的退出
 
SREcon 2016 Performance Checklists for SREs
SREcon 2016 Performance Checklists for SREsSREcon 2016 Performance Checklists for SREs
SREcon 2016 Performance Checklists for SREs
 
Performance Tuning EC2 Instances
Performance Tuning EC2 InstancesPerformance Tuning EC2 Instances
Performance Tuning EC2 Instances
 
Blazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBlazing Performance with Flame Graphs
Blazing Performance with Flame Graphs
 
Linux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF SuperpowersLinux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF Superpowers
 
Container Performance Analysis
Container Performance AnalysisContainer Performance Analysis
Container Performance Analysis
 

Semelhante a Row Pattern Matching in SQL:2016

class12_time.ppt
class12_time.pptclass12_time.ppt
class12_time.pptGauravWaila
 
The Ring programming language version 1.5.2 book - Part 23 of 181
The Ring programming language version 1.5.2 book - Part 23 of 181The Ring programming language version 1.5.2 book - Part 23 of 181
The Ring programming language version 1.5.2 book - Part 23 of 181Mahmoud Samir Fayed
 
Row patternmatching12ctech14
Row patternmatching12ctech14Row patternmatching12ctech14
Row patternmatching12ctech14stewashton
 
Formal 7– Modelling state – looking within the system at internal behaviour
Formal 7– Modelling state – looking within the system at internal behaviourFormal 7– Modelling state – looking within the system at internal behaviour
Formal 7– Modelling state – looking within the system at internal behaviourAlan Dix
 
The Ring programming language version 1.4.1 book - Part 6 of 31
The Ring programming language version 1.4.1 book - Part 6 of 31The Ring programming language version 1.4.1 book - Part 6 of 31
The Ring programming language version 1.4.1 book - Part 6 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 32 of 212
The Ring programming language version 1.10 book - Part 32 of 212The Ring programming language version 1.10 book - Part 32 of 212
The Ring programming language version 1.10 book - Part 32 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 28 of 202
The Ring programming language version 1.8 book - Part 28 of 202The Ring programming language version 1.8 book - Part 28 of 202
The Ring programming language version 1.8 book - Part 28 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 27 of 196
The Ring programming language version 1.7 book - Part 27 of 196The Ring programming language version 1.7 book - Part 27 of 196
The Ring programming language version 1.7 book - Part 27 of 196Mahmoud Samir Fayed
 
Processes And Job Control
Processes And Job ControlProcesses And Job Control
Processes And Job Controlahmad bassiouny
 
02 order of growth
02 order of growth02 order of growth
02 order of growthHira Gul
 
The Ring programming language version 1.5.3 book - Part 23 of 184
The Ring programming language version 1.5.3 book - Part 23 of 184The Ring programming language version 1.5.3 book - Part 23 of 184
The Ring programming language version 1.5.3 book - Part 23 of 184Mahmoud Samir Fayed
 
Introduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfIntroduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfTulasiramKandula1
 
Rewriting Engine for Process Algebras
Rewriting Engine for Process AlgebrasRewriting Engine for Process Algebras
Rewriting Engine for Process AlgebrasAnatolii Kmetiuk
 

Semelhante a Row Pattern Matching in SQL:2016 (15)

2_2_Event_Mechanism_Chapter_2.pdf
2_2_Event_Mechanism_Chapter_2.pdf2_2_Event_Mechanism_Chapter_2.pdf
2_2_Event_Mechanism_Chapter_2.pdf
 
class12_time.ppt
class12_time.pptclass12_time.ppt
class12_time.ppt
 
The Ring programming language version 1.5.2 book - Part 23 of 181
The Ring programming language version 1.5.2 book - Part 23 of 181The Ring programming language version 1.5.2 book - Part 23 of 181
The Ring programming language version 1.5.2 book - Part 23 of 181
 
Row patternmatching12ctech14
Row patternmatching12ctech14Row patternmatching12ctech14
Row patternmatching12ctech14
 
Formal 7– Modelling state – looking within the system at internal behaviour
Formal 7– Modelling state – looking within the system at internal behaviourFormal 7– Modelling state – looking within the system at internal behaviour
Formal 7– Modelling state – looking within the system at internal behaviour
 
The Ring programming language version 1.4.1 book - Part 6 of 31
The Ring programming language version 1.4.1 book - Part 6 of 31The Ring programming language version 1.4.1 book - Part 6 of 31
The Ring programming language version 1.4.1 book - Part 6 of 31
 
The Ring programming language version 1.10 book - Part 32 of 212
The Ring programming language version 1.10 book - Part 32 of 212The Ring programming language version 1.10 book - Part 32 of 212
The Ring programming language version 1.10 book - Part 32 of 212
 
The Ring programming language version 1.8 book - Part 28 of 202
The Ring programming language version 1.8 book - Part 28 of 202The Ring programming language version 1.8 book - Part 28 of 202
The Ring programming language version 1.8 book - Part 28 of 202
 
Influxdb and time series data
Influxdb and time series dataInfluxdb and time series data
Influxdb and time series data
 
The Ring programming language version 1.7 book - Part 27 of 196
The Ring programming language version 1.7 book - Part 27 of 196The Ring programming language version 1.7 book - Part 27 of 196
The Ring programming language version 1.7 book - Part 27 of 196
 
Processes And Job Control
Processes And Job ControlProcesses And Job Control
Processes And Job Control
 
02 order of growth
02 order of growth02 order of growth
02 order of growth
 
The Ring programming language version 1.5.3 book - Part 23 of 184
The Ring programming language version 1.5.3 book - Part 23 of 184The Ring programming language version 1.5.3 book - Part 23 of 184
The Ring programming language version 1.5.3 book - Part 23 of 184
 
Introduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfIntroduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdf
 
Rewriting Engine for Process Algebras
Rewriting Engine for Process AlgebrasRewriting Engine for Process Algebras
Rewriting Engine for Process Algebras
 

Mais de Markus Winand

Standard SQL features where PostgreSQL beats its competitors
Standard SQL features where PostgreSQL beats its competitorsStandard SQL features where PostgreSQL beats its competitors
Standard SQL features where PostgreSQL beats its competitorsMarkus Winand
 
Four* Major Database Releases of 2017 in Review
Four* Major Database Releases of 2017 in ReviewFour* Major Database Releases of 2017 in Review
Four* Major Database Releases of 2017 in ReviewMarkus Winand
 
SQL Transactions - What they are good for and how they work
SQL Transactions - What they are good for and how they workSQL Transactions - What they are good for and how they work
SQL Transactions - What they are good for and how they workMarkus Winand
 
Backend to Frontend: When database optimization affects the full stack
Backend to Frontend: When database optimization affects the full stackBackend to Frontend: When database optimization affects the full stack
Backend to Frontend: When database optimization affects the full stackMarkus Winand
 
Volkskrankheit "Stiefmuetterliche Indizierung"
Volkskrankheit "Stiefmuetterliche Indizierung"Volkskrankheit "Stiefmuetterliche Indizierung"
Volkskrankheit "Stiefmuetterliche Indizierung"Markus Winand
 
SQL Performance - Vienna System Architects Meetup 20131202
SQL Performance - Vienna System Architects Meetup 20131202SQL Performance - Vienna System Architects Meetup 20131202
SQL Performance - Vienna System Architects Meetup 20131202Markus Winand
 
Indexes: The neglected performance all rounder
Indexes: The neglected performance all rounderIndexes: The neglected performance all rounder
Indexes: The neglected performance all rounderMarkus Winand
 
Pagination Done the Right Way
Pagination Done the Right WayPagination Done the Right Way
Pagination Done the Right WayMarkus Winand
 

Mais de Markus Winand (8)

Standard SQL features where PostgreSQL beats its competitors
Standard SQL features where PostgreSQL beats its competitorsStandard SQL features where PostgreSQL beats its competitors
Standard SQL features where PostgreSQL beats its competitors
 
Four* Major Database Releases of 2017 in Review
Four* Major Database Releases of 2017 in ReviewFour* Major Database Releases of 2017 in Review
Four* Major Database Releases of 2017 in Review
 
SQL Transactions - What they are good for and how they work
SQL Transactions - What they are good for and how they workSQL Transactions - What they are good for and how they work
SQL Transactions - What they are good for and how they work
 
Backend to Frontend: When database optimization affects the full stack
Backend to Frontend: When database optimization affects the full stackBackend to Frontend: When database optimization affects the full stack
Backend to Frontend: When database optimization affects the full stack
 
Volkskrankheit "Stiefmuetterliche Indizierung"
Volkskrankheit "Stiefmuetterliche Indizierung"Volkskrankheit "Stiefmuetterliche Indizierung"
Volkskrankheit "Stiefmuetterliche Indizierung"
 
SQL Performance - Vienna System Architects Meetup 20131202
SQL Performance - Vienna System Architects Meetup 20131202SQL Performance - Vienna System Architects Meetup 20131202
SQL Performance - Vienna System Architects Meetup 20131202
 
Indexes: The neglected performance all rounder
Indexes: The neglected performance all rounderIndexes: The neglected performance all rounder
Indexes: The neglected performance all rounder
 
Pagination Done the Right Way
Pagination Done the Right WayPagination Done the Right Way
Pagination Done the Right Way
 

Último

VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...SUHANI PANDEY
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...amitlee9823
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightDelhi Call girls
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
Data-Analysis for Chicago Crime Data 2023
Data-Analysis for Chicago Crime Data  2023Data-Analysis for Chicago Crime Data  2023
Data-Analysis for Chicago Crime Data 2023ymrp368
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 

Último (20)

VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Data-Analysis for Chicago Crime Data 2023
Data-Analysis for Chicago Crime Data  2023Data-Analysis for Chicago Crime Data  2023
Data-Analysis for Chicago Crime Data 2023
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 

Row Pattern Matching in SQL:2016