{"id":305002,"date":"2020-06-08T15:00:12","date_gmt":"2020-06-08T15:00:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=305002"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=305002","title":{"rendered":"\u041a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 Tarantool"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/505880\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_w\/oc\/me\/_wocmecfrb1lnc7gdoodtf3j3y4.png\"><\/p>\n<p>  Tarantool \u2014 \u044d\u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 C, \u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d Lua-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, Tarantool \u2014 \u044d\u0442\u043e opensource-\u043f\u0440\u043e\u0434\u0443\u043a\u0442, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435, \u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c \u041f\u041e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Tarantool. <\/p>\n<p>  \u041d\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0434\u0440\u0443\u0433\u043e\u043c: \u043e\u0431 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0435, \u043e \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 (Z-order curve) \u0438 \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0451 \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0443 Tarantool.<\/p>\n<p>  \u042f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 Tarantool Solution Team, \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 Tarantool, \u0430 \u043e\u0442\u043d\u043e\u0448\u0443\u0441\u044c \u043a \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u043e\u0442 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u2014 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a Tarantool \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Tarantool \u0438 \u0433\u0434\u0435 \u043e\u043d \u0445\u0440\u0430\u043d\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435?<\/h3>\n<p>  \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Tarantool? \u0412 \u043c\u0438\u0440\u0435 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u043d \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a in-memory \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f. \u0414\u0432\u0438\u0436\u043e\u043a memtx \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0438 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0441\u0435\u043c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c ACID.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u043e\u043c \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 Tarantool \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043f\u0435\u0439\u0441\u044b (space), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 (tuples). \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446, \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u0432 \u0441\u043f\u0435\u0439\u0441\u0435 \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b. \u0414\u043b\u044f \u0438\u0445 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0438\u0441\u043a\u0430, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043b\u044e\u0447 \u043f\u043e\u0438\u0441\u043a\u0430 \u2014 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439. <\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u2014 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0435 \u043b\u0438\u0448\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043a\u043e\u0440\u0442\u0435\u0436. \u0412\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0432\u0438\u0434\u0438\u043c\u043e\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u041a \u043b\u044e\u0431\u043e\u043c\u0443 \u043d\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u043d\u0435\u044f\u0432\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430. \u0422\u0430\u043a \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430.<\/p>\n<p>  Tarantool \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432:<\/p>\n<ul>\n<li>\u0412-\u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0432 <strong>B-Tree<\/strong> (\u0430 \u0435\u0441\u043b\u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u043e\u0447\u043d\u043e, \u0442\u043e B+*-Tree). \u041e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 B-\u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e [<a href=\"#B-Tree\">B-Tree<\/a>]. \u041e\u0442\u043c\u0435\u0447\u0443 \u043b\u0438\u0448\u044c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0443 \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430.<\/li>\n<li>\u0418\u043d\u0434\u0435\u043a\u0441 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <strong>hash-\u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/strong>. \u041f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432. \u0414\u043e\u0441\u0442\u0443\u043f \u043f\u043e \u043f\u043e\u043b\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 B-\u0434\u0435\u0440\u0435\u0432\u0430, \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043d\u0435 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435, \u0430 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435. \u042d\u0442\u043e\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439.<\/li>\n<li><strong>R-Tree<\/strong>. \u042d\u0442\u043e\u0442 \u0442\u0438\u043f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439. \u041f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u00ab\u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0445\u00bb \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u0435\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u2014 \u043c\u0430\u0441\u0441\u0438\u0432. \u042d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430\u0448\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u043f\u043b\u0430\u043d\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0435\u043d. \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0442\u043e\u0447\u043a\u0438, \u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0438 \u0432\u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439.<\/li>\n<li><strong>Bitset<\/strong>. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u0430\u043c\u044b\u0439 \u0442\u0430\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0438\u043d\u0434\u0435\u043a\u0441. \u041e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u043d\u0438\u043c, \u0435\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0432 \u0441\u043f\u0435\u0439\u0441\u0430\u0445 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043c\u0430\u0441\u043a\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u041a\u0440\u0438\u0432\u0430\u044f Z-\u043f\u043e\u0440\u044f\u0434\u043a\u0430, \u0438\u043b\u0438 \u043a\u0440\u0438\u0432\u0430\u044f \u041c\u043e\u0440\u0442\u043e\u043d\u0430<\/h3>\n<p>  \u041e\u0442\u043a\u0443\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441, \u043f\u0440\u0438\u0447\u0435\u043c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u044d\u043a\u0437\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439? <\/p>\n<p>  \u041e\u0434\u043d\u0430\u0436\u0434\u044b \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0441\u0442\u0430\u0442\u044c\u0438 Amazon [<a href=\"#1\">1, 2<\/a>], \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u043e \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435, \u043a\u0430\u043a \u043a\u0440\u0438\u0432\u0430\u044f Z-\u043f\u043e\u0440\u044f\u0434\u043a\u0430, \u0438\u043b\u0438 \u043a\u0440\u0438\u0432\u0430\u044f \u041c\u043e\u0440\u0442\u043e\u043d\u0430. \u042d\u0442\u043e \u0440\u0435\u0446\u0435\u043f\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u00ab\u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0445\u00bb \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b (Z-order curve), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0442\u0435\u043c \u0443\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 B-\u0434\u0435\u0440\u0435\u0432\u043e. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043c\u043e\u0447\u044c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0441\u043f\u043b\u043e\u0448\u043d\u043e\u0433\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0446\u0435\u043b\u043e\u043c \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043b\u044e\u0431\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435, \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0449\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u043e\u0441\u0442, \u0432\u0435\u0441, \u0440\u0430\u0437\u043c\u0435\u0440 \u043d\u043e\u0433\u0438 \u0438 \u0442.\u0434. \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f R-Tree.<\/p>\n<p>  \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043a\u0440\u0438\u0432\u0430\u044f Z-\u043f\u043e\u0440\u044f\u0434\u043a\u0430.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/363\/a10\/2c9\/363a102c99adb088e19052945e6298fb.png\"><\/div>\n<p>  \u041a\u0440\u0438\u0432\u0430\u044f Z-\u043f\u043e\u0440\u044f\u0434\u043a\u0430, \u043e\u043d\u0430 \u0436\u0435 \u043a\u0440\u0438\u0432\u0430\u044f \u041c\u043e\u0440\u0442\u043e\u043d\u0430, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0436\u0435\u043d\u0438\u044f \u0431\u0438\u0442\u043e\u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0442\u043e\u0447\u043a\u0438 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c Z-\u0430\u0434\u0440\u0435\u0441\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0422\u043e\u0447\u043a\u0438, \u043d\u0430\u0445\u043e\u0434\u0438\u0432\u0448\u0438\u0435\u0441\u044f \u0440\u044f\u0434\u043e\u043c \u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u0431\u0443\u0434\u0443\u0442 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u0440\u044f\u0434\u043e\u043c \u0438 \u043f\u0440\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u0443\u044e \u043b\u0438\u043d\u0438\u044e.<\/p>\n<p>  \u0421\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6eb\/04c\/f2b\/6eb04cf2b6ac3f0b26613a774c8f479d.png\"><\/div>\n<p>  \u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u041c\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u2014 \u0433\u0438\u043f\u0435\u0440\u043a\u0443\u0431 (\u0432 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a) \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0432\u0443\u0445 \u0442\u043e\u0447\u0435\u043a, \u043b\u0435\u0436\u0430\u0449\u0438\u0445 \u043d\u0430 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0432 \u0434\u0432\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043f\u0440\u044f\u043c\u043e\u0439. \u0418 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442: \u0447\u0430\u0441\u0442\u044c \u0442\u043e\u0447\u0435\u043a \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/991\/fd9\/889\/991fd9889fa6f3b4b30fd7adecfcd436.png\"><\/div>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u044d\u0442\u043e\u0439 \u043a\u0440\u0438\u0432\u043e\u0439. \u041d\u043e, \u0432\u043e\u043e\u0440\u0443\u0436\u0438\u0432\u0448\u0438\u0441\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u044b\u0436\u043e\u043a, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u0432\u044b\u0445\u043e\u0434\u0438\u043c \u0437\u0430 \u043a\u0440\u0430\u0439\u043d\u044e\u044e \u0442\u043e\u0447\u043a\u0443 \u043a\u0440\u0438\u0432\u043e\u0439 (\u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0451 upper_bound), \u043f\u043e\u0438\u0441\u043a \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d.<\/p>\n<p>  \u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 B-Tree \u043c\u044b \u0438\u043c\u0435\u043b\u0438 \u0431\u044b \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432, \u0438 \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u0438\u0432\u0435\u043b \u0431\u044b \u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e B-\u0434\u0435\u0440\u0435\u0432\u0430, \u0447\u0442\u043e \u0437\u0430\u043d\u044f\u043b\u043e \u0431\u044b \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041c\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u043f\u043e\u0434\u043e\u0433\u0440\u0435\u0432\u0430\u043b\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u0431 \u044d\u0442\u043e\u0439 \u043a\u0440\u0438\u0432\u043e\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432 TransBase [<a href=\"#3\">3<\/a>], \u043f\u0440\u043e\u043f\u0440\u0438\u0435\u0442\u0430\u0440\u043d\u0443\u044e \u0411\u0414. \u0418, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0441\u0432\u043e\u0435\u043c\u0443, \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043d\u0438\u043a\u0430\u043a\u0438\u0445 open source-\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<p>  \u041b\u0435\u0436\u0430\u0449\u0435\u0435 \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0439 \u043a\u0440\u0438\u0432\u043e\u0439 B-Tree \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0440\u044f\u0434\u043e\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u043f\u0435\u0440\u0435\u0434 R-Tree. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043b\u0443\u0447\u0448\u0435\u0439 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0441\u0442\u044c\u044e \u0438 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0441\u0442\u044c\u044e. \u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438: \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0443. \u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u044f \u0440\u0435\u0448\u0438\u043b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f Tarantool: \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0447\u0442\u0435\u043d\u0438\u044f\/\u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438. \u041d\u0435\u043b\u044c\u0437\u044f \u043d\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0430\u044f \u0442\u0435\u043c\u0430 \u0443\u0436\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u043b\u0430\u0441\u044c \u043d\u0430 \u0425\u0430\u0431\u0440\u0435, \u043d\u043e \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0435\u0439 (2-3) \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a \u0434\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0411\u0414 PostgreSQL [<a href=\"#ZcurvePostgres\">ZcurvePostgres<\/a>].<\/p>\n<h3>\u0427\u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0434\u043b\u044f \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u0432 Tarantool?<\/h3>\n<p>  \u042f \u043d\u0430\u0445\u043e\u0434\u0438\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 2-3, \u043d\u043e \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c R-Tree-\u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0430\u043b\u044b\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043c\u043d\u0435 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c. \u042f \u0432\u044b\u0431\u0440\u0430\u043b \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c, \u043a\u0430\u043a \u0438 \u0443 R-Tree \u2014 20. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043d\u0435 \u0431\u044b\u043b \u043d\u0443\u0436\u0435\u043d \u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439: \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f\/\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0431\u0438\u0442\u0430, \u0441\u0434\u0432\u0438\u0433\u0430, \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 OR\/AND.<\/p>\n<p>  \u0414\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430 \u044f \u0432\u0437\u044f\u043b \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u0443\u044e open source-\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u043d\u0435 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u0449\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f: \u0434\u043b\u0438\u043d\u0430 \u043a\u043b\u044e\u0447\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u043a\u0440\u0430\u0442\u043d\u0430 64, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0430\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442\u0441\u044f. \u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u0431\u0430\u0437\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u044f \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 Tarantool [<a href=\"#4\">4<\/a>].<\/p>\n<p>  \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u0435\u0440\u0434\u0446\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Z-\u043a\u0440\u0438\u0432\u043e\u0439. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 Z-\u0430\u0434\u0440\u0435\u0441\u0430 (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 lookup-\u0442\u0430\u0431\u043b\u0438\u0446), \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0438 Z-\u0430\u0434\u0440\u0435\u0441\u0430 \u043a \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438. \u0415\u0441\u043b\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0438\u0441\u043a\u0430\u0442\u044c \u0432 \u0441\u0435\u0442\u0438, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430\u0443\u0447\u043d\u044b\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u044d\u0442\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u043d\u0435 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u043e\u0441\u044c, \u044d\u0442\u043e \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c \u0438, \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0425\u0440\u0430\u043d\u0438\u0442\u044c Z-\u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u043e\u0441\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e B-\u0434\u0435\u0440\u0435\u0432\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0434\u043b\u044f TREE-\u0438\u043d\u0434\u0435\u043a\u0441\u0430.<\/p>\n<h3>\u041a\u0430\u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438?<\/h3>\n<p>  \u0412 \u0441\u0430\u043c\u043e\u043c \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 tuple. \u042d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 message pack. \u0418 \u0432 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0447\u043b\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044f, \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c \u0438\u0445 \u0431\u0438\u0442\u044b \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c \u043d\u0430 \u043a\u043e\u0440\u0442\u0435\u0436 \u0432\u043d\u0443\u0442\u0440\u044c B-\u0434\u0435\u0440\u0435\u0432\u0430. <\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u0431\u044b \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0442\u0438\u043f\u043e\u043c unsigned, \u043a\u043e\u0433\u0434\u0430 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u0431\u044b \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0447\u0438\u0441\u043b\u0430\u043c \u0432 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u0423 \u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0441\u0432\u043e\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0443 \u0447\u0438\u0441\u0435\u043b \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u2014 \u0441\u0432\u043e\u0438. \u0418 \u044d\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u043e\u0431\u0449\u0435\u043c\u0443 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044e. \u0417\u0430 \u0441\u0447\u0435\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0445\u0440\u0430\u043d\u0438\u043c Z-\u0430\u0434\u0440\u0435\u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u0441\u0430\u043c\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0434 \u043d\u0430\u0448\u0438\u043c\u0438 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0446\u0435\u043b\u044b\u0445 \u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442. \u0414\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435, \u043f\u0443\u0441\u0442\u044c \u0438 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u0412\u0441\u0435 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u0443\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 8 \u0431\u0430\u0439\u0442\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u044e\u0447 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 N * 8 \u0431\u0430\u0439\u0442\u043e\u0432, \u0433\u0434\u0435 N \u2014 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430. \u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438? <\/p>\n<p>  \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0447\u0430\u0441\u0442\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u2014 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a. \u0418 \u0435\u0433\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c. \u041f\u0435\u0440\u0432\u044b\u0435 8 \u0431\u0430\u0439\u0442\u043e\u0432 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u044e\u0447\u0430. \u0415\u0441\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u043e\u0440\u043e\u0447\u0435, \u0442\u043e \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0443\u043b\u044f\u043c\u0438. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0442\u0440\u043e\u043a \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u0430\u0448 \u0438\u043d\u0434\u0435\u043a\u0441: \u043c\u044b \u0442\u0435\u0440\u044f\u0435\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0434\u0435\u0432\u044f\u0442\u043e\u043c \u0431\u0430\u0439\u0442\u0435, \u0442\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u043d\u0438 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0431\u0443\u0434\u0443\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043a\u043e\u0434. <\/p>\n<p>  API \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0420\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043f\u0440\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u043b\u0438\u0448\u044c \u043f\u043e \u0441\u0430\u043c\u044b\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u043f\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0438.<\/p>\n<p>  <code>get<\/code> \u2014 \u043f\u043e\u0438\u0441\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u043e \u043f\u043e\u043b\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0438\u0448\u044c \u0434\u043b\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432. \u041d\u0430\u0448 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 generic-\u0432\u0435\u0440\u0441\u0438\u0435\u0439, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u0443 \u00abUnsupported index feature\u00bb. <\/p>\n<p>  <code>replace<\/code> \u2014 \u0432\u0441\u0442\u0430\u0432\u043a\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<pre><code class=\"cpp\">static int memtx_zcurve_index_replace(struct index *base, struct tuple *old_tuple,         struct tuple *new_tuple, enum dup_replace_mode mode,         struct tuple **result) {     (void)mode;     struct memtx_zcurve_index *index = (struct memtx_zcurve_index *)base;     if (new_tuple) {         struct memtx_zcurve_data new_data;         new_data.tuple = new_tuple;         new_data.z_address = extract_zaddress(new_tuple,                 &amp;index-&gt;bit_array_pool, index);         struct memtx_zcurve_data dup_data;         dup_data.tuple = NULL;         dup_data.z_address = NULL;          int tree_res = memtx_zcurve_insert(&amp;index-&gt;tree, new_data,                 &amp;dup_data);         if (tree_res) {             diag_set(OutOfMemory, MEMTX_EXTENT_SIZE,                      &quot;memtx_zcurve_index&quot;, &quot;replace&quot;);             return -1;         }          if (dup_data.tuple != NULL) {             *result = dup_data.tuple;             z_value_free(&amp;index-&gt;bit_array_pool, dup_data.z_address);             return 0;         }     }     if (old_tuple) {         struct memtx_zcurve_data old_data, deleted_value;         old_data.tuple = old_tuple;         old_data.z_address = extract_zaddress(old_tuple,                 &amp;index-&gt;bit_array_pool, index);         memtx_zcurve_delete_value(&amp;index-&gt;tree, old_data, &amp;deleted_value);         z_value_free(&amp;index-&gt;bit_array_pool, old_data.z_address);         z_value_free(&amp;index-&gt;bit_array_pool, deleted_value.z_address);     }     *result = old_tuple;     return 0; }<\/code><\/pre>\n<p>  \u041d\u0430 \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435? <\/p>\n<p>  \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 <code>update<\/code>, <code>delete<\/code>, <code>insert<\/code> \u0438 <code>replace<\/code>. \u0412\u0441\u044f \u0438\u0445 \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0435\u043c \u0441\u0442\u0430\u0440\u044b\u0439 \u0438 \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u0440\u0442\u0435\u0436\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 <code>mode<\/code> \u2014 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u043b\u0438 \u043d\u0435\u0442. \u041d\u0430\u0448 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u0440\u0442\u0435\u0436.<\/p>\n<p>  <code>memtx_zcurve_insert<\/code> \u0438 <code>memtx_zcurve_delete_value<\/code> \u2014 \u043c\u0435\u0442\u043e\u0434\u044b B-\u0434\u0435\u0440\u0435\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0432 Tarantool \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c TREE-\u0438\u043d\u0434\u0435\u043a\u0441\u0435. \u041d\u0430 \u043d\u0438\u0445 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e TREE \u043c\u044b \u0445\u0440\u0430\u043d\u0438\u043c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e tuple, \u0430 \u0435\u0449\u0451 \u0438 z-\u0430\u0434\u0440\u0435\u0441 \u2014 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u043d\u043d\u044b\u0435 \u0431\u0438\u0442\u044b \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439. \u0417\u0430 \u044d\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>extract_zadress<\/code>.<\/p>\n<p>  <code>create_iterator<\/code> \u2014 \u0438\u0437 Lua \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u044d\u0442\u043e\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 <code>select<\/code>\u2019\u0430 \u0438 <code>pairs<\/code>\u2019\u0430.<\/p>\n<pre><code class=\"cpp\">static struct iterator * memtx_zcurve_index_create_iterator(struct index *base, enum iterator_type type,                                    const char *key, uint32_t part_count) {     struct memtx_zcurve_index *index = (struct memtx_zcurve_index *)base;     struct memtx_engine *memtx = (struct memtx_engine *)base-&gt;engine;      assert(part_count == 0 || key != NULL);     if (type != ITER_EQ &amp;&amp; type != ITER_ALL &amp;&amp; type != ITER_GE) {         diag_set(UnsupportedIndexFeature, base-&gt;def,                  &quot;requested iterator type&quot;);         return NULL;     }      uint8_t index_dim = base-&gt;def-&gt;key_def-&gt;part_count;     if (part_count == 0) {         \/*          * If no key is specified, downgrade equality          * iterators to a full range.          *\/         type = ITER_GE;         key = NULL;     } else if (index_dim * 2 == part_count                &amp;&amp; type != ITER_ALL) {         \/*          * If part_count is twice greater than key_def.part_count          * set iterator to range query          *\/         type = ITER_GE;     }      struct tree_iterator *it = mempool_alloc(&amp;memtx-&gt;zcurve_iterator_pool);     if (it == NULL) {         diag_set(OutOfMemory, sizeof(struct tree_iterator),                  &quot;memtx_zcurve_index&quot;, &quot;iterator&quot;);         return NULL;     }      iterator_create(&amp;it-&gt;base, base);     it-&gt;pool = &amp;memtx-&gt;zcurve_iterator_pool;     it-&gt;base.next = tree_iterator_start;     it-&gt;base.free = tree_iterator_free;     it-&gt;type = type;      if (part_count == 0 || type == ITER_ALL) {         it-&gt;lower_bound = zeros(&amp;index-&gt;bit_array_pool, index_dim);         it-&gt;upper_bound = ones(&amp;index-&gt;bit_array_pool, index_dim);     } else if (type == ITER_EQ) {         it-&gt;lower_bound = mp_decode_key(&amp;index-&gt;bit_array_pool,                 key, index_dim, index);         it-&gt;upper_bound = NULL;     } else if (base-&gt;def-&gt;key_def-&gt;part_count == part_count) {         it-&gt;lower_bound = mp_decode_key(&amp;index-&gt;bit_array_pool,                 key, index_dim, index);         it-&gt;upper_bound = ones(&amp;index-&gt;bit_array_pool, index_dim);     } else if (base-&gt;def-&gt;key_def-&gt;part_count * 2 == part_count) {         it-&gt;lower_bound  = z_value_create(&amp;index-&gt;bit_array_pool, index_dim);         it-&gt;upper_bound  = z_value_create(&amp;index-&gt;bit_array_pool, index_dim);         mp_decode_part(key, part_count, index, it-&gt;lower_bound, it-&gt;upper_bound);     } else {         unreachable();     }     it-&gt;tree_iterator = memtx_zcurve_invalid_iterator();     it-&gt;current.tuple = NULL;     it-&gt;current.z_address = NULL;     return (struct iterator *)it; }<\/code><\/pre>\n<p>  \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043d\u0438\u0436\u043d\u044e\u044e \u0438 \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u043d\u0438 \u043d\u0430 \u0447\u0442\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442. \u0412\u0441\u0435\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e ALL \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432; EQ \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, z-\u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c; \u0438 GE \u2014 \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0433\u0438\u043f\u0435\u0440\u043a\u0443\u0431\u0435.<\/p>\n<p>  <code>destroy<\/code> \u2014 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043e \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u0442\u0443 \u043f\u0430\u043c\u044f\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0434\u0435\u043b\u044f\u043b\u0430\u0441\u044c \u043f\u043e\u0434 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u043e\u0438\u0441\u043a\u0430. \u0410 \u0435\u0441\u043b\u0438 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439, \u0442\u043e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0435\u0441\u044f \u043a\u043e\u0440\u0442\u0435\u0436\u0438.<\/p>\n<p>  \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443: <a href=\"https:\/\/github.com\/olegrok\/tarantool\/tree\/z-order-curve-index\">https:\/\/github.com\/olegrok\/tarantool\/tree\/z-order-curve-index<\/a><\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0438 \u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043c \u0438\u0442\u043e\u0433\u0438.<\/p>\n<pre><code class=\"lua\">space = box.schema.space.create('myspace', { engine = 'memtx' }) pk = space:create_index('primary', { type = 'tree', parts = {{1, 'unsigned'}}, unique = true}) sk = space:create_index('secondary', { type = 'zcurve', parts = {{2, 'unsigned'}, {3, 'unsigned'}}}) for i=0,5 do for j=0,5 do space:insert{i * 6 + j, i, j} end end -- returns all tuples pk:select{} -- (2 &lt;= x &lt;= 3) and (3 &lt;= y &lt;= 5) sk:select{2, 3, 3, 5} --- - \u2014 [15, 2, 3]   - [21, 3, 3]   - [16, 2, 4]   - [22, 3, 4]   - [17, 2, 5]   - [23, 3, 5] \u2026 -- (x == 2) and (y == 3) sk:select{2, 3} --- - \u2014 [15, 2, 3] -- (2 &lt;= x &lt;= 3) sk:select({2, 3, box.NULL, box.NULL}) --- - \u2014 [12, 2, 0]   - [18, 3, 0]   - [13, 2, 1]   - [19, 3, 1]   - [14, 2, 2]   - [20, 3, 2]   - [15, 2, 3]   - [21, 3, 3]   - [16, 2, 4]   - [22, 3, 4]   - [17, 2, 5]   - [23, 3, 5] ... -- (x &gt;= 2) and (y &gt;= 3) sk:select({2, box.NULL, 3, box.NULL}) --- - \u2014 [15, 2, 3]   - [21, 3, 3]   - [27, 4, 3]   - [33, 5, 3]   - [16, 2, 4]   - [22, 3, 4]   - [17, 2, 5]   - [23, 3, 5]   - [28, 4, 4]   - [34, 5, 4]   - [29, 4, 5]   - [35, 5, 5] ...<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0410 \u0447\u0442\u043e \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e?<\/h3>\n<p>  \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u043d\u0435 \u0442\u0430\u043a \u0440\u0430\u0434\u0443\u0436\u043d\u043e, \u043a\u0430\u043a \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b.<\/p>\n<p>  \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043a\u0440\u0438\u0432\u0430\u044f Z-\u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0441\u0435\u0434\u0430\u0442\u044c \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c. perf top \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u0447\u043a\u0438 \u043a \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u044b\u0433\u043d\u0443\u0442\u044c. \u041e\u0431\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u043c\u0435\u044e\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0434\u043b\u0438\u043d\u044b \u043a\u043b\u044e\u0447\u0430 \u2014 \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u0434\u043b\u0438\u043d\u0430.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/70e\/338\/fd1\/70e338fd15af8701c3a5696ebfb3ea2a.png\"><\/div>\n<p>  \u0418\u0437 \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u2014 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 2-3 \u0440\u0430\u0437\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0430 \u0447\u0443\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0443 R-Tree. \u0427\u0442\u043e \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u043e, \u0432\u0435\u0434\u044c \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0441 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c WAL. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0432 production-\u0441\u0440\u0435\u0434\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0431\u043e\u044f \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439 WAL \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043f\u043e\u0442\u0435\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 WAL \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u0430\u0442\u0447\u0435\u0432\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u044d\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u0434\u0438\u0441\u043a, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u0442\u044b\u0441\u044f\u0447\u0438 \u0440\u0430\u0437 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u044c\u044e.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9ee\/e73\/e29\/9eee73e29d809963c069a9f7414f524a.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/2c0\/8b9\/159\/2c08b91598dbefe2855ede4d05a593ca.png\"><\/div>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0441 B-\u0434\u0435\u0440\u0435\u0432\u043e\u043c. \u0422\u0443\u0442, \u043a\u0430\u043a \u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u043e\u0441\u044c, \u043a\u0440\u0438\u0432\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u043a \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438. \u0414\u0430\u0436\u0435 \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u043e\u0439, \u0447\u0435\u043c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0440\u0438\u0432\u043e\u0439 Z-\u043f\u043e\u0440\u044f\u0434\u043a\u0430, \u0433\u0434\u0435 \u0432\u0441\u0451 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u043c\u0443 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e.<\/p>\n<p>  \u0426\u0438\u0444\u0440\u044b \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u043e\u0442 R-Tree \u2014 \u0442\u0435\u0441\u0442 \u0431\u044b\u043b \u0441\u043b\u0435\u0433\u043a\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/140\/ae5\/44d\/140ae544d6ba527bffe6bc4d814f609d.png\"><\/div>\n<p>  \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u043d\u0430\u0431\u043e\u0440 \u0442\u043e\u0447\u0435\u043a \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043b \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Z-\u043a\u0440\u0438\u0432\u043e\u0439 \u0438 \u043f\u0440\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438.<\/p>\n<h2>\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043c \u0438\u0442\u043e\u0433\u0438<\/h2>\n<p>  \u0412 \u043c\u0438\u0440\u0435 in-memory \u044d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u0441\u0435\u0431\u044f \u043d\u0435 \u043b\u0443\u0447\u0448\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u0434\u043d\u0430\u043a\u043e \u0443 \u043d\u0435\u0451 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432\u0430:<\/p>\n<ul>\n<li>\u0417\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u043c\u0435\u0441\u0442\u0430.<\/li>\n<li>\u0422\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 R-Tree (\u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f Tarantool).<\/li>\n<li>\u041a \u043d\u0435\u0439 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e B-Tree \u0438 \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b (\u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f Tarantool).<\/li>\n<\/ul>\n<p>  \u042d\u0442\u043e \u0431\u044b\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442. \u0412\u0440\u044f\u0434 \u043b\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u043c\u043d\u043e\u0439 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0442\u0430\u043d\u0435\u0442 \u0447\u0430\u0441\u0442\u044c\u044e Tarantool. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0431\u043e\u044f\u0442\u044c\u0441\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0418 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0442\u043e \u043d\u0435 \u0431\u043e\u0439\u0442\u0435\u0441\u044c \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u043c\u0438.<\/p>\n<h2>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438<\/h2>\n<p>  <a name=\"B-Tree\"><\/a>[B-Tree]:<br \/>  <a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/330544\/\">\u0418\u043d\u0434\u0435\u043a\u0441\u044b \u0432 PostgreSQL \u2014 4 \/ \u0411\u043b\u043e\u0433 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Postgres Professional \/ \u0425\u0430\u0431\u0440<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/114154\/\">B-tree \/ \u0425\u0430\u0431\u0440<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/459216\/\">\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 B-\u0434\u0435\u0440\u0435\u0432\u043e \/ \u0411\u043b\u043e\u0433 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 OTUS. \u041e\u043d\u043b\u0430\u0439\u043d-\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \/ \u0425\u0430\u0431\u0440<\/a><\/p>\n<p>  <a name=\"ZcurvePostgres\"><\/a>[ZcurvePostgres]:<br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/319096\/\">\u041f\u0440\u043e Z-\u043erder \u0438 R-\u0434\u0435\u0440\u0435\u0432\u043e \/ \u0425\u0430\u0431\u0440<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/319810\/\">Z-order vs R-tree, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \/ \u0425\u0430\u0431\u0440<\/a><\/p>\n<p>  <a name=\"1\"><\/a>[1] <a href=\"https:\/\/aws.amazon.com\/ru\/blogs\/database\/z-order-indexing-for-multifaceted-queries-in-amazon-dynamodb-part-1\/\">Z-Order Indexing for Multifaceted Queries in Amazon DynamoDB: Part 1 | AWS Database Blog<\/a><\/p>\n<p>  <a name=\"1\"><\/a>[2] <a href=\"https:\/\/aws.amazon.com\/ru\/blogs\/database\/z-order-indexing-for-multifaceted-queries-in-amazon-dynamodb-part-2\/\">Z-order indexing for multifaceted queries in Amazon DynamoDB: Part 2 | AWS Database Blog<\/a><\/p>\n<p>  <a name=\"3\"><\/a>[3] <a href=\"http:\/\/www.cs.bu.edu\/fac\/gkollios\/cs591\/RMF+00.pdf\">Integrating the UB-Tree into a Database System Kernel<\/a><\/p>\n<p>  <a name=\"4\"><\/a>[4] <a href=\"https:\/\/github.com\/tarantool\/small\">https:\/\/github.com\/tarantool\/small<\/a><\/div>\n<p> \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\/company\/mailru\/blog\/505880\/\"> https:\/\/habr.com\/ru\/company\/mailru\/blog\/505880\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/505880\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_w\/oc\/me\/_wocmecfrb1lnc7gdoodtf3j3y4.png\"><\/p>\n<p>  Tarantool \u2014 \u044d\u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 C, \u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d Lua-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, Tarantool \u2014 \u044d\u0442\u043e opensource-\u043f\u0440\u043e\u0434\u0443\u043a\u0442, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435, \u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c \u041f\u041e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Tarantool. <\/p>\n<p>  \u041d\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0434\u0440\u0443\u0433\u043e\u043c: \u043e\u0431 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0435, \u043e \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 (Z-order curve) \u0438 \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0451 \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0443 Tarantool.<\/p>\n<p>  \u042f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 Tarantool Solution Team, \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 Tarantool, \u0430 \u043e\u0442\u043d\u043e\u0448\u0443\u0441\u044c \u043a \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u043e\u0442 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u2014 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a Tarantool \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435.  <\/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-305002","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305002","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=305002"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305002\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}