{"id":463970,"date":"2025-06-20T21:00:05","date_gmt":"2025-06-20T21:00:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=463970"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=463970","title":{"rendered":"<span>\u041a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u044b\u0439 \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433 \u043f\u043e\u00a0\u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u043e\u0432\u044b\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e SQL<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f04\/68d\/931\/f0468d9315ba258aba5559c230831e92.png\" width=\"1600\" height=\"800\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/f04\/68d\/931\/f0468d9315ba258aba5559c230831e92.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f04\/68d\/931\/f0468d9315ba258aba5559c230831e92.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u0410\u043d\u0442\u043e\u043d \u041f\u0440\u044b\u0433\u0438\u043d, \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 <a href=\"https:\/\/garage-eight.com\/?utm_source=habr&amp;utm_medium=social&amp;utm_campaign=detectoranomalii&amp;utm_term=article\" rel=\"noopener noreferrer nofollow\">Garage Eight<\/a>. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0433\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433\u0430 \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u0442\u0430\u0441\u043a-\u0442\u0440\u0435\u043a\u0435\u0440\u043e\u043c.\u00a0<\/p>\n<h3>\u041a\u0430\u043a \u0432\u043e\u0437\u043d\u0438\u043a \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0442\u00a0\u0431\u0438\u0437\u043d\u0435\u0441\u0430<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u0430 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442 \u0437\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432, \u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0447\u0435\u0440\u0435\u0437 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b. \u0427\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u0438 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0437\u043a\u0438\u0445 \u043f\u0438\u043a\u043e\u0432 \u0438 \u0441\u043f\u0430\u0434\u043e\u0432, \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430\u0439\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431.\u00a0<\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043c\u0435\u0442\u0440\u0438\u043a \u0441 \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433\u043e\u043c \u0432 Slack\u00a0\u2014 \u0432 \u043d\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0442\u043e\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438 \u0432 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u0445.\u00a0<\/p>\n<h3>\u0421\u0431\u043e\u0440 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u043f\u043b\u0435\u0441\u043a\u043e\u0432 \u0438 \u043f\u0440\u043e\u0432\u0430\u043b\u043e\u0432.\u00a0<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/184\/f8c\/767\/184f8c767056791d448cb431325afb80.png\" alt=\"\u0413\u0440\u0430\u0444\u0438\u043a \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: \u0435\u0441\u0442\u044c \u0438 \u0437\u0430\u043c\u0435\u0442\u043d\u044b\u0435 \u043f\u0438\u043a\u0438, \u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0430\u043b\u044b. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u043d\u0430 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439\" title=\"\u0413\u0440\u0430\u0444\u0438\u043a \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: \u0435\u0441\u0442\u044c \u0438 \u0437\u0430\u043c\u0435\u0442\u043d\u044b\u0435 \u043f\u0438\u043a\u0438, \u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0430\u043b\u044b. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u043d\u0430 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439\" width=\"1600\" height=\"510\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/184\/f8c\/767\/184f8c767056791d448cb431325afb80.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/184\/f8c\/767\/184f8c767056791d448cb431325afb80.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0413\u0440\u0430\u0444\u0438\u043a \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: \u0435\u0441\u0442\u044c \u0438 \u0437\u0430\u043c\u0435\u0442\u043d\u044b\u0435 \u043f\u0438\u043a\u0438, \u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0430\u043b\u044b. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u043d\u0430 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u041c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u044f \u043e\u043f\u0438\u0440\u0430\u043b\u0441\u044f \u043d\u0430 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435.\u00a0<\/p>\n<h4>Z-score<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438: z-score\u00a0\u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043e\u0442 \u0435\u0433\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p align=\"left\">\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435:\u00a0<\/p>\n<p align=\"left\">\u0433\u0434\u0435 X\u00a0\u2014 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, S<sub>x<\/sub>\u00a0\u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043c\u0435\u0442\u0440\u0438\u043a z-score \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438 \u043d\u0430 \u0440\u0430\u043d\u043d\u0438\u0445 \u0441\u0442\u0430\u0434\u0438\u044f\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0437\u043a\u0438\u0439 \u0440\u043e\u0441\u0442 \u043e\u0442\u043a\u0430\u0437\u043e\u0432 \u0438\u043b\u0438 \u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0438\u043a\u0430.\u00a0<\/p>\n<p><strong>\u041a\u0430\u043a \u044f \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 z-score:<\/strong><\/p>\n<ol>\n<li>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043b: \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u0432\u0430\u0440\u0442\u0430\u043b\u0430 \u0438 \u0434\u043d\u044f \u043d\u0435\u0434\u0435\u043b\u0438, \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043d\u0430 \u0431\u0443\u0434\u043d\u0438 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b \u043f\u0435\u0440\u0438\u043e\u0434, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0434\u0432\u0435 \u043d\u0435\u0434\u0435\u043b\u0438\u00a0\u2014 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u044c\u044e. \u041c\u0435\u043d\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e \u0431\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u0448\u0443\u043c\u0430 \u0438 \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043f\u0438\u043a\u0438, \u0430 \u0431\u043e\u043b\u044c\u0448\u0435\u0435\u00a0\u2014 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0434\u0430\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435:\u00a0<\/p>\n<\/li>\n<\/ol>\n<ul>\n<li>\n<p><strong>prev_day_registrations<\/strong>\u00a0\u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0434\u0435\u043d\u044c.<\/p>\n<\/li>\n<li>\n<p><strong>cumulative_quarter<\/strong>\u00a0\u2014 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0437\u0430 \u043a\u0432\u0430\u0440\u0442\u0430\u043b.<\/p>\n<\/li>\n<li>\n<p><strong>AVG_registrations<\/strong>\u00a0\u2014 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 13\u00a0\u0434\u043d\u0435\u0439 (\u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0439).<\/p>\n<\/li>\n<li>\n<p><strong>daily_plan<\/strong> \u0438 <strong>cumulative_plan<\/strong>\u00a0\u2014 \u0446\u0435\u043b\u0435\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u044b\u0445 \u0438 \u043a\u0443\u043c\u0443\u043b\u044f\u0442\u0438\u0432\u043d\u044b\u0445 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>lower_bound<\/strong> \u0438 <strong>upper_bound<\/strong>\u00a0\u2014 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>delta<\/strong>\u00a0\u2014 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0434\u043d\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>STDDEV_registrations<\/strong>\u00a0\u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0437\u0430 \u0442\u0435 \u0436\u0435 13\u00a0\u0434\u043d\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>positive_limit \u0438 negative_limit<\/strong>\u00a0\u2014 \u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u0435 \u0433\u0440\u0430\u043d\u0438\u0446 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0441 \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u043e\u043c \u0432 \u0434\u0432\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0418 \u0441\u0430\u043c <strong>z-score =)<\/strong><\/p>\n<\/li>\n<\/ul>\n<p>\u0412 SQL \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:\u00a0<\/p>\n<pre><code class=\"sql\">  SELECT     day,     'registrations' AS metric,     day_of_week,     country,     registrations,     prev_day_registrations,     delta,     AVG_registrations + k * STDDEV_registrations AS positive_limit,     AVG_registrations - k * STDDEV_registrations AS negative_limit,     (registrations - AVG_registrations) \/ STDDEV_registrations AS z_score,     cumulative_quarter,     daily_plan AS daily_registrations,     cumulative_plan AS cumulative_registrations,     lower_bound,     upper_bound   FROM (     SELECT       day,       day_of_week,       country,       registrations,       LAG(registrations) OVER (ORDER BY day) AS prev_day_registrations,       (registrations \/ LAG(registrations) OVER (ORDER BY day)) - 1 AS delta,       AVG(registrations) OVER (PARTITION BY day_type ORDER BY day ROWS BETWEEN 13 PRECEDING AND 1 PRECEDING) AS AVG_registrations,       STDDEV(registrations) OVER (PARTITION BY day_type ORDER BY day ROWS BETWEEN 13 PRECEDING AND 1 PRECEDING) AS STDDEV_registrations,       2 AS k,       SUM(registrations) OVER (PARTITION BY quarter) AS cumulative_quarter,       plan.daily_target AS daily_plan,       plan.cumulative_target AS cumulative_plan,       plan.lower_bound,       plan.upper_bound     FROM (       SELECT         DATE_TRUNC(registered_at, QUARTER) AS quarter,         DATE(registered_at) AS day,         FORMAT_TIMESTAMP('%A', registered_at) AS day_of_week,         IF(FORMAT_TIMESTAMP('%A', registered_at) IN ('Monday','Tuesday','Wednesday','Thursday','Friday'), 'workday', 'weekend') AS day_type,         country,         COUNT(DISTINCT user_id) AS registrations       FROM `project.dataset.user_events`       WHERE registered_at &gt;= '2024-01-01'       GROUP BY 1, 2, 3, 4, 5     ) base     LEFT JOIN `project.dataset.registration_plans` plan       ON base.day = plan.date   )<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u043e\u0437\u0438\u0442\u0438\u0432\u043d\u0443\u044e \u0438\u043b\u0438 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443, \u0442\u043e \u044d\u0442\u043e \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044f. \u042f \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043b \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0438 \u0441\u0442\u0430\u043b \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e z-score \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0430\u043b\u0435\u0440\u0442\u044b.\u00a0<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9d1\/e42\/2ae\/9d1e422ae3982812978e463f9be1b314.png\" alt=\"Z-score \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0441\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e: \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u044f\u0432\u043b\u044f\u0435\u0442 \u043d\u0435 \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0417\u0435\u043b\u0435\u043d\u044b\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430\" title=\"Z-score \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0441\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e: \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u044f\u0432\u043b\u044f\u0435\u0442 \u043d\u0435 \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0417\u0435\u043b\u0435\u043d\u044b\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430\" width=\"1600\" height=\"522\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/9d1\/e42\/2ae\/9d1e422ae3982812978e463f9be1b314.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9d1\/e42\/2ae\/9d1e422ae3982812978e463f9be1b314.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>Z-score \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0441\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e: \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u044f\u0432\u043b\u044f\u0435\u0442 \u043d\u0435 \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0417\u0435\u043b\u0435\u043d\u044b\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0438 \u0442\u043e\u0433\u0434\u0430 \u044f \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u043a \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u043c\u0443 \u0431\u0430\u0437\u043e\u0432\u043e\u043c\u0443 \u043f\u0440\u0438\u0435\u043c\u0443.\u00a0<\/p>\n<h4>\u041f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">\u041f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044c\u00a0\u2014 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u0430\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0441 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e, \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0432 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445.\u00a0<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0435\u0441\u043b\u0438 90% \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0435\u0441\u044f\u0442\u044c \u0442\u044b\u0441\u044f\u0447, \u0442\u043e \u0432 90% \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0437\u0430 \u0434\u0435\u043d\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.\u00a0<\/p>\n<p>\u042f \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0430\u0445 \u0438 \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439. \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 90 \u0438 95% \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u043c \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f 99%.\u00a0<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u044f \u0431\u0440\u0430\u043b \u043f\u0435\u0440\u0438\u043e\u0434 \u0432 28\u00a0\u0434\u043d\u0435\u0439. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 z-score, \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0438 99 \u0438 1% \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0440\u0430\u0439\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00a0\u2014 \u043e\u0442\u0441\u0435\u0447\u044c \u00ab\u0445\u0432\u043e\u0441\u0442\u044b\u00bb \u0433\u0440\u0430\u0444\u0438\u043a\u0430. \u041f\u0435\u0440\u0438\u043e\u0434 \u0432 28\u00a0\u0434\u043d\u0435\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430: \u043e\u043d \u043c\u0435\u043d\u0435\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d \u043a \u0448\u0443\u043c\u0443 \u0438 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043c\u0435\u0442\u0440\u0438\u043a \u0441 \u0440\u0435\u0434\u043a\u0438\u043c\u0438, \u043d\u043e \u0441\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u0441\u043f\u043b\u0435\u0441\u043a\u0430\u043c\u0438, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u044b \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445.<\/p>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u0442\u0430\u043a:\u00a0<\/p>\n<pre><code class=\"sql\">registrations_percentile_data AS (   SELECT     r1.day,     PERCENTILE_CONT(r2.registrations, 0.99) OVER (PARTITION BY r1.day) AS p99_rate,     PERCENTILE_CONT(r2.registrations, 0.01) OVER (PARTITION BY r1.day) AS p01_rate   FROM registrations r1   JOIN registrations r2     ON r2.day BETWEEN r1.day - INTERVAL 28 DAY AND r1.day ),<\/code><\/pre>\n<p>\u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e z-score \u0431\u044b\u043b \u0442\u043e\u0447\u0435\u043d \u043d\u0430 65\u201380% \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438\u00a0\u2014 \u0432 \u043f\u0435\u0440\u0438\u043e\u0434\u0435 14\u00a0\u0434\u043d\u0435\u0439 \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u0438. \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u0431\u044b\u043b\u0438 \u0442\u043e\u0447\u043d\u044b \u0432 50\u201360% \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u00a0\u2014 \u0432 \u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u043c \u043f\u0435\u0440\u0438\u043e\u0434\u0435 28\u00a0\u0434\u043d\u0435\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0438\u043a\u0438 \u0438 \u043f\u0440\u043e\u0432\u0430\u043b\u044b \u0442\u0435\u0440\u044f\u043b\u0438\u0441\u044c. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0430\u043b\u0435\u0440\u0442\u043e\u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u0443\u0436\u0435 \u043e\u043a\u043e\u043b\u043e 99%. \u042f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043f\u043e\u0434\u0445\u043e\u0434 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439, \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f \u043c\u0435\u0442\u0440\u0438\u043a \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438.\u00a0<\/p>\n<pre><code class=\"sql\">activations AS (   SELECT     day,     'activations' AS metric,     day_of_week,     country,     activations,     prev_day_activations,     delta,     AVG_activations + k * STDDEV_activations AS positive_limit,     AVG_activations - k * STDDEV_activations AS negative_limit,     (activations - AVG_activations) \/ STDDEV_activations AS z_score,     cumulative_quarter,     daily_plan AS daily_activations,     cumulative_plan AS cumulative_activations,     lower_bound,     upper_bound   FROM (     SELECT       day,       day_of_week,       country,       activations,       LAG(activations) OVER (ORDER BY day) AS prev_day_activations,       (activations \/ LAG(activations) OVER (ORDER BY day)) - 1 AS delta,       AVG(activations) OVER (PARTITION BY day_type ORDER BY day ROWS BETWEEN 13 PRECEDING AND 1 PRECEDING) AS AVG_activations,       STDDEV(activations) OVER (PARTITION BY day_type ORDER BY day ROWS BETWEEN 13 PRECEDING AND 1 PRECEDING) AS STDDEV_activations,       2 AS k,       SUM(activations) OVER (PARTITION BY quarter) AS cumulative_quarter,       plan.daily_target AS daily_plan,       plan.cumulative_target AS cumulative_plan,       plan.lower_bound,       plan.upper_bound     FROM (       SELECT         DATE_TRUNC(activated_at, QUARTER) AS quarter,         DATE(activated_at) AS day,         FORMAT_TIMESTAMP('%A', activated_at) AS day_of_week,         IF(FORMAT_TIMESTAMP('%A', activated_at) IN ('Monday','Tuesday','Wednesday','Thursday','Friday'), 'workday', 'weekend') AS day_type,         country,         COUNT(DISTINCT user_id) AS activations       FROM `project.dataset.activation_events`       WHERE activated_at &gt;= '2024-01-01'         AND activation_index = 0       GROUP BY 1, 2, 3, 4, 5     ) base     LEFT JOIN `project.dataset.activation_plans` plan       ON base.day = plan.date   ) ),  activations_percentile_data AS (   SELECT     a1.day,     PERCENTILE_CONT(a2.activations, 0.99) OVER (PARTITION BY a1.day) AS p99_rate,     PERCENTILE_CONT(a2.activations, 0.01) OVER (PARTITION BY a1.day) AS p01_rate   FROM activations a1   JOIN activations a2     ON a2.day BETWEEN a1.day - INTERVAL 28 DAY AND a1.day )<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u0438 \u043e\u0431\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044f\u0445. \u042f \u0432\u044b\u0431\u0440\u0430\u043b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043e\u0431\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e: z-score\u00a0\u2014 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e, \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433\u0430, \u043a\u043e\u0433\u0434\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u0440\u043e\u0441\u0435\u043b\u0438 \u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u0430 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438\u00a0\u2014 \u0434\u043b\u044f \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0433\u0440\u0430\u043d\u0438\u0446 \u043d\u043e\u0440\u043c\u044b \u0437\u0430 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434.<\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u0435 \u043e\u043d\u0438 \u0434\u0430\u044e\u0442 \u0438 \u0448\u0438\u0440\u043e\u0442\u0443, \u0438 \u0433\u043b\u0443\u0431\u0438\u043d\u0443\u00a0\u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0438 \u0440\u0435\u0437\u043a\u0438\u0435 \u0441\u043a\u0430\u0447\u043a\u0438, \u0438 \u0432\u044b\u0431\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u0446\u0435\u043b\u043e\u043c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c.\u00a0<\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0442\u0430\u043a, \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u043b\u0435\u0440\u0442 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u044d\u0442\u043e \u043d\u0435\u043a\u0440\u0438\u0442\u0438\u0447\u043d\u0430\u044f \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044f. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u043e\u0431\u0430 \u0430\u043b\u0435\u0440\u0442\u0430, \u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0438\u043c\u044b, \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u0430 \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u0441 \u0447\u0435\u043c \u043e\u043d\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b.\u00a0<\/p>\n<pre><code class=\"sql\">SELECT   DISTINCT   r.day,   r.metric,   r.registrations AS daily_fact,   ROUND((r.registrations \/ r.daily_registrations) * 100, 2) AS daily_percent_to_plan,   r.daily_registrations AS daily_plan,   ROUND(r.delta * 100, 2) AS percent_to_prev_day,   CASE WHEN r.registrations &gt; r.positive_limit AND r.z_score &gt; 2 THEN 1 ELSE 0 END AS stat_positive_alert,   CASE WHEN r.registrations &lt; r.negative_limit AND r.z_score &lt; -2 THEN 1 ELSE 0 END AS stat_negative_alert,   CASE WHEN r.registrations &gt; p99_rate THEN 1 ELSE 0 END AS p99_alert,   CASE WHEN r.registrations &lt; p01_rate THEN 1 ELSE 0 END AS p01_alert,   r.cumulative_quarter AS quarter_fact,   ROUND(r.cumulative_quarter \/ r.cumulative_registrations * 100, 2) AS quarter_percent_to_plan,   r.cumulative_registrations AS quarter_plan,   CAST(ROUND(reg_to_act, 2) AS STRING) AS reg_to_act,   CAST(ROUND(((reg_to_act \/ prev_day_cr) - 1) * 100, 2) AS STRING) AS percent_to_prev_cr FROM registrations r JOIN `project.dataset.reg_to_act_cr` cr USING(day) JOIN registrations_percentile_data p USING(day)  UNION ALL  SELECT   DISTINCT   a.day,   a.metric,   a.activations AS daily_fact,   ROUND((a.activations \/ a.daily_activations) * 100, 2) AS daily_percent_to_plan,   a.daily_activations AS daily_plan,   ROUND(a.delta * 100, 2) AS percent_to_prev_day,   CASE WHEN a.activations &gt; a.positive_limit AND a.z_score &gt; 2 THEN 1 ELSE 0 END AS stat_positive_alert,   CASE WHEN a.activations &lt; a.negative_limit AND a.z_score &lt; -2 THEN 1 ELSE 0 END AS stat_negative_alert,   CASE WHEN a.activations &gt; p99_rate THEN 1 ELSE 0 END AS p99_alert,   CASE WHEN a.activations &lt; p01_rate THEN 1 ELSE 0 END AS p01_alert,   a.cumulative_quarter AS quarter_fact,   ROUND(a.cumulative_quarter \/ a.cumulative_activations * 100, 2) AS quarter_percent_to_plan,   a.cumulative_activations AS quarter_plan,   '' AS reg_to_act,   '' AS percent_to_prev_cr FROM activations a JOIN activations_percentile_data p USING(day)  ORDER BY day DESC<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0434\u043d\u0435\u0432\u043d\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a \u0438 \u0438\u0445 \u0441\u0442\u0430\u0442\u0443\u0441 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438.\u00a0<\/p>\n<h3>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441\u00a0\u0442\u0430\u0441\u043a-\u0442\u0440\u0435\u043a\u0435\u0440\u043e\u043c<\/h3>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0442\u0440\u0435\u043a\u0435\u0440\u0430\u043c\u0438 \u0438 \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0430\u043c\u0438. \u0427\u0442\u043e\u0431\u044b \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0443 \u043d\u0430\u0441, \u043c\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438\u0441\u044c \u043a data-\u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u044c \u043f\u043e API, \u044f \u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432.\u00a0<\/p>\n<pre><code class=\"sql\">WITH data_preparation AS (   SELECT     -- \u0421\u0438\u043c\u0432\u043e\u043b\u044b \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u043f\u043e \u0434\u043d\u0435\u0432\u043d\u043e\u043c\u0443 \u043f\u043b\u0430\u043d\u0443     CASE       WHEN D_percent_to_Plan &lt; 60 THEN ':red_circle:'       WHEN D_percent_to_Plan &lt; 90 THEN ':yellow_circle:'       ELSE ':green_circle:'     END AS D_plan_symbol,      -- \u0421\u0438\u043c\u0432\u043e\u043b\u044b \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u043f\u043e \u043a\u0432\u0430\u0440\u0442\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u043b\u0430\u043d\u0443     CASE       WHEN Q_percent_to_Plan &lt; 60 THEN ':red_circle:'       WHEN Q_percent_to_Plan &lt; 90 THEN ':large_yellow_circle:'       ELSE ':large_green_circle:'     END AS Q_plan_symbol,       day,       UPPER(metric) AS metric,       D_fact,       D_percent_to_plan,       D_Plan,       percent_to_prev_day,       Q_FACT,       Q_percent_to_plan,       Q_Plan,       REG_to_ACT,       percent_to_prev_CR_Reg_to_Act,        -- \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0430\u043b\u0435\u0440\u0442\u0430       CASE         WHEN P99_alert = 1 AND stat_possitive_alert = 1 THEN \":alert: \u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044f - \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043c\u0430 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043d\u044f \u043d\u0435\u0434\u0435\u043b\u0438 :alert:\"         WHEN P01_alert = 1 AND stat_negative_alert = 1 THEN \":alert: \u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044f - \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043c\u0430 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043d\u044f \u043d\u0435\u0434\u0435\u043b\u0438 :alert:\"         WHEN stat_possitive_alert = 1 THEN \":alert: \u041e\u0431\u044a\u0435\u043c \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0434\u043d\u044f \u043d\u0435\u0434\u0435\u043b\u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0448\u0435 \u043d\u043e\u0440\u043c\u044b \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 2 \u043d\u0435\u0434\u0435\u043b\u0438\"         WHEN stat_negative_alert = 1 THEN \":alert: \u041e\u0431\u044a\u0435\u043c \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0434\u043d\u044f \u043d\u0435\u0434\u0435\u043b\u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0438\u0436\u0435 \u043d\u043e\u0440\u043c\u044b \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 2 \u043d\u0435\u0434\u0435\u043b\u0438\"         WHEN P99_alert = 1 THEN \":alert: \u041e\u0431\u044a\u0435\u043c \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 99% \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 28 \u0434\u043d\u0435\u0439\"         WHEN P01_alert = 1 THEN \":alert: \u041e\u0431\u044a\u0435\u043c \u043d\u0438\u0436\u0435 1% \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 28 \u0434\u043d\u0435\u0439\"         ELSE \"\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0439 \u043d\u0435 \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u043e\"       END AS ALERT     FROM project_id.analytics_metrics_summary     WHERE day = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)     ORDER BY metric   ) ),  registrations_D AS (   SELECT     'FFFFFF' AS color,     '' AS text,     metric AS title,     D_plan_symbol || \" Day plan\/fact: \" || D_percent_to_Plan || \"%\" ||     \"\\n - Day current fact: \" || D_fact ||     \"\\n - Day plan: \" || D_Plan ||     \"\\n - % To previous Day: \" || percent_to_prev_day || \"%\" ||     \"\\n - CR Reg to Act: \" || REG_to_ACT || \"% (\" || percent_to_prev_CR_Reg_to_Act || \")\" ||     \"\\n - \" || ALERT AS value   FROM data_preparation   WHERE LOWER(metric) = 'registrations' ),  registrations_Q AS (   SELECT     'FFFFFF' AS color,     '' AS text,     '' AS title,     Q_plan_symbol || \" Quarter plan\/fact: \" || Q_percent_to_Plan || \"%\" ||     \"\\n - Quarter current fact: \" || Q_FACT ||     \"\\n - Quarter plan: \" || Q_Plan AS value   FROM data_preparation   WHERE LOWER(metric) = 'registrations' ),  activations_D AS (   SELECT     'FFFFFF' AS color,     '' AS text,     metric AS title,     D_plan_symbol || \" Day plan\/fact: \" || D_percent_to_Plan || \"%\" ||     \"\\n - Day current fact: \" || D_fact ||     \"\\n - Day plan: \" || D_Plan ||     \"\\n - % To previous Day: \" || percent_to_prev_day || \"%\" ||     \"\\n - \" || ALERT AS value   FROM data_preparation   WHERE LOWER(metric) = 'activations' ),  activations_Q AS (   SELECT     'FFFFFF' AS color,     '' AS text,     '' AS title,     Q_plan_symbol || \" Quarter plan\/fact: \" || Q_percent_to_Plan || \"%\" ||     \"\\n - Quarter current fact: \" || Q_FACT ||     \"\\n - Quarter plan: \" || Q_Plan AS value   FROM data_preparation   WHERE LOWER(metric) = 'activations' )  -- \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0431\u043b\u043e\u043a \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (\u0434\u043b\u044f \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0430) SELECT * FROM (   SELECT     'CHANNEL_ID_PLACEHOLDER' AS channel_field,     'DATE: ' || DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY) AS message_field,     TO_JSON_STRING(ARRAY_AGG(STRUCT(color, text, title, value))) AS attachments   FROM (     SELECT * FROM (       SELECT 1 AS rn, color, text, ARRAY_AGG(title) AS title, ARRAY_AGG(value) AS value FROM registrations_D GROUP BY 1,2,3       UNION ALL       SELECT 2, color, text, ARRAY_AGG(title), ARRAY_AGG(value) FROM registrations_Q GROUP BY 1,2,3       UNION ALL       SELECT 3, color, text, ARRAY_AGG(title), ARRAY_AGG(value) FROM activations_D GROUP BY 1,2,3       UNION ALL       SELECT 4, color, text, ARRAY_AGG(title), ARRAY_AGG(value) FROM activations_Q GROUP BY 1,2,3       -- \u041c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0442\u0440\u0438\u043a     )     ORDER BY rn   ) )  WHERE attachments NOT LIKE '%null%'<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c, \u043d\u043e \u0435\u043c\u043a\u0438\u043c \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043c\u043e\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438:\u00a0<\/p>\n<ul>\n<li>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0437\u0430 \u0434\u0435\u043d\u044c \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u043c\u0443 \u043f\u043b\u0430\u043d\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043f\u0440\u043e\u0448\u043b\u044b\u043c \u043f\u0435\u0440\u0438\u043e\u0434\u043e\u043c.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u043a\u0432\u0430\u0440\u0442\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u043b\u0430\u043d\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0439 \u0437\u0430 \u0434\u0435\u043d\u044c \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u043c\u0443 \u043f\u043b\u0430\u043d\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0439 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043f\u0440\u043e\u0448\u043b\u044b\u043c \u043f\u0435\u0440\u0438\u043e\u0434\u043e\u043c.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0439 \u043a\u0432\u0430\u0440\u0442\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u043b\u0430\u043d\u0443.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/59a\/de4\/8ef\/59ade48ef3efc4a93fa8e2b26a1f21ff.png\" alt=\"\u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f (\u0446\u0438\u0444\u0440\u044b \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d\u044b \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430). \u0417\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0441 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e, \u0430 \u0432\u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0439 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0448\u0435 \u043d\u043e\u0440\u043c\u044b.\" title=\"\u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f (\u0446\u0438\u0444\u0440\u044b \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d\u044b \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430). \u0417\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0441 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e, \u0430 \u0432\u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0439 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0448\u0435 \u043d\u043e\u0440\u043c\u044b.\" width=\"1272\" height=\"1004\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/59a\/de4\/8ef\/59ade48ef3efc4a93fa8e2b26a1f21ff.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/59a\/de4\/8ef\/59ade48ef3efc4a93fa8e2b26a1f21ff.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f (\u0446\u0438\u0444\u0440\u044b \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d\u044b \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430). \u0417\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0441 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e, \u0430 \u0432\u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0439 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0448\u0435 \u043d\u043e\u0440\u043c\u044b.<\/em><\/figcaption><\/div>\n<\/figure>\n<hr\/>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0435, \u043d\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435\u00a0\u2014 \u044f \u0441\u0442\u0440\u0435\u043c\u0438\u043b\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u0438\u043c \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u0430, \u043d\u043e \u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0438 \u0438\u0437 \u0441\u043c\u0435\u0436\u043d\u044b\u0445 \u043e\u0442\u0434\u0435\u043b\u043e\u0432. \u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u044f\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0433 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c =)<\/p>\n<p>\u041f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u0438 \u0437\u0430\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/920226\/\"> https:\/\/habr.com\/ru\/articles\/920226\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u0410\u043d\u0442\u043e\u043d \u041f\u0440\u044b\u0433\u0438\u043d, \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 <a href=\"https:\/\/garage-eight.com\/?utm_source=habr&amp;utm_medium=social&amp;utm_campaign=detectoranomalii&amp;utm_term=article\" rel=\"noopener noreferrer nofollow\">Garage Eight<\/a>. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0433\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433\u0430 \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u0442\u0430\u0441\u043a-\u0442\u0440\u0435\u043a\u0435\u0440\u043e\u043c.\u00a0<\/p>\n<h3>\u041a\u0430\u043a \u0432\u043e\u0437\u043d\u0438\u043a \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0442\u00a0\u0431\u0438\u0437\u043d\u0435\u0441\u0430<\/h3>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u0430 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442 \u0437\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432, \u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0447\u0435\u0440\u0435\u0437 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b. \u0427\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u0438 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0437\u043a\u0438\u0445 \u043f\u0438\u043a\u043e\u0432 \u0438 \u0441\u043f\u0430\u0434\u043e\u0432, \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430\u0439\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431.\u00a0<\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043c\u0435\u0442\u0440\u0438\u043a \u0441 \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433\u043e\u043c \u0432 Slack\u00a0\u2014 \u0432 \u043d\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0442\u043e\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438 \u0432 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u0445.\u00a0<\/p>\n<h3>\u0421\u0431\u043e\u0440 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u043f\u043b\u0435\u0441\u043a\u043e\u0432 \u0438 \u043f\u0440\u043e\u0432\u0430\u043b\u043e\u0432.\u00a0<\/p>\n<figure class=\"full-width\">\n<div><figcaption><em>\u0413\u0440\u0430\u0444\u0438\u043a \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: \u0435\u0441\u0442\u044c \u0438 \u0437\u0430\u043c\u0435\u0442\u043d\u044b\u0435 \u043f\u0438\u043a\u0438, \u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0430\u043b\u044b. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u043d\u0430 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u041c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u044f \u043e\u043f\u0438\u0440\u0430\u043b\u0441\u044f \u043d\u0430 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435.\u00a0<\/p>\n<h4>Z-score<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438: z-score\u00a0\u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043e\u0442 \u0435\u0433\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p align=\"left\">\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435:\u00a0<\/p>\n<p align=\"left\">\u0433\u0434\u0435 X\u00a0\u2014 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, S<sub>x<\/sub>\u00a0\u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043c\u0435\u0442\u0440\u0438\u043a z-score \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438 \u043d\u0430 \u0440\u0430\u043d\u043d\u0438\u0445 \u0441\u0442\u0430\u0434\u0438\u044f\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0437\u043a\u0438\u0439 \u0440\u043e\u0441\u0442 \u043e\u0442\u043a\u0430\u0437\u043e\u0432 \u0438\u043b\u0438 \u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0438\u043a\u0430.\u00a0<\/p>\n<p><strong>\u041a\u0430\u043a \u044f \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 z-score:<\/strong><\/p>\n<ol>\n<li>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043b: \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u0432\u0430\u0440\u0442\u0430\u043b\u0430 \u0438 \u0434\u043d\u044f \u043d\u0435\u0434\u0435\u043b\u0438, \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043d\u0430 \u0431\u0443\u0434\u043d\u0438 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b \u043f\u0435\u0440\u0438\u043e\u0434, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0434\u0432\u0435 \u043d\u0435\u0434\u0435\u043b\u0438\u00a0\u2014 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u044c\u044e. \u041c\u0435\u043d\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e \u0431\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u0448\u0443\u043c\u0430 \u0438 \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043f\u0438\u043a\u0438, \u0430 \u0431\u043e\u043b\u044c\u0448\u0435\u0435\u00a0\u2014 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0434\u0430\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435:\u00a0<\/p>\n<\/li>\n<\/ol>\n<ul>\n<li>\n<p><strong>prev_day_registrations<\/strong>\u00a0\u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0434\u0435\u043d\u044c.<\/p>\n<\/li>\n<li>\n<p><strong>cumulative_quarter<\/strong>\u00a0\u2014 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0437\u0430 \u043a\u0432\u0430\u0440\u0442\u0430\u043b.<\/p>\n<\/li>\n<li>\n<p><strong>AVG_registrations<\/strong>\u00a0\u2014 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 13\u00a0\u0434\u043d\u0435\u0439 (\u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0439).<\/p>\n<\/li>\n<li>\n<p><strong>daily_plan<\/strong> \u0438 <strong>cumulative_plan<\/strong>\u00a0\u2014 \u0446\u0435\u043b\u0435\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u044b\u0445 \u0438 \u043a\u0443\u043c\u0443\u043b\u044f\u0442\u0438\u0432\u043d\u044b\u0445 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>lower_bound<\/strong> \u0438 <strong>upper_bound<\/strong>\u00a0\u2014 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>delta<\/strong>\u00a0\u2014 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0434\u043d\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>STDDEV_registrations<\/strong>\u00a0\u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0437\u0430 \u0442\u0435 \u0436\u0435 13\u00a0\u0434\u043d\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>positive_limit \u0438 negative_limit<\/strong>\u00a0\u2014 \u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u0435 \u0433\u0440\u0430\u043d\u0438\u0446 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439 \u0441 \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u043e\u043c \u0432 \u0434\u0432\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0439.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0418 \u0441\u0430\u043c <strong>z-score =)<\/strong><\/p>\n<\/li>\n<\/ul>\n<p>\u0412 SQL \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:\u00a0<\/p>\n<pre><code class=\"sql\">  SELECT     day,     'registrations' AS metric,     day_of_week,     country,     registrations,     prev_day_registrations,     delta,     AVG_registrations + k * STDDEV_registrations AS positive_limit,     AVG_registrations - k * STDDEV_registrations AS negative_limit,     (registrations - AVG_registrations) \/ STDDEV_registrations AS z_score,     cumulative_quarter,     daily_plan AS daily_registrations,     cumulative_plan AS cumulative_registrations,     lower_bound,     upper_bound   FROM (     SELECT       day,       day_of_week,       country,       registrations,       LAG(registrations) OVER (ORDER BY day) AS prev_day_registrations,       (registrations \/ LAG(registrations) OVER (ORDER BY day)) - 1 AS delta,       AVG(registrations) OVER (PARTITION BY day_type ORDER BY day ROWS BETWEEN 13 PRECEDING AND 1 PRECEDING) AS AVG_registrations,       STDDEV(registrations) OVER (PARTITION BY day_type ORDER BY day ROWS BETWEEN 13 PRECEDING AND 1 PRECEDING) AS STDDEV_registrations,       2 AS k,       SUM(registrations) OVER (PARTITION BY quarter) AS cumulative_quarter,       plan.daily_target AS daily_plan,       plan.cumulative_target AS cumulative_plan,       plan.lower_bound,       plan.upper_bound     FROM (       SELECT         DATE_TRUNC(registered_at, QUARTER) AS quarter,         DATE(registered_at) AS day,         FORMAT_TIMESTAMP('%A', registered_at) AS day_of_week,         IF(FORMAT_TIMESTAMP('%A', registered_at) IN ('Monday','Tuesday','Wednesday','Thursday','Friday'), 'workday', 'weekend') AS day_type,         country,         COUNT(DISTINCT user_id) AS registrations       FROM `project.dataset.user_events`       WHERE registered_at &gt;= '2024-01-01'       GROUP BY 1, 2, 3, 4, 5     ) base     LEFT JOIN `project.dataset.registration_plans` plan       ON base.day = plan.date   )<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u043e\u0437\u0438\u0442\u0438\u0432\u043d\u0443\u044e \u0438\u043b\u0438 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443, \u0442\u043e \u044d\u0442\u043e \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044f. \u042f \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043b \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0438 \u0441\u0442\u0430\u043b \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e z-score \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0430\u043b\u0435\u0440\u0442\u044b.\u00a0<\/p>\n<figure class=\"full-width\">\n<div><figcaption><em>Z-score \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0441\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e: \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u044f\u0432\u043b\u044f\u0435\u0442 \u043d\u0435 \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0417\u0435\u043b\u0435\u043d\u044b\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0438 \u0442\u043e\u0433\u0434\u0430 \u044f \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u043a \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u043c\u0443 \u0431\u0430\u0437\u043e\u0432\u043e\u043c\u0443 \u043f\u0440\u0438\u0435\u043c\u0443.\u00a0<\/p>\n<h4>\u041f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">\u041f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044c\u00a0\u2014 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u0430\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0441 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e, \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0432 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445.\u00a0<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0435\u0441\u043b\u0438 90% \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0435\u0441\u044f\u0442\u044c \u0442\u044b\u0441\u044f\u0447, \u0442\u043e \u0432 90% \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0437\u0430 \u0434\u0435\u043d\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.\u00a0<\/p>\n<p>\u042f \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0430\u0445 \u0438 \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439. \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 90 \u0438 95% \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u043c \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f 99%.\u00a0<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u044f \u0431\u0440\u0430\u043b \u043f\u0435\u0440\u0438\u043e\u0434 \u0432 28\u00a0\u0434\u043d\u0435\u0439. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 z-score, \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0438 99 \u0438 1% \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0440\u0430\u0439\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00a0\u2014 \u043e\u0442\u0441\u0435\u0447\u044c \u00ab\u0445\u0432\u043e\u0441\u0442\u044b\u00bb \u0433\u0440\u0430\u0444\u0438\u043a\u0430. \u041f\u0435\u0440\u0438\u043e\u0434 \u0432 28\u00a0\u0434\u043d\u0435\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430: \u043e\u043d \u043c\u0435\u043d\u0435\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d \u043a \u0448\u0443\u043c\u0443 \u0438 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043c\u0435\u0442\u0440\u0438\u043a \u0441 \u0440\u0435\u0434\u043a\u0438\u043c\u0438, \u043d\u043e \u0441\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u0441\u043f\u043b\u0435\u0441\u043a\u0430\u043c\u0438, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u044b \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445.<\/p>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u0442\u0430\u043a:\u00a0<\/p>\n<pre><code class=\"sql\">registrations_percentile_data AS (   SELECT     r1.day,     PERCENTILE_CONT(r2.registrations, 0.99) OVER (PARTITION BY r1.day) AS p99_rate,     PERCENTILE_CONT(r2.registrations, 0.01) OVER (PARTITION BY r1.day) AS p01_rate   FROM registrations r1   JOIN registrations r2     ON r2.day BETWEEN r1.day - INTERVAL 28 DAY AND r1.day ),<\/code><\/pre>\n<p>\u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e z-score \u0431\u044b\u043b \u0442\u043e\u0447\u0435\u043d \u043d\u0430 65\u201380% \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438\u00a0\u2014 \u0432 \u043f\u0435\u0440\u0438\u043e\u0434\u0435 14\u00a0\u0434\u043d\u0435\u0439 \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u0438. \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u0431\u044b\u043b\u0438 \u0442\u043e\u0447\u043d\u044b \u0432 50\u201360% \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u00a0\u2014 \u0432 \u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u043c \u043f\u0435\u0440\u0438\u043e\u0434\u0435 28\u00a0\u0434\u043d\u0435\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0438\u043a\u0438 \u0438 \u043f\u0440\u043e\u0432\u0430\u043b\u044b \u0442\u0435\u0440\u044f\u043b\u0438\u0441\u044c. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0430\u043b\u0435\u0440\u0442\u043e\u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u0443\u0436\u0435 \u043e\u043a\u043e\u043b\u043e 99%. \u042f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043f\u043e\u0434\u0445\u043e\u0434 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439, \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f \u043c\u0435\u0442\u0440\u0438\u043a \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438.\u00a0<\/p>\n<pre><code class=\"sql\">activations AS (   SELECT     day,     'activations' AS metric,     day_of_week,     country,     activations,     prev_day_activations,     delta,     AVG_activations + k * STDDEV_activations AS positive_limit,     AVG_activations - k * STDDEV_activations AS negative_limit,     (activations - AVG_activations) \/ STDDEV_activations AS z_score,     cumulative_quarter,     daily_plan AS daily_activations,     cumulative_plan AS cumulative_activations,     lower_bound,     upper_bound   FROM (     SELECT       day,       day_of_week,       country,       activations,       LAG(activations) OVER (ORDER BY day) AS prev_day_activations,       (activations \/ LAG(activations) OVER (ORDER BY day)) - 1 AS delta,       AVG(activations) OVER (PARTITION BY day_type ORDER BY day ROWS BETWEEN 13 PRECEDING AND 1 PRECEDING) AS AVG_activations,       STDDEV(activations) OVER (PARTITION BY day_type ORDER BY day ROWS BETWEEN 13 PRECEDING AND 1 PRECEDING) AS STDDEV_activations,       2 AS k,       SUM(activations) OVER (PARTITION BY quarter) AS cumulative_quarter,       plan.daily_target AS daily_plan,       plan.cumulative_target AS cumulative_plan,       plan.lower_bound,       plan.upper_bound     FROM (       SELECT         DATE_TRUNC(activated_at, QUARTER) AS quarter,         DATE(activated_at) AS day,         FORMAT_TIMESTAMP('%A', activated_at) AS day_of_week,         IF(FORMAT_TIMESTAMP('%A', activated_at) IN ('Monday','Tuesday','Wednesday','Thursday','Friday'), 'workday', 'weekend') AS day_type,         country,         COUNT(DISTINCT user_id) AS activations       FROM `project.dataset.activation_events`       WHERE activated_at &gt;= '2024-01-01'         AND activation_index = 0       GROUP BY 1, 2, 3, 4, 5     ) base     LEFT JOIN `project.dataset.activation_plans` plan       ON base.day = plan.date   ) ),  activations_percentile_data AS (   SELECT     a1.day,     PERCENTILE_CONT(a2.activations, 0.99) OVER (PARTITION BY a1.day) AS p99_rate,     PERCENTILE_CONT(a2.activations, 0.01) OVER (PARTITION BY a1.day) AS p01_rate   FROM activations a1   JOIN activations a2     ON a2.day BETWEEN a1.day - INTERVAL 28 DAY AND a1.day )<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u0438 \u043e\u0431\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044f\u0445. \u042f \u0432\u044b\u0431\u0440\u0430\u043b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043e\u0431\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e: z-score\u00a0\u2014 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e, \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433\u0430, \u043a\u043e\u0433\u0434\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u0440\u043e\u0441\u0435\u043b\u0438 \u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u0430 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438\u00a0\u2014 \u0434\u043b\u044f \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0433\u0440\u0430\u043d\u0438\u0446 \u043d\u043e\u0440\u043c\u044b \u0437\u0430 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434.<\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u0435 \u043e\u043d\u0438 \u0434\u0430\u044e\u0442 \u0438 \u0448\u0438\u0440\u043e\u0442\u0443, \u0438 \u0433\u043b\u0443\u0431\u0438\u043d\u0443\u00a0\u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0438 \u0440\u0435\u0437\u043a\u0438\u0435 \u0441\u043a\u0430\u0447\u043a\u0438, \u0438 \u0432\u044b\u0431\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u0446\u0435\u043b\u043e\u043c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c.\u00a0<\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0442\u0430\u043a, \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u043b\u0435\u0440\u0442 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u044d\u0442\u043e \u043d\u0435\u043a\u0440\u0438\u0442\u0438\u0447\u043d\u0430\u044f \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044f. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u043e\u0431\u0430 \u0430\u043b\u0435\u0440\u0442\u0430, \u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0438\u043c\u044b, \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u0430 \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u0441 \u0447\u0435\u043c \u043e\u043d\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b.\u00a0<\/p>\n<pre><code class=\"sql\">SELECT   DISTINCT   r.day,   r.metric,   r.registrations AS daily_fact,   ROUND((r.registrations \/ r.daily_registrations) * 100, 2) AS daily_percent_to_plan,   r.daily_registrations AS daily_plan,   ROUND(r.delta * 100, 2) AS percent_to_prev_day,   CASE WHEN r.registrations &gt; r.positive_limit AND <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-463970","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463970","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=463970"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463970\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=463970"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=463970"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=463970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}