{"id":394172,"date":"2024-06-29T11:27:01","date_gmt":"2024-06-29T11:27:01","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=394172"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=394172","title":{"rendered":"<span>\u0421\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d: \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438<\/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 loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/40b\/900\/6f8\/40b9006f8887777e6ff6974d548b973b.png\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/40b\/900\/6f8\/40b9006f8887777e6ff6974d548b973b.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u0430 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f?<\/h3>\n<p>\u0418\u0442\u0430\u043a, \u0412\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 \u0411\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0414\u0430\u043d\u043d\u044b\u043c\u0438:<\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u0438 \u0437\u0430\u0442\u0440\u0430\u0442 ?)<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f (\u0438\u043b\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f) &#8212; \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u044d\u0442\u043e \u0441\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0435\u0441\u044f \u0444\u0430\u043a\u0442\u044b<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0412\u0430\u043c \u0443\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u0412\u044b \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u0435 \u0432\u0440\u0435\u043c\u044f \u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u044b<\/p>\n<\/li>\n<\/ul>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/300\/004\/a46\/300004a463d248787c2ba67927bbe1f7.gif\" width=\"512\" height=\"512\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/300\/004\/a46\/300004a463d248787c2ba67927bbe1f7.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u0427\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u00a0<strong>\u043d\u043e\u0432\u044b\u0435<\/strong>\u00a0\u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043a\u0430\u043a \u0438\u0445 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c?<\/p>\n<\/li>\n<li>\n<p>\u0427\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u00a0<strong>\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c<\/strong>?<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u043d\u0435 \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0441 \u043a\u043e\u043f\u0438\u044f\u043c\u0438 \u0441\u0442\u0440\u043e\u043a?<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b &#8212; \u043c\u044b \u0441\u0443\u043c\u0435\u0435\u043c \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b3a\/74e\/7bf\/b3a74e7bf0fcd14c509343de7581c28f.png\" width=\"1660\" height=\"563\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b3a\/74e\/7bf\/b3a74e7bf0fcd14c509343de7581c28f.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/h3>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0439\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u043c \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0444\u0435\u0440\u0443 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0433\u043e\u0440\u043e\u0434\u0443:<\/p>\n<ul>\n<li>\n<p>\u0418\u043c\u0435\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 (\u0448\u0438\u0440\u043e\u0442\u0430 \/ \u0434\u043e\u043b\u0433\u043e\u0442\u0430 &#8212; lat \/ lon)<\/p>\n<\/li>\n<li>\n<p>\u0421\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u00a0<strong>\u0413\u0415\u041e-\u0437\u043e\u043d<\/strong>, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u0443\u043b\u0438\u0446\u044b, \u0440\u0430\u0439\u043e\u043d\u044b \u0433\u043e\u0440\u043e\u0434\u0430, \u0432\u043e\u043a\u0437\u0430\u043b\u044b, \u0430\u044d\u0440\u043e\u043f\u043e\u0440\u0442\u044b, Points of interest (\u043c\u0443\u0437\u0435\u0438, \u0442\u043e\u0440\u0433\u043e\u0432\u044b\u0435 \u0446\u0435\u043d\u0442\u0440\u044b \u0438 \u0442.\u0434.)<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c\u00a0<strong>Spatial Join<\/strong>\u00a0\u0432 \u0421\u0423\u0411\u0414, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0413\u0415\u041e-\u0437\u043e\u043d\u0435 (\u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c)<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/538\/6f2\/88d\/5386f288d91bd47eba840e654f00856d.png\" width=\"1200\" height=\"696\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/538\/6f2\/88d\/5386f288d91bd47eba840e654f00856d.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e\u00a0<strong>Spatial Join<\/strong>\u00a0\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e\u0439 (<em>CPU-intensive<\/em>) \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u043e, \u0447\u0442\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043f\u043e\u0435\u0437\u0434\u043a\u0438, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0435\u0451 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f, \u043c\u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"sql\">select      -- IDs         orders.request_id     , orders.city_id      -- PICKUP     , pickup.kind as pickup_kind     , pickup.zone_name as pickup_zone     , coalesce(pickup.is_airport, false) as pickup_is_airport      -- DROPOFF     , dropoff.kind as dropoff_kind     , dropoff.zone_name as dropoff_zone     , coalesce(dropoff.is_airport, false) as dropoff_is_airport      -- METADATA     , orders.__metadata_timestamp  from {{ ref('stg_orders') }} as orders      left join {{ ref('stg_zones') }} as pickup         on ST_Intersects(             ST_Point(orders.pickup_position_lon, orders.pickup_position_lat), pickup.geometry)      left join {{ ref('stg_zones') }} as dropoff         on ST_Intersects(             ST_Point(orders.dropoff_position_lon, orders.dropoff_position_lat), dropoff.geometry)<\/code><\/pre>\n<p>\u042d\u0432\u043e\u043b\u044e\u0446\u0438\u043e\u043d\u043d\u043e, \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0433 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0443\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c\u00a0<strong>VIEW<\/strong>\u00a0\u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441\u0442\u0430\u043d\u0443\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u043b\u0433\u0438\u043c\u0438, \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0432\u0438\u0434\u0435\u00a0<strong>TABLE<\/strong><\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0430\u0441\u0447\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0430\u043d\u0435\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u043b\u0433\u0438\u043c \u0438 \u0434\u043e\u0440\u043e\u0433\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u043c &#8212; \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e\u00a0<strong>INCREMENTAL<\/strong><\/p>\n<\/li>\n<\/ul>\n<h3>\u041a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 DDL\/DML \u043a\u043e\u043c\u0430\u043d\u0434?<\/h3>\n<ol>\n<li>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u2013 \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0435\u0442 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<\/ol>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041f\u043e\u043a\u0430 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432\u0438\u0442\u0440\u0438\u043d\u0430 \u043d\u0438 \u0432 \u043a\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u0430\u0440\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446.<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u2013 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 (\u0434\u0435\u043b\u044c\u0442\u0430 \/ delta)<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043b\u0438\u0431\u043e \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0449\u0438\u0439 \u043a\u043b\u044e\u0447 (<a href=\"https:\/\/www.postgresql.org\/docs\/current\/sql-createsequence.html\"><strong>sequence<\/strong><\/a>), \u043b\u0438\u0431\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430 (<strong>timestamp<\/strong>) \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<p>\u041d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 &#8212; \u0432\u0437\u044f\u0442\u044c \u0442\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435-\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435, \u043d\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0449\u0435 \u043d\u0435\u0442 \u0432 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432\u0438\u0442\u0440\u0438\u043d\u044b.<\/p>\n<pre><code class=\"sql\">create temp table int_requests_zones_tmp as (      select          -- IDs           orders.request_id         , orders.city_id          -- PICKUP         , pickup.kind as pickup_kind         , pickup.zone_name as pickup_zone         , coalesce(pickup.is_airport, false) as pickup_is_airport          -- DROPOFF         , dropoff.kind as dropoff_kind         , dropoff.zone_name as dropoff_zone         , coalesce(dropoff.is_airport, false) as dropoff_is_airport          -- METADATA         , orders.__metadata_timestamp      from {{ ref('stg_orders') }} as orders          left join {{ ref('stg_zones') }} as pickup             on ST_Intersects(                 ST_Point(orders.pickup_position_lon, orders.pickup_position_lat), pickup.geometry)          left join {{ ref('stg_zones') }} as dropoff             on ST_Intersects(                 ST_Point(orders.dropoff_position_lon, orders.dropoff_position_lat), dropoff.geometry)      -- GET DELTA ROWS ONLY     where orders.__metadata_timestamp >=              (select max(__metadata_timestamp) as high_watermark from \"intermediate\".\"int_requests_zones_tmp\")  )<\/code><\/pre>\n<ul>\n<li>\n<p>\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0435\u043b\u044c\u0442\u0443 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0434\u0435\u043b\u044c\u0442\u0430-\u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0445 \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0432\u0438\u0442\u0440\u0438\u043d\u0443.<\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0412\u0430\u043c\u0438 \u0421\u0423\u0411\u0414:<\/p>\n<ul>\n<li>\n<p>DELETE + INSERT (\u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0442\u0440\u043e\u043a \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0446\u0435\u043b\u0438\u043a\u043e\u043c)<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f MERGE (UPSERT) &#8212; \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f UPDATE + INSERT<\/p>\n<\/li>\n<li>\n<p>INSERT OVERWRITE (\u0437\u0430\u043c\u0435\u043d\u0430 \u0446\u0435\u043b\u044b\u0445 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439)<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"sql\">delete from \"intermediate\".\"int_requests_zones_tmp\" where request_id in (select request_id from int_requests_zones_tmp) ;  insert into \"intermediate\".\"int_requests_zones_tmp\" select * from int_requests_zones_tmp ; <\/code><\/pre>\n<p>\u0421\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8cc\/b75\/350\/8ccb75350ebf53fd9c83405b0be71099.png\" width=\"1085\" height=\"282\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8cc\/b75\/350\/8ccb75350ebf53fd9c83405b0be71099.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>dbt \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 incremental<\/h3>\n<p>dbt \u0443\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 \u0443\u0436\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u043e\u0434 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0421\u0423\u0411\u0414, \u0431\u0443\u0434\u044c \u0442\u043e Redshift, Snowflake, BigQuery \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 Clickhouse! \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0440\u044f\u0434\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u0438 Jinja-\u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0431\u043e\u0440 \u0442\u0438\u043f\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438\u00a0<code>incremental<\/code>:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"sql\">{{     config(         materialized='incremental'     ) }}<\/code><\/pre>\n<ul>\n<li>\n<p>\u0424\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f\u00a0<em>\u0434\u0435\u043b\u044c\u0442\u044b<\/em><\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e:<\/p>\n<pre><code class=\"sql\">-- GET DELTA ROWS ONLY where orders.__metadata_timestamp >=          (select max(__metadata_timestamp) as high_watermark from {{ ref('int_requests_zones_tmp') }}) <\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f\u00a0<strong>\u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/strong>\u00a0\u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0441\u0447\u0435\u0442\u0430:<\/p>\n<pre><code class=\"sql\">where true  {% if is_incremental() %} and orders.__metadata_timestamp >= (select max(__metadata_timestamp) as high_watermark from {{ this }}) {% endif %}<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 Jinja:<\/p>\n<p><code>{{ this }}<\/code>\u00a0\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0421\u0423\u0411\u0414, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 dbt (\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044d\u0442\u0430 \u043a\u043e\u043d\u0441\u0443\u0442\u0440\u043a\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f).<\/p>\n<p><code>is_incremental()<\/code>\u00a0\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>True<\/code>\u00a0\u043f\u0440\u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439:<\/p>\n<ul>\n<li>\n<p>\u0412 \u0421\u0423\u0411\u0414 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u0438 dbt<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e\u00a0<code>incremental<\/code>\u00a0(\u0441\u043c. \u043f\u0443\u043d\u043a\u0442 1)<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u0444\u043b\u0430\u0433\u0430\u00a0<code>--full-refresh<\/code>\u00a0(\u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0435\u0442 \u0432\u0438\u0442\u0440\u0438\u043d\u044b)<\/p>\n<\/li>\n<\/ul>\n<h3>\u041e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/h3>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043a\u0430\u043a \u0438 \u043f\u043e\u0447\u0442\u0438 \u0432\u0435\u0437\u0434\u0435, \u0443 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439, \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u043e\u043d\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043e\u043c \u043f\u043e\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<ul>\n<li>\n<p>Late arriving data &#8212; \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043d\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441 \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u043c \u043e\u043a\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (<em>window functions<\/em>), \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0432\u0441\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441\u0442\u0440\u043e\u043a \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0445 \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0432 DWH \u043f\u043e\u0437\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438. \u041e\u0442\u043b\u043e\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043a\u0435\u0439\u0441\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0442\u0435\u0441\u0442\u044b \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ddc\/06b\/ed5\/ddc06bed50058e1289a4f4035c8199bc.png\" width=\"1349\" height=\"117\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ddc\/06b\/ed5\/ddc06bed50058e1289a4f4035c8199bc.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443? \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0444\u0438\u043b\u044c\u0442\u0440 \u043d\u0430\u00a0<strong>look-back period<\/strong>! \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 3 \u0447\u0430\u0441\u0430 \u043d\u0430\u0437\u0430\u0434:<\/p>\n<pre><code class=\"sql\">where true  {% if is_incremental() %}     and orders.__metadata_timestamp >=          (select max(__metadata_timestamp) as high_watermark from {{ this }}) - interval '3 hours' {% endif %} <\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0443\u0436\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u044f \u0441 \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u043f\u0443\u0449\u0443 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0441\u0442\u0440\u043e\u043a\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u044f 100% \u0431\u0443\u0434\u0443 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044a\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u044f\u0434 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439\u00a0<code>DELETE<\/code>\u00a0\/\u00a0<code>INSERT<\/code>\u00a0\/\u00a0<code>MERGE<\/code>, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0447\u0442\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0427\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u0442\u0435\u00a0<strong>trade-off<\/strong>? \u0427\u0442\u043e-\u0442\u043e \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0430\u0435\u043c, \u0447\u0442\u043e-\u0442\u043e \u043f\u043b\u0430\u0442\u0438\u043c.<\/p>\n<p>\u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438\u00a0<em>look-back period<\/em>\u00a0\u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 100% \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f. \u042f \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u043c\u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u043f\u0430\u0443\u0437, \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430\u0445 Extract &amp; Load, \u0447\u0442\u043e\u00a0<em>look-back period<\/em>\u00a0\u0432 3 \u0447\u0430\u0441\u0430 \u0431\u044b\u043b\u043e \u0443\u0436\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u041c\u043e\u0436\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0434\u043e 12, 24 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 48 \u0447\u0430\u0441\u043e\u0432, \u043e\u0434\u043d\u0430\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u0438 \u043d\u0430\u0434 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c.<\/p>\n<p>\u0427\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439\u00a0<strong>Anti-join<\/strong>?<\/p>\n<pre><code class=\"sql\">{% if is_incremental() %}     left join {{ this }}         on orders.request_id = {{ this }}.request_id             and orders.__metadata_timestamp = {{ this }}.__metadata_timestamp          where {{ this }}.request_id is null {% endif %} <\/code><\/pre>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>\u0432\u0437\u044f\u0442\u044c \u043b\u0438\u0431\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 (<code>request_id<\/code>\u00a0\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u00a0<code>{{ this }}<\/code>)<\/p>\n<\/li>\n<li>\n<p>\u043b\u0438\u0431\u043e \u0432\u0437\u044f\u0442\u044c \u0442\u0435\u00a0<code>request_id<\/code>\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u00a0<code>{{ this }}<\/code>\u00a0\u043d\u043e \u0438\u043c\u0435\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u0441\u0432\u0435\u0436\u0438\u0439\u00a0<code>__metadata_timestamp<\/code>\u00a0(\u0437\u0430\u043f\u0438\u0441\u044c \u0431\u044b\u043b\u0430 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441 \u043f\u043e\u043b\u0441\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0441\u0447\u0435\u0442\u0430)<\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043b\u0430\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0432\u0435\u0434\u044c \u043d\u0430\u0448\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u2013 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0440\u0430\u0441\u0447\u0435\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u00a0<strong>\u0434\u0435\u043b\u044c\u0442\u043e\u0439<\/strong>. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u0444\u0438\u043b\u044c\u0442\u0440 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0441\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0442\u0440\u043e\u043a &#8212; \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043c\u044b\u0441\u043b \u0432 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0435\u0442.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u00a0<strong>\u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/strong>\u00a0\u2013 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f 2-\u0445 GEO-spatial joins:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8a5\/602\/5b7\/8a56025b7755442ac55f009dcad97781.png\" width=\"1275\" height=\"520\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8a5\/602\/5b7\/8a56025b7755442ac55f009dcad97781.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u00a0<strong>\u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/strong>\u00a0\u2013 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438, \u043f\u043e\u0442\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d25\/0b7\/9e0\/d250b79e0220263e6e8b41896b001829.png\" width=\"1247\" height=\"517\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d25\/0b7\/9e0\/d250b79e0220263e6e8b41896b001829.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u0418\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f &#8212; \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u043d\u043e \u043d\u0435 \u043f\u0430\u043d\u0430\u0446\u0435\u044f<\/h3>\n<p>\u0418\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 \u043d\u0435\u043a\u0438\u0439\u00a0<strong>tradeoff<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0442 100% \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043a\u043e\u0434\u0430 \u043f\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435\u00a0<strong>\u0434\u0435\u043b\u044c\u0442\u0430-\u0441\u0442\u0440\u043e\u043a<\/strong><\/p>\n<\/li>\n<li>\n<p>\u0412 \u043f\u043e\u0433\u043e\u043d\u0435 \u0437\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0435\u0441\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>Immutable event streams \u2013 append-only \u043f\u043e\u0442\u043e\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438\u00a0<code>updated_at<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430:<\/p>\n<ul>\n<li>\n<p>\u041e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/p>\n<\/li>\n<li>\n<p>\u0427\u0430\u0441\u0442\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u044b\u0445: \u043d\u043e\u0432\u044b\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0440\u043e\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435<\/p>\n<\/li>\n<li>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0442\u0440\u043e\u043a (\u043e\u043a\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438)<\/p>\n<\/li>\n<\/ul>\n<h3>\u0423\u043c\u0435\u043d\u0438\u0435 \u0443\u043f\u0440\u043e\u0449\u0430\u0442\u044c \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0445\u043e\u0442\u044f\u0442 \u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0435 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b<\/h3>\n<p>\u0418\u043d\u0436\u0435\u043d\u0435\u0440\u044b, \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0449\u0438\u0435 \u0448\u0438\u0440\u043e\u043a\u0438\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432, \u043f\u0440\u0430\u043a\u0442\u0438\u043a, \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432, \u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0443\u043c\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0445 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0446\u0435\u043d\u044f\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u044b\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u043e.<\/p>\n<p>\u041d\u0430\u00a0<a href=\"https:\/\/otus.ru\/lessons\/dwh\/\">live-\u0441\u0435\u0441\u0441\u0438\u044f\u0445<\/a>\u00a0\u044f \u0438 \u043c\u043e\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0438 \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u0435\u0439\u0441\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u043e\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 Data Vault<\/p>\n<\/li>\n<li>\n<p>dbt + \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043a \u043d\u0435\u043c\u0443<\/p>\n<\/li>\n<li>\n<p>Data Testing + Slim Continous Integration<\/p>\n<\/li>\n<li>\n<p>Materialized Views<\/p>\n<\/li>\n<li>\n<p>\u0418 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u044b \u043e\u0442\u0440\u0430\u0441\u043b\u0438, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u043d\u0430\u043d\u0438\u044f, \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u042f\u043d\u0434\u0435\u043a\u0441.\u041e\u0431\u043b\u0430\u043a\u0430. \u0415\u0441\u043b\u0438 \u0412\u0430\u043c \u0441\u0442\u0430\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0438\u0437\u0443\u0447\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0435 \u043d\u0430 \u0432\u0435\u0431\u0438\u043d\u0430\u0440\u044b<a href=\"https:\/\/otus.pw\/xQIh\/\"> DWH Analyst<\/a>.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u0432\u043e\u0438\u043c\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f\u043c\u0438, \u043e\u043f\u044b\u0442\u043e\u043c \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430\u043c\u0438 \u044f \u0434\u0435\u043b\u044e\u0441\u044c \u0432 \u0422\u0413-\u043a\u0430\u043d\u0430\u043b\u0435\u00a0<a href=\"https:\/\/t.me\/enthusiastech\">Technology Enthusiast<\/a>.<\/p>\n<p>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439, \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u0438 \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0435\u0448\u0430\u043b\u0438 \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443?<\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e!<\/p>\n<\/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\/660677\/\"> https:\/\/habr.com\/ru\/articles\/660677\/<\/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\"><figcaption><\/figcaption><\/figure>\n<h3>\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u0430 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f?<\/h3>\n<p>\u0418\u0442\u0430\u043a, \u0412\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 \u0411\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0414\u0430\u043d\u043d\u044b\u043c\u0438:<\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u0438 \u0437\u0430\u0442\u0440\u0430\u0442 ?)<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f (\u0438\u043b\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f) &#8212; \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u044d\u0442\u043e \u0441\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0435\u0441\u044f \u0444\u0430\u043a\u0442\u044b<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0412\u0430\u043c \u0443\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u0412\u044b \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u0435 \u0432\u0440\u0435\u043c\u044f \u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u044b<\/p>\n<\/li>\n<\/ul>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u0427\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u00a0<strong>\u043d\u043e\u0432\u044b\u0435<\/strong>\u00a0\u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043a\u0430\u043a \u0438\u0445 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c?<\/p>\n<\/li>\n<li>\n<p>\u0427\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u00a0<strong>\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c<\/strong>?<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u043d\u0435 \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0441 \u043a\u043e\u043f\u0438\u044f\u043c\u0438 \u0441\u0442\u0440\u043e\u043a?<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b &#8212; \u043c\u044b \u0441\u0443\u043c\u0435\u0435\u043c \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c!<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/h3>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0439\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u043c \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0444\u0435\u0440\u0443 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0433\u043e\u0440\u043e\u0434\u0443:<\/p>\n<ul>\n<li>\n<p>\u0418\u043c\u0435\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 (\u0448\u0438\u0440\u043e\u0442\u0430 \/ \u0434\u043e\u043b\u0433\u043e\u0442\u0430 &#8212; lat \/ lon)<\/p>\n<\/li>\n<li>\n<p>\u0421\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u00a0<strong>\u0413\u0415\u041e-\u0437\u043e\u043d<\/strong>, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u0443\u043b\u0438\u0446\u044b, \u0440\u0430\u0439\u043e\u043d\u044b \u0433\u043e\u0440\u043e\u0434\u0430, \u0432\u043e\u043a\u0437\u0430\u043b\u044b, \u0430\u044d\u0440\u043e\u043f\u043e\u0440\u0442\u044b, Points of interest (\u043c\u0443\u0437\u0435\u0438, \u0442\u043e\u0440\u0433\u043e\u0432\u044b\u0435 \u0446\u0435\u043d\u0442\u0440\u044b \u0438 \u0442.\u0434.)<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c\u00a0<strong>Spatial Join<\/strong>\u00a0\u0432 \u0421\u0423\u0411\u0414, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0413\u0415\u041e-\u0437\u043e\u043d\u0435 (\u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c)<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e\u00a0<strong>Spatial Join<\/strong>\u00a0\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e\u0439 (<em>CPU-intensive<\/em>) \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u043e, \u0447\u0442\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043f\u043e\u0435\u0437\u0434\u043a\u0438, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0435\u0451 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f, \u043c\u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"sql\">select      -- IDs         orders.request_id     , orders.city_id      -- PICKUP     , pickup.kind as pickup_kind     , pickup.zone_name as pickup_zone     , coalesce(pickup.is_airport, false) as pickup_is_airport      -- DROPOFF     , dropoff.kind as dropoff_kind     , dropoff.zone_name as dropoff_zone     , coalesce(dropoff.is_airport, false) as dropoff_is_airport      -- METADATA     , orders.__metadata_timestamp  from {{ ref('stg_orders') }} as orders      left join {{ ref('stg_zones') }} as pickup         on ST_Intersects(             ST_Point(orders.pickup_position_lon, orders.pickup_position_lat), pickup.geometry)      left join {{ ref('stg_zones') }} as dropoff         on ST_Intersects(             ST_Point(orders.dropoff_position_lon, orders.dropoff_position_lat), dropoff.geometry)<\/code><\/pre>\n<p>\u042d\u0432\u043e\u043b\u044e\u0446\u0438\u043e\u043d\u043d\u043e, \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0433 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0443\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c\u00a0<strong>VIEW<\/strong>\u00a0\u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441\u0442\u0430\u043d\u0443\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u043b\u0433\u0438\u043c\u0438, \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0432\u0438\u0434\u0435\u00a0<strong>TABLE<\/strong><\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0430\u0441\u0447\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0430\u043d\u0435\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u043b\u0433\u0438\u043c \u0438 \u0434\u043e\u0440\u043e\u0433\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u043c &#8212; \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e\u00a0<strong>INCREMENTAL<\/strong><\/p>\n<\/li>\n<\/ul>\n<h3>\u041a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 DDL\/DML \u043a\u043e\u043c\u0430\u043d\u0434?<\/h3>\n<ol>\n<li>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u2013 \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0435\u0442 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<\/ol>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041f\u043e\u043a\u0430 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432\u0438\u0442\u0440\u0438\u043d\u0430 \u043d\u0438 \u0432 \u043a\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u0430\u0440\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446.<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u2013 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 (\u0434\u0435\u043b\u044c\u0442\u0430 \/ delta)<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043b\u0438\u0431\u043e \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0449\u0438\u0439 \u043a\u043b\u044e\u0447 (<a href=\"https:\/\/www.postgresql.org\/docs\/current\/sql-createsequence.html\"><strong>sequence<\/strong><\/a>), \u043b\u0438\u0431\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430 (<strong>timestamp<\/strong>) \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<p>\u041d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 &#8212; \u0432\u0437\u044f\u0442\u044c \u0442\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435-\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435, \u043d\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0449\u0435 \u043d\u0435\u0442 \u0432 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432\u0438\u0442\u0440\u0438\u043d\u044b.<\/p>\n<pre><code class=\"sql\">create temp table int_requests_zones_tmp as (      select          -- IDs           orders.request_id         , orders.city_id          -- PICKUP         , pickup.kind as pickup_kind         , pickup.zone_name as pickup_zone         , coalesce(pickup.is_airport, false) as pickup_is_airport          -- DROPOFF         , dropoff.kind as dropoff_kind         , dropoff.zone_name as dropoff_zone         , coalesce(dropoff.is_airport, false) as dropoff_is_airport          -- METADATA         , orders.__metadata_timestamp      from {{ ref('stg_orders') }} as orders          left join {{ ref('stg_zones') }} as pickup             on ST_Intersects(                 ST_Point(orders.pickup_position_lon, orders.pickup_position_lat), pickup.geometry)          left join {{ ref('stg_zones') }} as dropoff             on ST_Intersects(                 ST_Point(orders.dropoff_position_lon, orders.dropoff_position_lat), dropoff.geometry)      -- GET DELTA ROWS ONLY     where orders.__metadata_timestamp >=              (select max(__metadata_timestamp) as high_watermark from \"intermediate\".\"int_requests_zones_tmp\")  )<\/code><\/pre>\n<ul>\n<li>\n<p>\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0435\u043b\u044c\u0442\u0443 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0434\u0435\u043b\u044c\u0442\u0430-\u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0445 \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0432\u0438\u0442\u0440\u0438\u043d\u0443.<\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0412\u0430\u043c\u0438 \u0421\u0423\u0411\u0414:<\/p>\n<ul>\n<li>\n<p>DELETE + INSERT (\u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0442\u0440\u043e\u043a \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0446\u0435\u043b\u0438\u043a\u043e\u043c)<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f MERGE (UPSERT) &#8212; \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f UPDATE + INSERT<\/p>\n<\/li>\n<li>\n<p>INSERT OVERWRITE (\u0437\u0430\u043c\u0435\u043d\u0430 \u0446\u0435\u043b\u044b\u0445 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439)<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"sql\">delete from \"intermediate\".\"int_requests_zones_tmp\" where request_id in (select request_id from int_requests_zones_tmp) ;  insert into \"intermediate\".\"int_requests_zones_tmp\" select * from int_requests_zones_tmp ; <\/code><\/pre>\n<p>\u0421\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>dbt \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 incremental<\/h3>\n<p>dbt \u0443\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 \u0443\u0436\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u043e\u0434 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0421\u0423\u0411\u0414, \u0431\u0443\u0434\u044c \u0442\u043e Redshift, Snowflake, BigQuery \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 Clickhouse! \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0440\u044f\u0434\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u0438 Jinja-\u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0431\u043e\u0440 \u0442\u0438\u043f\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438\u00a0<code>incremental<\/code>:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"sql\">{{     config(         materialized='incremental'     ) }}<\/code><\/pre>\n<ul>\n<li>\n<p>\u0424\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f\u00a0<em>\u0434\u0435\u043b\u044c\u0442\u044b<\/em><\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e:<\/p>\n<pre><code class=\"sql\">-- GET DELTA ROWS ONLY where orders.__metadata_timestamp >=          (select max(__metadata_timestamp) as high_watermark from {{ ref('int_requests_zones_tmp') }}) <\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f\u00a0<strong>\u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/strong>\u00a0\u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0441\u0447\u0435\u0442\u0430:<\/p>\n<pre><code class=\"sql\">where true  {% if is_incremental() %} and orders.__metadata_timestamp >= (select max(__metadata_timestamp) as high_watermark from {{ this }}) {% endif %}<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 Jinja:<\/p>\n<p><code>{{ this }}<\/code>\u00a0\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0421\u0423\u0411\u0414, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 dbt (\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044d\u0442\u0430 \u043a\u043e\u043d\u0441\u0443\u0442\u0440\u043a\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f).<\/p>\n<p><code>is_incremental()<\/code>\u00a0\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>True<\/code>\u00a0\u043f\u0440\u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439:<\/p>\n<ul>\n<li>\n<p>\u0412 \u0421\u0423\u0411\u0414 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u0438 dbt<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e\u00a0<code>incremental<\/code>\u00a0(\u0441\u043c. \u043f\u0443\u043d\u043a\u0442 1)<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u0444\u043b\u0430\u0433\u0430\u00a0<code>--full-refresh<\/code>\u00a0(\u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0435\u0442 \u0432\u0438\u0442\u0440\u0438\u043d\u044b)<\/p>\n<\/li>\n<\/ul>\n<h3>\u041e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/h3>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043a\u0430\u043a \u0438 \u043f\u043e\u0447\u0442\u0438 \u0432\u0435\u0437\u0434\u0435, \u0443 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439, \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u043e\u043d\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043e\u043c \u043f\u043e\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<ul>\n<li>\n<p>Late arriving data &#8212; \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043d\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441 \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u043c \u043e\u043a\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (<em>window functions<\/em>), \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0432\u0441\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441\u0442\u0440\u043e\u043a \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0445 \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0432 DWH \u043f\u043e\u0437\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438. \u041e\u0442\u043b\u043e\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043a\u0435\u0439\u0441\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0442\u0435\u0441\u0442\u044b \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443? \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0444\u0438\u043b\u044c\u0442\u0440 \u043d\u0430\u00a0<strong>look-back period<\/strong>! \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 3 \u0447\u0430\u0441\u0430 \u043d\u0430\u0437\u0430\u0434:<\/p>\n<pre><code class=\"sql\">where true  {% if is_incremental() %}     and orders.__metadata_timestamp >=          (select max(__metadata_timestamp) as high_watermark from {{ this }}) - interval '3 hours' {% endif %} <\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0443\u0436\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u044f \u0441 \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u043f\u0443\u0449\u0443 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0441\u0442\u0440\u043e\u043a\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u044f 100% \u0431\u0443\u0434\u0443 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044a\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u044f\u0434 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439\u00a0<code>DELETE<\/code>\u00a0\/\u00a0<code>INSERT<\/code>\u00a0\/\u00a0<code>MERGE<\/code>, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0447\u0442\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0427\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u0442\u0435\u00a0<strong>trade-off<\/strong>? \u0427\u0442\u043e-\u0442\u043e \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0430\u0435\u043c, \u0447\u0442\u043e-\u0442\u043e \u043f\u043b\u0430\u0442\u0438\u043c.<\/p>\n<p>\u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438\u00a0<em>look-back period<\/em>\u00a0\u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 100% \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f. \u042f \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u043c\u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u043f\u0430\u0443\u0437, \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430\u0445 Extract &amp; Load, \u0447\u0442\u043e\u00a0<em>look-back period<\/em>\u00a0\u0432 3 \u0447\u0430\u0441\u0430 \u0431\u044b\u043b\u043e \u0443\u0436\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u041c\u043e\u0436\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0434\u043e 12, 24 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 48 \u0447\u0430\u0441\u043e\u0432, \u043e\u0434\u043d\u0430\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u0438 \u043d\u0430\u0434 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c.<\/p>\n<p>\u0427\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439\u00a0<strong>Anti-join<\/strong>?<\/p>\n<pre><code class=\"sql\">{% if is_incremental() %}     left join {{ this }}         on orders.request_id = {{ this }}.request_id             and orders.__metadata_timestamp = {{ this }}.__metadata_timestamp          where {{ this }}.request_id is null {% endif %} <\/code><\/pre>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>\u0432\u0437\u044f\u0442\u044c \u043b\u0438\u0431\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 (<code>request_id<\/code>\u00a0\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u00a0<code>{{ this }}<\/code>)<\/p>\n<\/li>\n<li>\n<p>\u043b\u0438\u0431\u043e \u0432\u0437\u044f\u0442\u044c \u0442\u0435\u00a0<code>request_id<\/code>\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u00a0<code>{{ this }}<\/code>\u00a0\u043d\u043e \u0438\u043c\u0435\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u0441\u0432\u0435\u0436\u0438\u0439\u00a0<code>__metadata_timestamp<\/code>\u00a0(\u0437\u0430\u043f\u0438\u0441\u044c \u0431\u044b\u043b\u0430 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441 \u043f\u043e\u043b\u0441\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0441\u0447\u0435\u0442\u0430)<\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043b\u0430\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0432\u0435\u0434\u044c \u043d\u0430\u0448\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u2013 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0440\u0430\u0441\u0447\u0435\u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u00a0<strong>\u0434\u0435\u043b\u044c\u0442\u043e\u0439<\/strong>. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u0444\u0438\u043b\u044c\u0442\u0440 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0441\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0442\u0440\u043e\u043a &#8212; \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043c\u044b\u0441\u043b \u0432 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0435\u0442.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u00a0<strong>\u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/strong>\u00a0\u2013 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f 2-\u0445 GEO-spatial joins:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u00a0<strong>\u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/strong>\u00a0\u2013 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438, \u043f\u043e\u0442\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>\u0418\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f &#8212; \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u043d\u043e \u043d\u0435 \u043f\u0430\u043d\u0430\u0446\u0435\u044f<\/h3>\n<p>\u0418\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 \u043d\u0435\u043a\u0438\u0439\u00a0<strong>tradeoff<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0442\u0430\u043a\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0442 100% \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043a\u043e\u0434\u0430 \u043f\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435\u00a0<strong>\u0434\u0435\u043b\u044c\u0442\u0430-\u0441\u0442\u0440\u043e\u043a<\/strong><\/p>\n<\/li>\n<li>\n<p>\u0412 \u043f\u043e\u0433\u043e\u043d\u0435 \u0437\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0435\u0441\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>Immutable event streams \u2013 append-only \u043f\u043e\u0442\u043e\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438\u00a0<code>updated_at<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430:<\/p>\n<ul>\n<li>\n<p>\u041e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/p>\n<\/li>\n<li>\n<p>\u0427\u0430\u0441\u0442\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u044b\u0445: \u043d\u043e\u0432\u044b\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0440\u043e\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435<\/p>\n<\/li>\n<li>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0442\u0440\u043e\u043a (\u043e\u043a\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438)<\/p>\n<\/li>\n<\/ul>\n<h3>\u0423\u043c\u0435\u043d\u0438\u0435 \u0443\u043f\u0440\u043e\u0449\u0430\u0442\u044c \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0445\u043e\u0442\u044f\u0442 \u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0435 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b<\/h3>\n<p>\u0418\u043d\u0436\u0435\u043d\u0435\u0440\u044b, \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0449\u0438\u0435 \u0448\u0438\u0440\u043e\u043a\u0438\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432, \u043f\u0440\u0430\u043a\u0442\u0438\u043a, \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432, \u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, <\/p>\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-394172","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/394172","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=394172"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/394172\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=394172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=394172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=394172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}