{"id":453211,"date":"2025-03-25T03:03:55","date_gmt":"2025-03-25T03:03:55","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=453211"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=453211","title":{"rendered":"<span>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 ClickHouse \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0445\u0435\u0448\u0435\u0439<\/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<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0438\u043b\u0438 \u043e\u0442\u0447\u0435\u0442\u044b \u0441 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0435\u0439, \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u043a\u0430\u043a \u0434\u043b\u044f UI (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432), \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u043e\u0442\u0447\u0435\u0442\u043e\u0432 \u0438\u043b\u0438 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u043e\u0432. \u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0435\u0439, \u0431\u0435\u0437 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0438\u0442\u043e\u0433\u043e\u0432 \u0438 \u0442.\u0434., \u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e UI \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u044d\u0442\u043e\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0441 UI \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434 \u0438 \u0434\u0430\u043b\u044c\u0448\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0432\u0438\u0434\u0435 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0421\u0423\u0411\u0414 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u041f\u0440\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u0432 10 \u0443\u0440\u043e\u0432\u043d\u0435\u0439), \u043f\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u00ab\u0432 \u043b\u043e\u0431\u00bb \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 10 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438, \u0441\u0442\u0430\u043d\u0435\u0442 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441 UI \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434 (\u0434\u043b\u044f 1000 \u0441\u0442\u0440\u043e\u043a \u0438 10 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0436\u0435 \u0443\u0441\u043b\u043e\u0432\u043d\u043e 10000 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432), \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0442\u0435\u0442 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 SQL, \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0443\u0441\u0443\u0433\u0443\u0431\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 SQL \u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 ClickHouse, \u0430 \u0435\u0449\u0451 \u044d\u0442\u0438 10000 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u00ab\u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0443\u044e\u0442\u00bb \u0438\u0437 UI \u0432 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0432 ClickHouse. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0434\u043d\u043e \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 C# \u0438 ClickHouse, \u043d\u043e \u044d\u0442\u043e \u00ab\u043d\u0435 \u0438\u0434\u0435\u0438, \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0435 \u043d\u0430\u00a0\u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435\u00bb, \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0435\u043c\u0430 \u043a \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044e. \u0422\u0435\u043c, \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 C# \u0438 ClickHouse\u00a0\u2014 \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442 \ud83d\ude42<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430), \u043f\u0440\u0438\u0447\u0435\u043c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 2 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430, 3 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, 2 \u0441\u043a\u043b\u0430\u0434\u0430, \u0432\u0441\u0435\u0433\u043e 12 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0438\u0437 \u043d\u0438\u0445 3 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u044b.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cad\/088\/1e4\/cad0881e4341b2fb94cbc30ae3735630.png\" width=\"195\" height=\"221\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cad\/088\/1e4\/cad0881e4341b2fb94cbc30ae3735630.png\"\/><\/figure>\n<p>\u0414\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0445\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 ClickHouse \u0438 12 \u0441\u0442\u0440\u043e\u043a \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code>CREATE OR REPLACE TABLE sales ( \u00a0\u00a0\u00a0order_number Int64, \u00a0\u00a0\u00a0amount \u00a0 \u00a0 \u00a0 Float64, \u00a0\u00a0\u00a0order_date \u00a0 Date, \u00a0\u00a0\u00a0product_id \u00a0 Int64, \u00a0\u00a0\u00a0customer_id\u00a0 Int64, \u00a0\u00a0\u00a0store_id \u00a0 \u00a0 Int64 ) ENGINE = Log;  INSERT INTO sales SELECT toString(1000000000 + number)   AS order_number, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0number % 100\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0    AS amount, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0dateAdd(number % 700, toDate('2023-01-01')), \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0number \/ 6 % 2 + 1 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 AS product_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0number \/ 2 % 3 + 1 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 AS customer_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0number % 2 + 1\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0    AS store_id FROM system.numbers LIMIT 12;<\/code><\/pre>\n<p>ClickHouse \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <code>murmurHash2_32<\/code>, \u0438 \u0437\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/MurmurHash2\" rel=\"noopener noreferrer nofollow\"><code>MurmurHash2<\/code><\/a> \u0434\u043b\u044f \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u0442.\u043a. \u043e\u043d \u0431\u044b\u0441\u0442\u0440\u044b\u0439, \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d, \u0438 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0445\u0435\u0448\u0435\u0439\u00a0\u2014 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0449\u0451 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u0447\u0435\u043c \u0432 <a href=\"https:\/\/github.com\/ClickHouse\/ClickHouse\/blob\/5b0fb3e3dff551c7bc3150083db1622c229825fb\/src\/Functions\/FunctionsHashing.h#L368\" rel=\"noopener noreferrer nofollow\">ClickHouse<\/a>, \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0442.\u0435. \u043e\u0431\u044b\u0447\u043d\u044b\u0439 XOR \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0445\u0435\u0448\u0435\u0439. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0445\u0435\u0448 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u0442.\u0434.<\/p>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0445\u0435\u0448\u0438 \u0432\u0438\u0434\u0430:<\/p>\n<pre><code>SELECT murmurHash2_32(product_id) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0AS product_id_hash, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0murmurHash2_32(bitXor(customer_id, product_id_hash)) AS customer_id_hash, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0murmurHash2_32(bitXor(store_id, customer_id_hash)) \u00a0 AS store_id_hash, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0order_number, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0amount, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0order_date, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0product_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0customer_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0store_id FROM sales;<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430 (\u0432 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u2014 \u0442\u043e, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u0443 \u0438\u0437 UI, \u043f\u043e\u043a\u0430 \u0431\u0435\u0437 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438):<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/087\/39e\/871\/08739e871f84ae890edf50e077827219.png\" width=\"1600\" height=\"299\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/087\/39e\/871\/08739e871f84ae890edf50e077827219.png\"\/><\/figure>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u0430\u0435\u043c <code>MurmurHash2<\/code> <a href=\"https:\/\/dotnetfiddle.net\/xNlucq\" rel=\"noopener noreferrer nofollow\">\u043d\u0430 C#<\/a> \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a, \u0442.\u0435. \u0434\u043b\u044f Product #1 \u0438 Customer #1 (\u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0443\u043c \u0441\u043a\u043b\u0430\u0434\u0430\u043c, Store #1 \u0438 Store #2).<\/p>\n<pre><code class=\"cs\">using System;  public class MurmurHash2 { \u00a0\u00a0\u00a0\u00a0public static uint Hash(byte[] data, uint seed = 0) \u00a0\u00a0\u00a0\u00a0{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0const uint m = 0x5bd1e995; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0const int r = 24;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0int length = data.Length; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0uint h = seed ^ (uint)length;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0int i = 0; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0while (length &gt;= 4) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0uint k = BitConverter.ToUInt32(data, i); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0k *= m; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0k ^= k &gt;&gt; r; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0k *= m; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h *= m; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h ^= k; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0i += 4; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0length -= 4; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0switch (length) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0case 3: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h ^= (uint)(data[i + 2] &lt;&lt; 16); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0goto case 2; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0case 2: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h ^= (uint)(data[i + 1] &lt;&lt; 8); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0goto case 1; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0case 1: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h ^= data[i]; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h *= m; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0break; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h ^= h &gt;&gt; 13; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h *= m; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h ^= h &gt;&gt; 15; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return h; \u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0public static void Main(string[] args) \u00a0\u00a0\u00a0\u00a0{ const UInt64 product1 = 1; const UInt64 customer1 = 1; var bytesProduct1 = BitConverter.GetBytes(product1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0UInt64 hashProduct1 = Hash(bytesProduct1); var combinedProduct1Customer1 = (hashProduct1 ^ customer1); var bytesCombinedProduct1Customer1 = BitConverter.GetBytes(combinedProduct1Customer1); UInt64 hashCombinedProduct1Customer1 = Hash(bytesCombinedProduct1Customer1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.WriteLine($\"Hash value: {hashProduct1}, {hashCombinedProduct1Customer1}\"); \u00a0\u00a0\u00a0\u00a0} }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 C# \u043a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0445\u0435\u0448\u0438 \u0434\u043b\u044f \u0443\u0440\u043e\u0432\u043d\u044f Product \u0438 \u0434\u043b\u044f \u0443\u0440\u043e\u0432\u043d\u044f Customer: <code>Hash\u00a0value:\u00a03340017859,\u00a01304444856<\/code>. \u0414\u043b\u044f Store \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432 C#, \u0442.\u043a. \u043d\u0430\u0441 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442 \u043e\u0431\u0430 \u0441\u043a\u043b\u0430\u0434\u0430 Store #1 \u0438 Store #2.<\/p>\n<p>SQL \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u043b\u043e\u0431 (\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432 WHERE, \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438):<\/p>\n<pre><code>SELECT order_number, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0amount, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0order_date, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0product_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0customer_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0store_id FROM sales WHERE product_id = 1 AND customer_id = 1 AND store_id = 1 \u00a0\u00a0OR product_id = 1 AND customer_id = 1 AND store_id = 2 \u00a0\u00a0OR product_id = 1 AND customer_id = 3 AND store_id = 2;<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/67f\/c2f\/fce\/67fc2ffcef47846fa62aa6101fc8652b.png\" width=\"1472\" height=\"140\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/67f\/c2f\/fce\/67fc2ffcef47846fa62aa6101fc8652b.png\"\/><\/figure>\n<p>\u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u0434\u043b\u044f 12 \u0441\u0442\u0440\u043e\u043a \u0438 \u0442\u0440\u0435\u0445 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0443\u0436\u0435 9 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>SQL \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0445\u0435\u0448\u0438 \u0434\u043b\u044f \u0442\u0440\u0435\u0445 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0438\u0437 UI \u0444\u0438\u043b\u044c\u0442\u0440\u0430, \u043f\u0440\u0438\u0447\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e \u0445\u0435\u0448\u0443 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 Customer \u0434\u0430\u0435\u0442 \u0434\u0432\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 (\u0441\u043e Store #1 \u0438 Store #2), \u0438 \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 Store \u0434\u0430\u0435\u0442 \u043e\u0434\u043d\u0443 \u0437\u0430\u043f\u0438\u0441\u044c:<\/p>\n<pre><code>SELECT murmurHash2_32(product_id) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0AS product_id_hash, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0murmurHash2_32(bitXor(customer_id, product_id_hash)) AS customer_id_hash, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0murmurHash2_32(bitXor(store_id, customer_id_hash)) \u00a0 AS store_id_hash, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0order_number, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0amount, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0order_date, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0product_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0customer_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0store_id FROM sales WHERE customer_id_hash = 1304444856 OR store_id_hash = 3547175208;<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3d7\/82b\/936\/3d782b936b2959d2a31c313c31c03fc9.png\" width=\"1600\" height=\"98\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3d7\/82b\/936\/3d782b936b2959d2a31c313c31c03fc9.png\"\/><\/figure>\n<p>\u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0432 WHERE \u0441 \u0445\u0435\u0448\u0430\u043c\u0438 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u0430 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0438 9.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u0438\u0434\u043d\u044b \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0445\u0435\u0448\u0430\u043c\u0438, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439\u00a0\u2014 \u0438\u0445 \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c, \u0442.\u043a. \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e. \u0422\u0430\u043a\u0436\u0435 \u043b\u0435\u0433\u043a\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0432\u0441\u0435\u0433\u043e 2 \u0445\u0435\u0448\u0430 \u0432\u043c\u0435\u0441\u0442\u043e 9 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 WHERE), \u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u2014 \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0445\u0435\u0448\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043b\u044e\u0441\u043e\u043c \u0438 \u043f\u0440\u0438 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0438\u0445 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0445\u0435\u0448 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u0442.\u0434.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0432\u0438\u0434\u0435, \u0438\u043b\u0438 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u0442 \u043d\u0430 \u043b\u0443\u0447\u0448\u0435\u0435 \ud83d\ude42<\/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\/893628\/\"> https:\/\/habr.com\/ru\/articles\/893628\/<\/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<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0438\u043b\u0438 \u043e\u0442\u0447\u0435\u0442\u044b \u0441 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0435\u0439, \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u043a\u0430\u043a \u0434\u043b\u044f UI (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432), \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u043e\u0442\u0447\u0435\u0442\u043e\u0432 \u0438\u043b\u0438 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u043e\u0432. \u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0435\u0439, \u0431\u0435\u0437 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0438\u0442\u043e\u0433\u043e\u0432 \u0438 \u0442.\u0434., \u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e UI \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u044d\u0442\u043e\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0441 UI \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434 \u0438 \u0434\u0430\u043b\u044c\u0448\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0432\u0438\u0434\u0435 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0421\u0423\u0411\u0414 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u041f\u0440\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u0432 10 \u0443\u0440\u043e\u0432\u043d\u0435\u0439), \u043f\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u00ab\u0432 \u043b\u043e\u0431\u00bb \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 10 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438, \u0441\u0442\u0430\u043d\u0435\u0442 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441 UI \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434 (\u0434\u043b\u044f 1000 \u0441\u0442\u0440\u043e\u043a \u0438 10 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0436\u0435 \u0443\u0441\u043b\u043e\u0432\u043d\u043e 10000 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432), \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0442\u0435\u0442 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 SQL, \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0443\u0441\u0443\u0433\u0443\u0431\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 SQL \u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 ClickHouse, \u0430 \u0435\u0449\u0451 \u044d\u0442\u0438 10000 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u00ab\u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0443\u044e\u0442\u00bb \u0438\u0437 UI \u0432 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0432 ClickHouse. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0434\u043d\u043e \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 C# \u0438 ClickHouse, \u043d\u043e \u044d\u0442\u043e \u00ab\u043d\u0435 \u0438\u0434\u0435\u0438, \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0435 \u043d\u0430\u00a0\u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435\u00bb, \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0435\u043c\u0430 \u043a \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044e. \u0422\u0435\u043c, \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 C# \u0438 ClickHouse\u00a0\u2014 \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442 \ud83d\ude42<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430), \u043f\u0440\u0438\u0447\u0435\u043c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 2 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430, 3 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, 2 \u0441\u043a\u043b\u0430\u0434\u0430, \u0432\u0441\u0435\u0433\u043e 12 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0438\u0437 \u043d\u0438\u0445 3 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u044b.<\/p>\n<figure class=\"\"><\/figure>\n<p>\u0414\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0445\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 ClickHouse \u0438 12 \u0441\u0442\u0440\u043e\u043a \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code>CREATE OR REPLACE TABLE sales ( \u00a0\u00a0\u00a0order_number Int64, \u00a0\u00a0\u00a0amount \u00a0 \u00a0 \u00a0 Float64, \u00a0\u00a0\u00a0order_date \u00a0 Date, \u00a0\u00a0\u00a0product_id \u00a0 Int64, \u00a0\u00a0\u00a0customer_id\u00a0 Int64, \u00a0\u00a0\u00a0store_id \u00a0 \u00a0 Int64 ) ENGINE = Log;  INSERT INTO sales SELECT toString(1000000000 + number)   AS order_number, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0number % 100\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0    AS amount, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0dateAdd(number % 700, toDate('2023-01-01')), \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0number \/ 6 % 2 + 1 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 AS product_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0number \/ 2 % 3 + 1 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 AS customer_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0number % 2 + 1\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0    AS store_id FROM system.numbers LIMIT 12;<\/code><\/pre>\n<p>ClickHouse \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <code>murmurHash2_32<\/code>, \u0438 \u0437\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/MurmurHash2\" rel=\"noopener noreferrer nofollow\"><code>MurmurHash2<\/code><\/a> \u0434\u043b\u044f \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u0442.\u043a. \u043e\u043d \u0431\u044b\u0441\u0442\u0440\u044b\u0439, \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d, \u0438 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0445\u0435\u0448\u0435\u0439\u00a0\u2014 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0449\u0451 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u0447\u0435\u043c \u0432 <a href=\"https:\/\/github.com\/ClickHouse\/ClickHouse\/blob\/5b0fb3e3dff551c7bc3150083db1622c229825fb\/src\/Functions\/FunctionsHashing.h#L368\" rel=\"noopener noreferrer nofollow\">ClickHouse<\/a>, \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0442.\u0435. \u043e\u0431\u044b\u0447\u043d\u044b\u0439 XOR \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0445\u0435\u0448\u0435\u0439. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0445\u0435\u0448 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u0442.\u0434.<\/p>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0445\u0435\u0448\u0438 \u0432\u0438\u0434\u0430:<\/p>\n<pre><code>SELECT murmurHash2_32(product_id) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0AS product_id_hash, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0murmurHash2_32(bitXor(customer_id, product_id_hash)) AS customer_id_hash, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0murmurHash2_32(bitXor(store_id, customer_id_hash)) \u00a0 AS store_id_hash, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0order_number, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0amount, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0order_date, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0product_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0customer_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0store_id FROM sales;<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430 (\u0432 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u2014 \u0442\u043e, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u0443 \u0438\u0437 UI, \u043f\u043e\u043a\u0430 \u0431\u0435\u0437 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438):<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u0430\u0435\u043c <code>MurmurHash2<\/code> <a href=\"https:\/\/dotnetfiddle.net\/xNlucq\" rel=\"noopener noreferrer nofollow\">\u043d\u0430 C#<\/a> \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a, \u0442.\u0435. \u0434\u043b\u044f Product #1 \u0438 Customer #1 (\u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0443\u043c \u0441\u043a\u043b\u0430\u0434\u0430\u043c, Store #1 \u0438 Store #2).<\/p>\n<pre><code class=\"cs\">using System;  public class MurmurHash2 { \u00a0\u00a0\u00a0\u00a0public static uint Hash(byte[] data, uint seed = 0) \u00a0\u00a0\u00a0\u00a0{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0const uint m = 0x5bd1e995; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0const int r = 24;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0int length = data.Length; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0uint h = seed ^ (uint)length;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0int i = 0; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0while (length &gt;= 4) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0uint k = BitConverter.ToUInt32(data, i); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0k *= m; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0k ^= k &gt;&gt; r; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0k *= m; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h *= m; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h ^= k; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0i += 4; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0length -= 4; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0switch (length) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0case 3: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h ^= (uint)(data[i + 2] &lt;&lt; 16); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0goto case 2; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0case 2: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h ^= (uint)(data[i + 1] &lt;&lt; 8); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0goto case 1; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0case 1: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h ^= data[i]; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h *= m; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0break; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h ^= h &gt;&gt; 13; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h *= m; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0h ^= h &gt;&gt; 15; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return h; \u00a0\u00a0\u00a0\u00a0}  \u00a0\u00a0\u00a0\u00a0public static void Main(string[] args) \u00a0\u00a0\u00a0\u00a0{ const UInt64 product1 = 1; const UInt64 customer1 = 1; var bytesProduct1 = BitConverter.GetBytes(product1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0UInt64 hashProduct1 = Hash(bytesProduct1); var combinedProduct1Customer1 = (hashProduct1 ^ customer1); var bytesCombinedProduct1Customer1 = BitConverter.GetBytes(combinedProduct1Customer1); UInt64 hashCombinedProduct1Customer1 = Hash(bytesCombinedProduct1Customer1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.WriteLine($\"Hash value: {hashProduct1}, {hashCombinedProduct1Customer1}\"); \u00a0\u00a0\u00a0\u00a0} }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 C# \u043a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0445\u0435\u0448\u0438 \u0434\u043b\u044f \u0443\u0440\u043e\u0432\u043d\u044f Product \u0438 \u0434\u043b\u044f \u0443\u0440\u043e\u0432\u043d\u044f Customer: <code>Hash\u00a0value:\u00a03340017859,\u00a01304444856<\/code>. \u0414\u043b\u044f Store \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432 C#, \u0442.\u043a. \u043d\u0430\u0441 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442 \u043e\u0431\u0430 \u0441\u043a\u043b\u0430\u0434\u0430 Store #1 \u0438 Store #2.<\/p>\n<p>SQL \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u043b\u043e\u0431 (\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432 WHERE, \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438):<\/p>\n<pre><code>SELECT order_number, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0amount, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0order_date, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0product_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0customer_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0store_id FROM sales WHERE product_id = 1 AND customer_id = 1 AND store_id = 1 \u00a0\u00a0OR product_id = 1 AND customer_id = 1 AND store_id = 2 \u00a0\u00a0OR product_id = 1 AND customer_id = 3 AND store_id = 2;<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u0434\u043b\u044f 12 \u0441\u0442\u0440\u043e\u043a \u0438 \u0442\u0440\u0435\u0445 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0443\u0436\u0435 9 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>SQL \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0445\u0435\u0448\u0438 \u0434\u043b\u044f \u0442\u0440\u0435\u0445 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0438\u0437 UI \u0444\u0438\u043b\u044c\u0442\u0440\u0430, \u043f\u0440\u0438\u0447\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e \u0445\u0435\u0448\u0443 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 Customer \u0434\u0430\u0435\u0442 \u0434\u0432\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 (\u0441\u043e Store #1 \u0438 Store #2), \u0438 \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 Store \u0434\u0430\u0435\u0442 \u043e\u0434\u043d\u0443 \u0437\u0430\u043f\u0438\u0441\u044c:<\/p>\n<pre><code>SELECT murmurHash2_32(product_id) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0AS product_id_hash, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0murmurHash2_32(bitXor(customer_id, product_id_hash)) AS customer_id_hash, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0murmurHash2_32(bitXor(store_id, customer_id_hash)) \u00a0 AS store_id_hash, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0order_number, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0amount, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0order_date, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0product_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0customer_id, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0store_id FROM sales WHERE customer_id_hash = 1304444856 OR store_id_hash = 3547175208;<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0432 WHERE \u0441 \u0445\u0435\u0448\u0430\u043c\u0438 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u0430 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0438 9.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u0438\u0434\u043d\u044b \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0445\u0435\u0448\u0430\u043c\u0438, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439\u00a0\u2014 \u0438\u0445 \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c, \u0442.\u043a. \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e. \u0422\u0430\u043a\u0436\u0435 \u043b\u0435\u0433\u043a\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0432\u0441\u0435\u0433\u043e 2 \u0445\u0435\u0448\u0430 \u0432\u043c\u0435\u0441\u0442\u043e 9 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 WHERE), \u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u2014 \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0445\u0435\u0448\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043b\u044e\u0441\u043e\u043c \u0438 \u043f\u0440\u0438 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0438\u0445 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0445\u0435\u0448 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u0442.\u0434.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0432\u0438\u0434\u0435, \u0438\u043b\u0438 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u0442 \u043d\u0430 \u043b\u0443\u0447\u0448\u0435\u0435 \ud83d\ude42<\/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\/893628\/\"> https:\/\/habr.com\/ru\/articles\/893628\/<\/a><br \/><\/br><\/br><\/p>\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-453211","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/453211","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=453211"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/453211\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=453211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=453211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=453211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}