{"id":293245,"date":"2019-08-12T09:00:46","date_gmt":"2019-08-12T09:00:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=293245"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=293245","title":{"rendered":"\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 SQL?"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/s1\/uz\/ze\/s1uzzeivaxmzx7jk-1osyp0xeyy.jpeg\"><\/p>\n<p>  \u0411\u0435\u0437 \u043f\u0440\u0435\u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e SQL \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u0432 \u043c\u0438\u0440\u0435 \u044f\u0437\u044b\u043a\u043e\u0432. \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 Java, Python, JavaScript, C#, PHP \u0438 \u0434\u0435\u0441\u044f\u0442\u043a\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u043e\u0432, \u043d\u043e SQL \u0431\u0430\u0437\u0430 \u0432 \u0442\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0442\u0430\u043a\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c. \u0421\u0440\u0435\u0434\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u0441\u0438\u0441\u0442\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 SQL, \u0432\u043e\u043e\u0431\u0449\u0435 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a 100%. <\/p>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u043e SQL \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445 \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043a \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c, \u0432\u0440\u043e\u0434\u0435: \u00ab\u043a\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0431\u044b\u0432\u0430\u044e\u0442\u00bb, \u00ab\u0447\u0435\u043c \u043b\u0435\u0432\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u0440\u0430\u0432\u043e\u0433\u043e\u00bb, \u00ab\u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b\u00bb \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432 \u044d\u0442\u0438\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445 SQL (\u0438 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445), \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u0447\u0435\u043d\u044c \u0438 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043c\u0430\u043b\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0431\u0430 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u0430: \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u043d\u043e\u0433\u0438\u0435 \u0432\u0435\u0449\u0438 \u0432 SQL \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438\u0437\u043d\u0443\u0442\u0440\u0438, \u0430 \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u2014 \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435 \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e \/ \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b.<\/p>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0435\u0447\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u0439\u0434\u0435\u0442 \u043d\u0435 \u043e \u00ab\u0432\u043a\u0443\u0441\u0430\u0445 \u0438 \u0446\u0432\u0435\u0442\u0430\u0445 \u0444\u043b\u043e\u043c\u0430\u0441\u0442\u0435\u0440\u043e\u0432\u00bb. \u0412\u0441\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u043e\u0441\u044f\u0442 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440: \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u00ab\u043a\u0440\u0430\u0441\u043e\u0442\u043e\u0439 \u043a\u043e\u0434\u0430\u00bb, \u0430 \u0432 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043b\u0438\u0431\u043e \u043a \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043f\u0430\u0434\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043b\u0438\u0431\u043e \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u043e\u0441\u0442\u0443 \u043f\u043e\u0440\u043e\u0433\u0430 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f, \u043b\u0438\u0431\u043e \u043a \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0431\u044a\u0435\u043c\u043d\u043e\u0439, \u0438 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435 \u043e\u0441\u0438\u043b\u044f\u0442 \u0435\u0435 \u0437\u0430 \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0432 \u043d\u0435\u0439 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u00ab\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u044b \u0431\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u00bb, \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0432\u0441\u0435\u0445 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c:<\/p>\n<ul>\n<li><a href=\"#view\">\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f (View)<\/a><br \/> \n<ul>\n<li><a href=\"#matview\">View: \u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445<\/a>  <\/li>\n<li><a href=\"#consview\">View: \u0414\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b<\/a>  <\/li>\n<li><a href=\"#paramview\">View: \u0412 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043e FROM \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/a>  <\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#jppd\">Join Predicate Push Down (JPPD)<\/a><br \/> \n<ul>\n<li><a href=\"#windowjppd\">JPPD: \u041d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043e\u043a\u043e\u043d\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u043c\u0438 CTE<\/a>  <\/li>\n<li><a href=\"#denormjppd\">JPPD: \u041d\u0438\u0437\u043a\u0430\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0434\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/a>  <\/li>\n<li><a href=\"#commjppd\">JPPD: \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0445 \u0421\u0423\u0411\u0414<\/a>  <\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#joinwhere\">\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u043a\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043d\u0430 \u0442\u0438\u043f\u044b JOIN \u0438 WHERE<\/a>  <\/li>\n<li><a href=\"#oropt\">\u041f\u043b\u043e\u0445\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f OR<\/a>  <\/li>\n<li><a href=\"#nullopt\">\u041f\u043b\u043e\u0445\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/a>  <\/li>\n<li><a href=\"#lastopt\">\u041f\u043b\u043e\u0445\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438<\/a>  <\/li>\n<li><a href=\"#nplusone\">\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 N+1<\/a>  <\/li>\n<li><a href=\"#physmodel\">\u0412\u044b\u0441\u043e\u043a\u0430\u044f \u0446\u0435\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0411\u0414<\/a>  <\/li>\n<li><a href=\"#manyjoins\">\u041d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c JOIN<\/a>  <\/li>\n<li><a href=\"#inherit\">\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430<\/a>  <\/li>\n<li><a href=\"#abst\">\u0418\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e \u043d\u0438\u0437\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/a>  <\/li>\n<li><a href=\"#ao\">\u0410\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f(AO)<\/a><br \/> \n<ul>\n<li><a href=\"#commao\">AO: \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0445 \u0421\u0423\u0411\u0414<\/a>  <\/li>\n<li><a href=\"#incorrao\">AO: \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u0430<\/a>  <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 \u0442\u0440\u0435\u0445 \u0420\u0421\u0423\u0411\u0414 \u2014 PostgreSQL, MS SQL Server \u0438 Oracle. \u0412\u0441\u0435 \u0421\u0423\u0411\u0414 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u2014 11, 2019 \u0438 19c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0431\u0430\u0437\u0443 \u0441 \u0442\u043e\u0432\u0430\u0440\u0430\u043c\u0438, \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u043e\u0432 \u0438 \u043e\u0442\u0433\u0440\u0443\u0437\u043e\u043a. \u041d\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0435\u0435 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u0440\u0438\u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0441 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \/ \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0432 Oracle<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">CREATE TABLE customer (     id INT PRIMARY KEY,     name VARCHAR(100) );  CREATE TABLE stock (     id INT PRIMARY KEY,     name VARCHAR(100) );  CREATE TABLE product (     id INT PRIMARY KEY,     name VARCHAR(100),     \"group\" INT ); CREATE INDEX product_group ON product (\"group\");  CREATE TABLE receipt (     id INT PRIMARY KEY,     customer INT NOT NULL,    \t\"date\" DATE NOT NULL,     CONSTRAINT receipt_customer_fk         FOREIGN KEY (customer) REFERENCES customer (id),    \tstock INT NOT NULL,     CONSTRAINT receipt_stock_fk         FOREIGN KEY (stock) REFERENCES stock (id),     data VARCHAR(400) ); CREATE INDEX receipt_customer_fk ON receipt (customer); CREATE INDEX receipt_stock_fk ON receipt (stock);  CREATE TABLE shipment (     id INT PRIMARY KEY,     customer INT NOT NULL,    \t\"date\" DATE NOT NULL,     CONSTRAINT shipment_customer_fk         FOREIGN KEY (customer) REFERENCES customer (id),     stock INT NOT NULL,     CONSTRAINT shipment_stock_fk         FOREIGN KEY (stock) REFERENCES stock (id),     data VARCHAR(400) ); CREATE INDEX shipment_customer_fk ON shipment (customer); CREATE INDEX shipment_stock_fk ON shipment (stock); CREATE TABLE receiptdetail (     id INT PRIMARY KEY,     receipt INT NOT NULL, \tproduct INT NOT NULL, \tquantity NUMERIC(16,3),     CONSTRAINT receiptdetail_receipt_fk         FOREIGN KEY (receipt) REFERENCES receipt (id),     CONSTRAINT receiptdetail_product_fk     \tFOREIGN KEY (product) REFERENCES product (id),     data VARCHAR(400) ); CREATE INDEX receiptdetail_receipt_fk ON receiptdetail (receipt); CREATE INDEX receiptdetail_product_fk ON receiptdetail (product);  CREATE TABLE shipmentdetail (     id INT PRIMARY KEY,     shipment INT NOT NULL, \tproduct INT NOT NULL, \tquantity NUMERIC(16,3),     CONSTRAINT shipmentdetail_shipment_fk         FOREIGN KEY (shipment) REFERENCES shipment (id),     CONSTRAINT shipmentdetail_product_fk     \tFOREIGN KEY (product) REFERENCES product (id),     sd INT,     data VARCHAR(400) ); CREATE INDEX shipmentdetail_shipment_fk ON shipmentdetail (shipment); CREATE INDEX shipmentdetail_product_fk ON shipmentdetail (product); CREATE INDEX shipmentdetail_sd ON shipmentdetail (sd); CREATE INDEX shipmentdetail_p_s ON shipmentdetail (product,shipment);  INSERT INTO stock (id, name) WITH numbers ( n ) AS (    SELECT 1 AS n FROM dual    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 10 ) SELECT n, 'Stock '||n FROM numbers;  INSERT INTO customer (id, name) WITH numbers ( n ) AS (    SELECT 1 AS n FROM dual    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 1000 ) SELECT n, 'Customer '||n FROM numbers;  INSERT INTO product (id, name, \"group\") WITH numbers ( n ) AS (    SELECT 1 AS n FROM dual    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 50000 ) SELECT n, 'Product '||n, round(dbms_random.value() * 1000) + 1 FROM numbers;  INSERT INTO receipt (id, customer, stock, \"date\", data) WITH numbers ( n ) AS (    SELECT 1 AS n FROM dual    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 10000 ) SELECT n, round(dbms_random.value() * 1000) + 1, round(dbms_random.value() * 10) + 1, CURRENT_DATE - round(dbms_random.value() * 300), 'data'||n FROM numbers;  INSERT INTO receiptdetail (id, receipt, product, quantity, data) WITH numbers ( n ) AS (    SELECT 1 AS n FROM dual    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 1000000 ) SELECT n, round(dbms_random.value() * 10000) + 1, round(dbms_random.value() * 50000) + 1, round(dbms_random.value() * 100) + 1, 'data'||n FROM numbers;  INSERT INTO shipment (id, customer, stock, \"date\", data) WITH numbers ( n ) AS (    SELECT 1 AS n FROM dual    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 100000 ) SELECT n, round(dbms_random.value() * 1000) + 1, round(dbms_random.value() * 10) + 1, CURRENT_DATE - round(dbms_random.value() * 300), 'data'||n FROM numbers;  INSERT INTO shipmentdetail (id, shipment, product, quantity, data, sd) WITH numbers ( n ) AS (    SELECT 1 AS n FROM dual    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 10000000 ) SELECT n, round(dbms_random.value() * 100000) + 1, round(dbms_random.value() * 50000) + 1, round(dbms_random.value() * 10) + 1, 'data'||n, CASE WHEN REMAINDER(n, 100000) = 0 THEN n+1 ELSE NULL END FROM numbers;  exec DBMS_STATS.GATHER_DATABASE_STATS; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0432 MSSQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">CREATE TABLE customer (     id INT PRIMARY KEY,     name VARCHAR(100) );  CREATE TABLE stock (     id INT PRIMARY KEY,     name VARCHAR(100) );  CREATE TABLE product (     id INT PRIMARY KEY,     name VARCHAR(100),     [group] INT ); CREATE INDEX product_group ON product ([group]);  CREATE TABLE receipt (     id INT PRIMARY KEY,     customer INT NOT NULL, \tdate DATE NOT NULL,     CONSTRAINT receipt_customer_fk         FOREIGN KEY (customer) REFERENCES customer (id), \tstock INT NOT NULL,     CONSTRAINT receipt_stock_fk         FOREIGN KEY (stock) REFERENCES stock (id),     data VARCHAR(400) ); CREATE INDEX receipt_date ON receipt (date); CREATE INDEX receipt_customer_fk ON receipt (customer); CREATE INDEX receipt_stock_fk ON receipt (stock);  CREATE TABLE shipment (     id INT PRIMARY KEY,     customer INT NOT NULL, \tdate DATE NOT NULL,     CONSTRAINT shipment_customer_fk         FOREIGN KEY (customer) REFERENCES customer (id), \tstock INT NOT NULL,     CONSTRAINT shipment_stock_fk         FOREIGN KEY (stock) REFERENCES stock (id),     data VARCHAR(400) ); CREATE INDEX shipment_date ON shipment (date); CREATE INDEX shipment_customer_fk ON shipment (customer); CREATE INDEX shipment_stock_fk ON shipment (stock); CREATE TABLE receiptdetail (     id INT PRIMARY KEY,     receipt INT NOT NULL, \tproduct INT NOT NULL, \tquantity NUMERIC(16,3),     CONSTRAINT receiptdetail_receipt_fk         FOREIGN KEY (receipt) REFERENCES receipt (id),     CONSTRAINT receiptdetail_product_fk     \tFOREIGN KEY (product) REFERENCES product (id),     data VARCHAR(400) ); CREATE INDEX receiptdetail_receipt_fk ON receiptdetail (receipt); CREATE INDEX receiptdetail_product_fk ON receiptdetail (product);  CREATE TABLE shipmentdetail (     id INT PRIMARY KEY,     shipment INT NOT NULL, \tproduct INT NOT NULL, \tquantity NUMERIC(16,3),     CONSTRAINT shipmentdetail_shipment_fk         FOREIGN KEY (shipment) REFERENCES shipment (id),     CONSTRAINT shipmentdetail_product_fk     \tFOREIGN KEY (product) REFERENCES product (id),     sd INT,     data VARCHAR(400) ); CREATE INDEX shipmentdetail_shipment_fk ON shipmentdetail (shipment); CREATE INDEX shipmentdetail_product_fk ON shipmentdetail (product); CREATE INDEX shipmentdetail_sd ON shipmentdetail (sd); CREATE INDEX shipmentdetail_p_s ON shipmentdetail (product,shipment);  WITH numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 10 ) INSERT INTO stock (id, name) SELECT n, CONCAT('Stock ',n) FROM numbers option (maxrecursion 0);  WITH numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 1000 ) INSERT INTO customer (id, name) SELECT n, CONCAT('Customer ',n) FROM numbers option (maxrecursion 0);  WITH numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 50000 ) INSERT INTO product (id, name, [group]) SELECT n, CONCAT('Product ',n),  ABS(checksum(NewId()))% 1000 + 1 FROM numbers option (maxrecursion 0);  WITH numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 10000 ) INSERT INTO receipt (id, customer, stock, date, data) SELECT n,  ABS(checksum(NewId()))% 1000 + 1, ABS(checksum(NewId()))% 10 + 1, DATEADD(day, -ABS(checksum(NewId()))% 300, GETDATE()), CONCAT('data',n) FROM numbers option (maxrecursion 0);  WITH numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 1000000 ) INSERT INTO receiptdetail (id, receipt, product, quantity, data) SELECT n,  ABS(checksum(NewId()))% 10000 + 1,  ABS(checksum(NewId()))% 50000 + 1,  ABS(checksum(NewId()))% 100 + 1, CONCAT('data',n) FROM numbers option (maxrecursion 0);  WITH numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 100000 ) INSERT INTO shipment (id, customer, stock, date, data) SELECT n,  ABS(checksum(NewId()))% 1000 + 1, ABS(checksum(NewId()))% 10 + 1, DATEADD(day, -ABS(checksum(NewId()))% 300, GETDATE()), CONCAT('data',n) FROM numbers option (maxrecursion 0);  WITH numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 10000000 ) INSERT INTO shipmentdetail (id, shipment, product, quantity, data, sd) SELECT n,  ABS(checksum(NewId()))% 100000 + 1,  ABS(checksum(NewId()))% 50000 + 1,  ABS(checksum(NewId()))% 10 + 1, CONCAT('data',n), CASE WHEN n % 100000 = 0 THEN n+1 ELSE NULL END FROM numbers option (maxrecursion 0);  EXEC sp_updatestats;    <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0432 PostgreSQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">CREATE TABLE customer (     id INT PRIMARY KEY,     name VARCHAR(100) );  CREATE TABLE stock (     id INT PRIMARY KEY,     name VARCHAR(100) );  CREATE TABLE product (     id INT PRIMARY KEY,     name VARCHAR(100),     \"group\" INT ); CREATE INDEX product_group ON product (\"group\");  CREATE TABLE receipt (     id INT PRIMARY KEY,     customer INT NOT NULL, \t\"date\" DATE NOT NULL,     CONSTRAINT receipt_customer_fk         FOREIGN KEY (customer) REFERENCES customer (id),    \tstock INT NOT NULL,     CONSTRAINT receipt_stock_fk         FOREIGN KEY (stock) REFERENCES stock (id),     data VARCHAR(400) ); CREATE INDEX receipt_customer_fk ON receipt (customer); CREATE INDEX receipt_stock_fk ON receipt (stock);  CREATE TABLE shipment (     id INT PRIMARY KEY,     customer INT NOT NULL, \t\"date\" DATE NOT NULL,     CONSTRAINT shipment_customer_fk         FOREIGN KEY (customer) REFERENCES customer (id),     stock INT NOT NULL,     CONSTRAINT shipment_stock_fk         FOREIGN KEY (stock) REFERENCES stock (id),     data VARCHAR(400) ); CREATE INDEX shipment_customer_fk ON shipment (customer); CREATE INDEX shipment_stock_fk ON shipment (stock);  CREATE TABLE receiptdetail (     id INT PRIMARY KEY,     receipt INT NOT NULL, \tproduct INT NOT NULL, \tquantity NUMERIC(16,3),     CONSTRAINT receiptdetail_receipt_fk         FOREIGN KEY (receipt) REFERENCES receipt (id),     CONSTRAINT receiptdetail_product_fk     \tFOREIGN KEY (product) REFERENCES product (id),     data VARCHAR(400) ); CREATE INDEX receiptdetail_receipt_fk ON receiptdetail (receipt); CREATE INDEX receiptdetail_product_fk ON receiptdetail (product);  CREATE TABLE shipmentdetail (     id INT PRIMARY KEY,     shipment INT NOT NULL, \tproduct INT NOT NULL, \tquantity NUMERIC(16,3),     CONSTRAINT shipmentdetail_shipment_fk         FOREIGN KEY (shipment) REFERENCES shipment (id),     CONSTRAINT shipmentdetail_product_fk     \tFOREIGN KEY (product) REFERENCES product (id),     sd INT,     data VARCHAR(400) ); CREATE INDEX shipmentdetail_shipment_fk ON shipmentdetail (shipment); CREATE INDEX shipmentdetail_product_fk ON shipmentdetail (product); CREATE INDEX shipmentdetail_sd ON shipmentdetail (sd); CREATE INDEX shipmentdetail_p_s ON shipmentdetail (product,shipment);  INSERT INTO stock (id, name) WITH RECURSIVE numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 10 ) SELECT n, 'Stock '||n FROM numbers;  INSERT INTO customer (id, name) WITH RECURSIVE numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 1000 ) SELECT n, 'Customer '||n FROM numbers;  INSERT INTO product (id, name, \"group\") WITH RECURSIVE numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 50000 ) SELECT n, 'Product '||n, floor(random() * 1000) + 1 FROM numbers;  INSERT INTO receipt (id, customer, stock, \"date\", data) WITH RECURSIVE numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 10000 ) SELECT n, floor(random() * 1000) + 1, floor(random() * 10) + 1, CURRENT_DATE-CAST(floor(random() * 300) AS int), 'data'||n FROM numbers;  INSERT INTO receiptdetail (id, receipt, product, quantity, data) WITH RECURSIVE numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 1000000 ) SELECT n, floor(random() * 10000) + 1, floor(random() * 50000) + 1, floor(random() * 100) + 1, 'data'||n FROM numbers;  INSERT INTO shipment (id, customer, stock, \"date\", data) WITH RECURSIVE numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 100000 ) SELECT n, floor(random() * 1000) + 1, floor(random() * 10) + 1, CURRENT_DATE-CAST(floor(random() * 300) AS int), 'data'||n FROM numbers;  INSERT INTO shipmentdetail (id, shipment, product, quantity, data, sd) WITH RECURSIVE numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt;= 10000000 ) SELECT n, floor(random() * 100000) + 1, floor(random() * 50000) + 1, floor(random() * 10) + 1, 'data'||n, CASE WHEN n % 100000 = 0 THEN n+1 ELSE NULL END FROM numbers;  ANALYZE; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0423\u0436\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043d\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0437\u0434\u0435\u0441\u044c:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a Oracle<\/b><\/p>\n<div class=\"spoiler_text\">Hostname:116.203.61.136<br \/>  Port:1521<br \/>  SID:orclcdb<br \/>  User\/DB:test<br \/>  Password:test  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a MS SQL<\/b><\/p>\n<div class=\"spoiler_text\">Hostname:195.201.126.177<br \/>  DB:test<br \/>  User:guest<br \/>  Password:Guest111  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a PostgreSQL<\/b><\/p>\n<div class=\"spoiler_text\">Hostname:159.69.8.94<br \/>  Port:5432<br \/>  DB:test<br \/>  User:guest<br \/>  Password:guest  <\/div>\n<\/div>\n<p>  <a name=\"view\"><\/a><\/p>\n<h3>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f (View)<\/h3>\n<p>  \u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e SQL \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0441\u044f \u043a\u0430\u043a \u043d\u0430\u0431\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434 \u0434\u043b\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439. \u042d\u0442\u0430 \u0438\u0434\u0435\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u043b\u0430\u0441\u044c, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e SQL \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043a\u0430\u043a \u0438 \u0443 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0443 \u043d\u0435\u0433\u043e \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0432 \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. \u0422\u0430\u043a \u043d\u0430 \u0441\u0432\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f (View). <\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043b\u0438 SQL \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044f\u0442\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u043e\u0442 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0422\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u0442\u043a\u0438:<\/p>\n<pre><code class=\"sql\">CREATE VIEW balance AS SELECT stock, product, SUM(quantity) AS quantity \tFROM \t\t(SELECT receipt.stock, product, quantity \t\tFROM receiptDetail  \t\t\tJOIN receipt ON receiptDetail.receipt = receipt.id \t\tUNION ALL  \t\tSELECT shipment.stock, product, -quantity \t\t\tFROM shipmentDetail  \t\t\tJOIN shipment ON shipmentDetail.shipment = shipment.id \t\t) details \tGROUP BY stock, product <\/code><\/pre>\n<p>  \u0418 \u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043a\u0430\u043a \u043a \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435.<\/p>\n<pre><code class=\"sql\">SELECT product.name, balance.stock, balance.quantity  FROM product JOIN balance ON product.id = balance.product  WHERE product.name = 'Product 8693' <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0435\u0441\u043b\u0438 \u0435\u043c\u0443 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0432 \u0441\u0430\u043c\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0443\u0436\u0435 \u0441 \u043d\u043e\u0432\u043e\u0439 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>  \u041a\u0430\u043a \u0438 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043b\u043e SQL \u0434\u0432\u0435 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438: \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u2014 \u0432\u043e\u0442 \u043e\u043d\u043e \u0441\u0447\u0430\u0441\u0442\u044c\u0435, \u043d\u043e \u0434\u0430\u043b\u044c\u0448\u0435, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a.<\/p>\n<p>  <a name=\"matview\"><\/a><\/p>\n<h3>View: \u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445<\/h3>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0447\u043d\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u044b, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u0435 \u0434\u0435\u0433\u0440\u0430\u0434\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u043d\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u043e. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u0438\u0445 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432, \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u00ab\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u00bb, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0435\u0435 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442. \u042d\u0442\u043e \u0447\u0443\u0442\u044c \u0437\u0430\u043c\u0435\u0434\u043b\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u044c, \u043d\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442 \u0447\u0442\u0435\u043d\u0438\u0435. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0449\u0435. \u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u043c\u044f\u0433\u043a\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043d\u0435 \u0442\u0430\u043a \u043b\u0435\u0433\u043a\u043e, \u043a\u0430\u043a \u043a\u0430\u0436\u0435\u0442\u0441\u044f. \u0412\u043e \u0432\u0441\u044f\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445. \u0412 \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u043a\u043b\u0430\u0434\u0430 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u043f\u043e \u0441\u0442\u0430\u0440\u043e\u043c\u0443 \u0441\u043a\u043b\u0430\u0434\u0443 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u043e\u0442\u043d\u044f\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432 \u044d\u0442\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a \u043e\u0441\u0442\u0430\u0442\u043a\u0430\u043c \u043f\u043e \u043d\u043e\u0432\u043e\u043c\u0443 \u0441\u043a\u043b\u0430\u0434\u0443. \u0410 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u043d\u0443\u0436\u043d\u043e \u043a \u043e\u0441\u0442\u0430\u0442\u043a\u0430\u043c \u043f\u043e \u0441\u043a\u043b\u0430\u0434\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0440\u044b\u043c \u0438 \u043d\u043e\u0432\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c. \u0415\u0441\u043b\u0438 \u0436\u0435, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0432 \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0432\u0441\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0437\u0430\u043f\u0443\u0442\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u043f\u043b\u0430\u043d\u0435 \u0443\u043c\u0435\u044e\u0442 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0421\u0423\u0411\u0414.<\/p>\n<p>  \u0423 PostgreSQL \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442, \u043d\u043e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043e\u043d \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442.<\/p>\n<p>  \u0412 MS SQL \u0435\u0441\u0442\u044c \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f (\u043f\u043e \u0441\u0443\u0442\u0438 \u0442\u0435 \u0436\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043c\u0435\u044e\u0442 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c\u0441\u044f, \u043d\u043e <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/views\/create-indexed-views?view=sql-server-ver15#additional-requirements\">\u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439<\/a> \u0442\u0430\u043c \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u0435\u0442. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e SUM GROUP BY \u0438 INNER JOIN, \u0442\u043e \u0435\u0441\u0442\u044c \u0434\u0430\u0436\u0435 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043e\u0441\u0442\u0430\u0442\u043a\u0430\u043c\u0438 \u0432 MS SQL \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u041f\u043b\u044e\u0441 \u0432 MS SQL \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0432 MS SQL \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u043e\u0431\u0449\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421 Oracle \u0432\u0441\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\u0417\u0430 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043e\u043f\u0446\u0438\u044f FAST REFRESH.<\/p>\n<p>  \u0423 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 FAST REFRESH \u0432 Oracle <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/19\/dwhsg\/basic-materialized-views.html#GUID-505C24CF-5D56-4820-88AA-2221410950E7\">\u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439<\/a> \u0435\u0449\u0435 \u0434\u043b\u0438\u043d\u043d\u0435\u0435 \u0447\u0435\u043c \u0443 MS SQL, \u043d\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043d \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443:<\/p>\n<ul>\n<li>\u0418\u0437 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f GROUP BY \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e SUM \u0438 \u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 COUNT, AVERAGE)  <\/li>\n<li>\u041d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u043a\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043b\u044e\u0431\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u00ab\u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435\u00bb \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438.  <\/li>\n<li>\u0412\u0441\u0435 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u044b (\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f) \u0441 GROUP BY, UNION ALL, OUTER JOIN \u0442\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c.  <\/li>\n<li>\u0423 OUTER JOIN \u0438 \u0444\u043e\u0440\u043c\u0443\u043b \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e (\u043f\u0440\u0430\u0432\u0434\u0430, \u043d\u0435 \u0443\u0442\u043e\u0447\u043d\u044f\u0435\u0442\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e)  <\/li>\n<li>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c SUM, \u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c COUNT, \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043b\u043e\u0433\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439, UNION&#8217;\u044b \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 UNION ALL \u0438 \u0442.\u043f.  <\/li>\n<\/ul>\n<p>  \u0422\u0440\u0435\u0442\u0438\u0439 \u0438 \u043f\u044f\u0442\u044b\u0439 \u043f\u0443\u043d\u043a\u0442\u044b \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u044d\u0442\u0438\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u044b \/ \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0447\u0442\u043e, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u044e \u0438\u0434\u0435\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439. \u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0443\u0441\u0443\u0433\u0443\u0431\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u0442\u0435\u043c \u0444\u0430\u043a\u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u043a\u043b\u044e\u0447\u0430\u043c\u0438 \u0441\u043a\u043b\u0430\u0434 \u0438 \u0442\u043e\u0432\u0430\u0440 \u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0443\u0434\u0430 \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u0440\u0435\u0437\u0435\u0440\u0432\u043e\u0432, \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0432 \u0430\u0441\u0441\u043e\u0440\u0442\u0438\u043c\u0435\u043d\u0442\u0435 \u0438 \u0442.\u043f. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u0430\u0436\u0434\u043e\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0435\u0439 \/ \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430 \u0438\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445, \u0433\u0434\u0435 \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u041d\u043e \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u043e\u0440\u0432\u0435\u0442\u0435\u0441\u044c \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u0435 \u044d\u0442\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0435 \u043d\u0443\u0436\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0436\u0434\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0441\u044e\u0440\u043f\u0440\u0438\u0437: \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438.<\/p>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043e\u0434:<\/p>\n<pre><code class=\"sql\">START TRANSACTION ; \u2026 UPDATE receiptDetail SET quantity = quantity + 1; ... SELECT quantity FROM balance WHERE stock = 14 AND sku=65 \u2026 COMMIT; <\/code><\/pre>\n<p>  \u0442\u043e, \u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 balance \u043d\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0441\u0442\u0430\u0442\u043e\u043a (\u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430), \u0430 \u0435\u0441\u043b\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435:<\/p>\n<ul>\n<li>\u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u043c \u2014 \u043f\u0440\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \/ \u0440\u0430\u0437\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438  <\/li>\n<li>\u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438  <\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 Oracle \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0432 MSSQL, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u043b\u0435\u043a\u0430 \u043e\u0442 \u0436\u0438\u0437\u043d\u0435\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u043e\u0433\u0434\u0430 \u0438\u0445 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0448\u044c \u043f\u0440\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442, \u0447\u0442\u043e \u043e\u043d\u0438 \u0432\u0440\u043e\u0434\u0435 \u0438 \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u043e \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u0435\u0439 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u044d\u0442\u0438\u0445 \u0436\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430\u0434\u043e \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0435\u0445 \u0436\u0435 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0443\u0441\u043b\u044b\u0448\u0438\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u043e \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b, \u043e\u0431\u0449\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0443\u044e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0410 \u043d\u0430 \u0443\u0442\u043e\u0447\u043d\u044f\u044e\u0449\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u2014 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b \u043d\u0430 \u0447\u0442\u043e, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043e\u0431\u0449\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0438 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0443\u0441\u043b\u044b\u0448\u0438\u0442\u0435 \u043e\u0442\u0432\u0435\u0442: \u00ab\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433, \u0430 \u043d\u0435 \u0442\u0430\u043a\u0442\u0438\u043a\u00bb \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u00ab\u0434\u043e\u043a\u0442\u043e\u0440, \u043e\u0442\u043a\u0443\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438\u00bb, \u044f \u0441 \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f. \u0425\u043e\u0442\u044f \u0432 \u0442\u043e, \u0447\u0442\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0418\u0421, \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 (\u043d\u0443 \u0438\u043b\u0438 \u0437\u0430\u0434\u043e\u043b\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439), \u043a\u0430\u043a-\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0432\u0435\u0440\u0438\u0442\u0441\u044f.<\/p>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0447\u0442\u043e \u00ab\u043a\u0430\u043a-\u0442\u043e\u00bb. \u041b\u043e\u0433\u0438\u043a\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u0427\u0430\u0441\u0442\u044c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u044e\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442). \u0415\u0449\u0435 \u0438\u043d\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0442\u0440\u044e\u043a \u043a\u0430\u043a \u00ab\u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u00bb: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u044d\u043c\u0443\u043b\u0438\u0440\u0443\u044e\u0442 \u043f\u043e\u043b\u043d\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0441\u0435\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430), \u0430 \u043f\u043e\u0442\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u043d\u043e\u0432\u043e). \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u0433\u0438\u043a\u0443 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0449\u0435, \u043d\u043e \u043a\u0443\u0434\u0430 \u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430).<\/p>\n<p>  <a name=\"consview\"><\/a><\/p>\n<h3>View: \u0414\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b<\/h3>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0435\u0433\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u0438 \u0442\u0443\u0442 \u0443 \u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u043e\u0435 \u0431\u0438\u0437\u043d\u0435\u0441-\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435: \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 0. \u0415\u0441\u043b\u0438 \u0431\u044b \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c\u0438 \u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043b\u0435\u0433\u043a\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0441\u043e\u0437\u0434\u0430\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u0443\u0436\u043d\u043e\u0435 \u043f\u043e\u043b\u0435, \u043d\u043e \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0430 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0438 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0421\u0423\u0411\u0414 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442.<\/p>\n<p>  \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u043f\u043b\u0430\u043d\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0435 \u0421\u0423\u0411\u0414 (MS SQL \u0438 Oracle) \u2014 \u044d\u0442\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0435\u0433\u043e. \u041d\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u043f\u044f\u0442\u044c-\u0442\u0430\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439. \u0422\u0443\u0442, \u043f\u0440\u0430\u0432\u0434\u0430, \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430. \u0417\u0430\u0442\u043e \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. \u042d\u0442\u043e, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u0430 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u044b), \u0438, \u0435\u0441\u043b\u0438 \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0432\u0434\u0440\u0443\u0433 \u043d\u0430\u0440\u0443\u0448\u0438\u0442\u0441\u044f \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u0432\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u0430, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u044b \u0432\u043f\u0443\u0441\u0442\u0443\u044e.<\/p>\n<p>  \u0412\u043e\u043e\u0431\u0449\u0435 \u0442\u0435\u043c\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043d\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f (\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u043e\u0431\u0449\u0435) \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e <a href=\"http:\/\/www.dba-oracle.com\/t_sql_patterns_materialized_view.htm\">\u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b<\/a> \u043e\u0434\u0438\u043d \u0438\u0437 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u044b\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u043e\u0432 Oracle Donald Burleson \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0432\u043e\u0438\u0445 \u043a\u043d\u0438\u0433. \u0418, \u0432 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e, \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0432\u044b\u0432\u043e\u0434\u0443, \u0447\u0442\u043e \u0438 \u044f:  <\/p>\n<blockquote><p>This is pointless from a practical perspective, however.<\/p><\/blockquote>\n<p>\u041f\u0440\u0430\u0432\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0430\u0431\u0437\u0430\u0446:  <\/p>\n<blockquote><p>Sooner or later incremental refresh limitations will be lifted. For the purpose of further constraint study in this book, let&#8217;s continue pretending as if it already happened. <\/p><\/blockquote>\n<p>\u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0443 \u043d\u0435\u0433\u043e \u0432\u0435\u0441\u044c\u043c\u0430 \u0438\u0440\u043e\u043d\u0438\u0447\u043d\u044b\u043c c \u0443\u0447\u0435\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043a\u043d\u0438\u0433\u0430 \u043f\u0438\u0441\u0430\u043b\u0430\u0441\u044c \u0432 2005 \u0433\u043e\u0434\u0443, \u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u0443\u0436\u0435 2019 \u0433\u043e\u0434, \u0438 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 14 \u043b\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f.<\/p>\n<p>  \u041d\u043e \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0442\u0430\u043a\u043e\u0439 workaround \u0441 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0435\u0449\u0435 \u043a\u0430\u043a-\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0442\u043e \u0441 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430\u043c\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u0430\u0431\u0430\u0432\u043d\u043e:  <\/p>\n<blockquote><p>If you create a trigger on a base table of a materialized view, then you must ensure that the trigger does not fire during a refresh of the materialized view. During refresh, the DBMS_MVIEW procedure I_AM_A_REFRESH returns TRUE.  <\/p><\/blockquote>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043d\u0438\u0445 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u043b\u044f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u043e\u043d\u0438 \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e. \u0422\u0430\u043a\u043e\u0439 \u043a\u043e\u0442 \u0428\u0440\u0435\u0434\u0438\u043d\u0433\u0435\u0440\u0430, \u0432\u0440\u043e\u0434\u0435 \u0442\u0440\u0438\u0433\u0433\u0435\u0440 \u0435\u0441\u0442\u044c, \u0430 \u0432\u0440\u043e\u0434\u0435 \u0435\u0433\u043e \u0438 \u043d\u0435\u0442. <a href=\"https:\/\/asktom.oracle.com\/pls\/apex\/asktom.search?tag=triggers-on-materialized-views\">\u0422\u0443\u0442<\/a> \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u044b \u043d\u0430 Ask Tom.<\/p>\n<p>  <a name=\"paramview\"><\/a><\/p>\n<h3>View: \u0412 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043e FROM \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0441\u0442\u0430\u0442\u043e\u043a, \u0430 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043d\u0430 \u0434\u0430\u0442\u0443. \u0415\u0441\u043b\u0438 \u0431\u044b \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u043e \u00ab\u0432\u0441\u0435\u043c\u0438\u00bb \u0434\u0430\u0442\u0430\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 dates), \u0442\u043e \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"sql\">CREATE VIEW balance AS SELECT stock, product, dates.value AS date, SUM(quantity) AS quantity \tFROM \t\t(SELECT receipt.stock, product, receipt.date, quantity \t\tFROM receiptDetail  \t\t\tJOIN receipt ON receiptDetail.receipt = receipt.id \t\tUNION ALL  \t\tSELECT shipment.stock, product, shipment.date, -quantity \t\t\tFROM shipmentDetail  \t\t\tJOIN shipment ON shipmentDetail.shipment = shipment.id \t\t) details \t\tJOIN dates ON details.date &lt; dates.value \tGROUP BY stock, product, dates.value <\/code><\/pre>\n<p>  \u041d\u043e \u0442\u0430\u043a\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 SQL \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0435. <\/p>\n<p>  \u0412 MS SQL \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u0435\u0441\u0442\u044c \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 table inlined \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432 \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code class=\"sql\">CREATE FUNCTION balance (     @date DATE ) RETURNS TABLE AS RETURN SELECT stock, product, SUM(quantity) AS quantity \tFROM \t\t(SELECT receipt.stock, product, quantity \t\tFROM receiptDetail  \t\t\tJOIN receipt ON receiptDetail.receipt = receipt.id \t\t\tWHERE receipt.date &lt; @date \t\tUNION ALL  \t\tSELECT shipment.stock, product, -quantity \t\t\tFROM shipmentDetail  \t\t\tJOIN shipment ON shipmentDetail.shipment = shipment.id \t\t\tWHERE shipment.date &lt; @date \t\t) details \tGROUP BY stock, product <\/code><\/pre>\n<p>  \u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0432\u043e FROM \u044d\u0442\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0432 ON, \u0430 \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445:<\/p>\n<pre><code class=\"sql\">SELECT product.name, balance.stock, balance.quantity  \tFROM product  \tJOIN balance('07.07.2019') ON product.id = balance.product  \tWHERE product.name = 'Product 8693' <\/code><\/pre>\n<p>  \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u0436\u0435 \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f (\u0447\u0430\u0441\u0442\u043e \u0438\u0445 \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438).<\/p>\n<p>  \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0432 SQL \u043d\u0443\u0436\u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f, \u0443 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u044c\u043c\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u043c. \u0422\u0430\u043a, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u043e FROM \u044d\u0442\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438\u0437 FROM. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"sql\">SELECT shipmentDetail.id, b.quantity \tFROM shipmentDetail  \tJOIN shipment ON shipmentDetail.shipment = shipment.id \tJOIN balance(shipment.date) b ON b.stock = shipment.stock AND b.product = shipmentDetail.product  \tWHERE shipmentDetail.quantity = 5 <\/code><\/pre>\n<p>  SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u0447\u0442\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430 shipment \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430. \u0422\u0443\u0442, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a \u0438 \u043d\u0430\u0434\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u0437 FROM \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u0438\u0434\u0435\u043e\u043b\u043e\u0433\u0438\u044e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 JOIN (\u0442\u043e \u0435\u0441\u0442\u044c, \u0447\u0442\u043e JOIN&#8217;\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c shipment \u043f\u043e\u0441\u043b\u0435 balance) \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432 SQL \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0443\u043c\u0435\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u043f\u043e\u043b\u044f \u0438\u0437 \u0443\u0436\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 (\u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u044d\u0442\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043f\u0440\u043e Join Predicate Push Down), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443, \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0431\u0438\u0440\u0430\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 JOIN&#8217;\u043e\u0432 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043a\u043e\u0433\u0434\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 (\u0438\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043b\u044e\u0431\u043e\u0439 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441) \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u043e\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442. \u0418 \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0438 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0421\u0423\u0411\u0414 \u0442\u0430\u043a \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b, \u0435\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0437\u0430\u0433\u0430\u0434\u043a\u0430.<\/p>\n<p>  UPD: \u041f\u0440\u0438\u0448\u043b\u0430 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430 \u0438\u0437 \u0437\u0430\u043b\u0430, \u0447\u0442\u043e \u0442\u0430\u043a\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0438 \u0421\u0423\u0411\u0414 \u0432\u0441\u0435 \u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 CROSS APPLY \/ OUTER APPLY (\u0430\u043d\u0430\u043b\u043e\u0433\u0438 INNER \u0438 OUTER JOIN). \u041d\u043e \u0438\u0440\u043e\u043d\u0438\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0441 View \u044d\u0442\u043e \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u044d\u0442\u0438\u0445 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u0445 \u043d\u0435\u0442\u0443 ON, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u043a\u043b\u044e\u0447\u0438 \u044d\u0442\u043e\u0433\u043e View \u043e\u0444\u043e\u0440\u043c\u043b\u044f\u0442\u044c \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 table inlined \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0440\u043e\u0434\u0435:  <\/p>\n<pre><code class=\"plaintext\">SELECT FROM balance('01.01.19'); <\/code><\/pre>\n<p>  \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0442\u0430\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0441 \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0442\u044f\u0436\u043a\u043e\u0439 (\u0430 \u043f\u043e \u0441\u0443\u0442\u0438 \u043d\u0435\u043b\u044c\u0437\u044f).<\/p>\n<p>  \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0444\u0430\u043a\u0442 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u043a\u0442\u043e\u043c, \u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c pushdown \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0432\u043d\u0443\u0442\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u043f\u0440\u043e\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT shipmentDetail.id, b.quantity \tFROM shipmentDetail  \tJOIN shipment ON shipmentDetail.shipment = shipment.id \tJOIN (SELECT stock, product, dates.date, SUM(quantity) AS quantity \t\tFROM \t\t\t(SELECT receipt.stock, product, receipt.date, quantity \t\t\tFROM receiptDetail  \t\t\t\tJOIN receipt ON receiptDetail.receipt = receipt.id \t\t\tUNION ALL  \t\t\tSELECT shipment.stock, product, shipment.date, -quantity \t\t\t\tFROM shipmentDetail  \t\t\t\tJOIN shipment ON shipmentDetail.shipment = shipment.id \t\t\t) details \t\tJOIN  \t\t\t(SELECT shipment.date \t\t\t\tFROM shipmentDetail  \t\t\t\tJOIN shipment ON shipmentDetail.shipment = shipment.id \t\t\t\tWHERE shipmentDetail.quantity = 5 \t\t\t\tGROUP BY shipment.date \t\t\t) dates ON details.date &lt; dates.date \t\tGROUP BY stock, product, dates.date \t) b ON b.stock = shipment.stock AND b.product = shipmentDetail.product AND b.date = shipment.date \tWHERE shipmentDetail.quantity = 5 <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445, \u0438, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c, \u043d\u0430\u0440\u0443\u0448\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 Don&#8217;t repeat yourself.<\/p>\n<p>  \u041f\u043e\u0434\u044b\u0442\u043e\u0436\u0438\u0432\u0430\u044f \u0432\u0441\u0435 \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0445\u043e\u0442\u044c \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043a\u0430\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u043e \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u043d\u0435 \u0443\u043c\u0435\u044e\u0442 \u0438 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0443\u043c\u0435\u044e\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0432 SQL \u043b\u0438\u0448\u044c \u0441\u0430\u043c\u044b\u0439 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0430 \u0442\u043e\u0447\u043d\u0435\u0435, \u043e\u0447\u0435\u043d\u044c \u043d\u0438\u0437\u043a\u0438\u0439, \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0433 \u0431\u044b \u0431\u044b\u0442\u044c, \u0435\u0441\u043b\u0438 \u0431\u044b \u0432\u0441\u0435 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435)<\/p>\n<p>  <a name=\"jppd\"><\/a><\/p>\n<h3>Join Predicate Push Down (JPPD)<\/h3>\n<p>  \u041f\u0440\u043e\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u044c \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440\u0430 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u042d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0430\u0437\u0435 (\u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u0438\u0432\u043e\u0434\u044f \u043f\u043e\u0440\u043e\u0439 \u043a \u043a\u0430\u0442\u0430\u0441\u0442\u0440\u043e\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0434\u0435\u0433\u0440\u0430\u0434\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438), \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0432\u0435\u0440\u0445\u043d\u0435\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u044d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0421\u0423\u0411\u0414<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0438\u0437 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0435 (\u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u0440\u043e\u0441\u0442\u043e predicate push down, \u0431\u0435\u0437 join):<\/p>\n<pre><code class=\"sql\">SELECT balance.quantity \tFROM (SELECT product, SUM(quantity) AS quantity \t\tFROM \t\t\t(SELECT product, quantity \t\t\tFROM receiptDetail  \t\t\t\tJOIN receipt ON receiptDetail.receipt = receipt.id \t\t\tUNION ALL  \t\t\tSELECT product, -quantity \t\t\t\tFROM shipmentDetail  \t\t\t\tJOIN shipment ON shipmentDetail.shipment = shipment.id \t\t\t) details \t\tGROUP BY product \t) balance \tWHERE balance.product = 345 <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u0438\u0434\u0438\u0442, \u0447\u0442\u043e \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u0435\u0441\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0435 product \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u043e 345, \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442 \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0442\u0443\u0434\u0430. \u0417\u0430\u043e\u0434\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0435\u0441\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e \u043f\u043e\u043b\u044e product, SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u044d\u0442\u043e \u043f\u043e\u043b\u0435 \u0438\u0437 BY (\u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0432\u043d\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e), \u0430 \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0440\u0443\u0433\u0438\u0445 BY \u0432 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0435\u0442, \u0442\u043e \u0438 \u0432\u0435\u0441\u044c GROUP BY \u0446\u0435\u043b\u0438\u043a\u043e\u043c. \u0418\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"sql\">SELECT balance.quantity \tFROM (SELECT SUM(quantity) AS quantity \t\tFROM \t\t\t(SELECT product, quantity \t\t\tFROM receiptDetail  \t\t\t\tJOIN receipt ON receiptDetail.receipt = receipt.id \t\t\tUNION ALL  \t\t\tSELECT product, -quantity \t\t\t\tFROM shipmentDetail  \t\t\t\tJOIN shipment ON shipmentDetail.shipment = shipment.id \t\t\t) details \t\t\tWHERE details.product = 345 \t) balance <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u0438\u0434\u0438\u0442 \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0441 UNION \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442 \u044d\u0442\u043e\u0442 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 \u0432\u043d\u0443\u0442\u0440\u044c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 UNION:<\/p>\n<pre><code class=\"sql\">SELECT balance.quantity \tFROM (SELECT SUM(quantity) AS quantity \t\tFROM \t\t\t(SELECT product, quantity \t\t\tFROM receiptDetail  \t\t\t\tJOIN receipt ON receiptDetail.receipt = receipt.id \t\t\t\tWHERE product = 345 \t\t\tUNION ALL  \t\t\tSELECT product, -quantity \t\t\t\tFROM shipmentDetail  \t\t\t\tJOIN shipment ON shipmentDetail.shipment = shipment.id \t\t\t\tWHERE product = 345 \t\t\t) details \t) balance <\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u043e product \u0432 shipmentDetail \u0438 \u0432 receiptDetail \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043d\u0443 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439:<\/p>\n<pre><code class=\"sql\">SELECT balance.quantity \tFROM product \tJOIN \t\t(SELECT product, SUM(quantity) AS quantity \t\t\tFROM \t\t\t\t(SELECT product, quantity \t\t\t\tFROM receiptDetail  \t\t\t\t\tJOIN receipt ON receiptDetail.receipt = receipt.id \t\t\t\tUNION ALL  \t\t\t\tSELECT product, -quantity \t\t\t\t\tFROM shipmentDetail  \t\t\t\t\tJOIN shipment ON shipmentDetail.shipment = shipment.id \t\t\t\t) details \t\t\tGROUP BY product \t\t) balance ON balance.product = product.id \tWHERE product.group = 54 <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0438 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f join. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043e\u043d \u0443\u0436\u0435 \u0432\u044b\u0431\u0440\u0430\u043b, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u043c join&#8217;\u043e\u043c \u0431\u0443\u0434\u0435\u0442 product \u0438 \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043e\u0442\u0442\u0443\u0434\u0430 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u043e group (\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043e\u043d \u0435\u0441\u0442\u044c). \u0414\u0430\u043b\u0435\u0435 \u043e\u043d \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441 balance, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 nested loop join (\u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u0433\u043e\u043c \u043f\u043e \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0435\u043c\u0443\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 product, \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e \u043f\u043e\u043b\u044e group). \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u0438\u0434\u0438\u0442, \u0447\u0442\u043e \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 balance.product = product.id, \u0433\u0434\u0435 product.id \u2014 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430, \u0442\u043e \u0435\u0441\u0442\u044c, \u0442\u043e\u0447\u044c-\u0432-\u0442\u043e\u0447\u044c \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0448\u0435, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0442\u0435\u0445\u043d\u0438\u043a\u0443 predicate push, \u0447\u0442\u043e \u043e\u043d \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u0434\u0435\u043b\u0430\u0435\u0442. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d MSSQL<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 128\u043c\u0441  <\/p>\n<pre> Rows\tExecutes  Stmt Text 41\t1\t  |--Nested Loops(Inner Join, OUTER REFERENCES:([test].[dbo].[product].[id])) 41\t1\t       |--Index Seek(OBJECT:([test].[dbo].[product].[product_group]), SEEK:([test].[dbo].[product].[group]=(54)) ORDERED FORWARD) 0\t0\t       |--Compute Scalar(DEFINE:([Expr1013]=CASE WHEN [globalagg1020]=(0) THEN NULL ELSE [globalagg1022] END)) 41\t41\t            |--Stream Aggregate(DEFINE:([globalagg1020]=SUM([partialagg1019]), [globalagg1022]=SUM([partialagg1021]))) 82\t41\t                 |--Concatenation 41\t41\t                      |--Stream Aggregate(DEFINE:([partialagg1019]=COUNT_BIG([test].[dbo].[receiptdetail].[quantity]), [partialagg1021]=SUM([test].[dbo].[receiptdetail].[quantity]))) 809\t41\t                      |    |--Nested Loops(Inner Join, OUTER REFERENCES:([test].[dbo].[receiptdetail].[id])) 809\t41\t                      |         |--Index Seek(OBJECT:([test].[dbo].[receiptdetail].[receiptdetail_product_fk]), SEEK:([test].[dbo].[receiptdetail].[product]=[test].[dbo].[product].[id]) ORDERED FORWARD) 809\t809\t                      |         |--Clustered Index Seek(OBJECT:([test].[dbo].[receiptdetail].[PK__receiptd__3213E83F930DCBDA]), SEEK:([test].[dbo].[receiptdetail].[id]=[test].[dbo].[receiptdetail].[id]) LOOKUP ORDERED FORWARD) 41\t41\t                      |--Stream Aggregate(DEFINE:([partialagg1019]=COUNT_BIG([Expr1010]), [partialagg1021]=SUM([Expr1010]))) 0\t0\t                           |--Compute Scalar(DEFINE:([Expr1010]= -[test].[dbo].[shipmentdetail].[quantity])) 8383\t41\t                                |--Nested Loops(Inner Join, OUTER REFERENCES:([test].[dbo].[shipmentdetail].[id], [Expr1023]) WITH UNORDERED PREFETCH) 8383\t41\t                                     |--Index Seek(OBJECT:([test].[dbo].[shipmentdetail].[shipmentdetail_product_fk]), SEEK:([test].[dbo].[shipmentdetail].[product]=[test].[dbo].[product].[id]) ORDERED FORWARD) 8383\t8383\t                                     |--Clustered Index Seek(OBJECT:([test].[dbo].[shipmentdetail].[PK__shipment__3213E83F2FF9E454]), SEEK:([test].[dbo].[shipmentdetail].[id]=[test].[dbo].[shipmentdetail].[id]) LOOKUP ORDERED FORWARD) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d Oracle<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 80\u043c\u0441  <\/p>\n<pre> ----------------------------------------------------------------------------------------------------------------------- | Id  | Operation                                 | Name                      | Rows  | Bytes | Cost (%CPU)| Time     | ----------------------------------------------------------------------------------------------------------------------- |   0 | SELECT STATEMENT                          |                           |       |       | 11247 (100)|          | |   1 |  NESTED LOOPS                             |                           |    50 |  1100 | 11247   (1)| 00:00:01 | |   2 |   TABLE ACCESS BY INDEX ROWID BATCHED     | PRODUCT                   |    50 |   450 |    45   (0)| 00:00:01 | |*  3 |    INDEX RANGE SCAN                       | PRODUCT_GROUP             |    50 |       |     1   (0)| 00:00:01 | |   4 |   VIEW PUSHED PREDICATE                   |                           |     1 |    13 |   224   (0)| 00:00:01 | |*  5 |    FILTER                                 |                           |       |       |            |          | |   6 |     SORT AGGREGATE                        |                           |     1 |    26 |            |          | |   7 |      VIEW                                 |                           |   218 |  5668 |   224   (0)| 00:00:01 | |   8 |       UNION-ALL                           |                           |       |       |            |          | |   9 |        TABLE ACCESS BY INDEX ROWID BATCHED| RECEIPTDETAIL             |    20 |   180 |    23   (0)| 00:00:01 | |* 10 |         INDEX RANGE SCAN                  | RECEIPTDETAIL_PRODUCT_FK  |    20 |       |     3   (0)| 00:00:01 | |  11 |        TABLE ACCESS BY INDEX ROWID BATCHED| SHIPMENTDETAIL            |   198 |  1584 |   201   (0)| 00:00:01 | |* 12 |         INDEX RANGE SCAN                  | SHIPMENTDETAIL_PRODUCT_FK |   198 |       |     3   (0)| 00:00:01 | -----------------------------------------------------------------------------------------------------------------------  Predicate Information (identified by operation id): ---------------------------------------------------      3 - access(\"PRODUCT\".\"group\"=54)    5 - filter(COUNT(*)&gt;0)   10 - access(\"RECEIPTDETAIL\".\"PRODUCT\"=\"PRODUCT\".\"ID\")   12 - access(\"SHIPMENTDETAIL\".\"PRODUCT\"=\"PRODUCT\".\"ID\") <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441 balance \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u0441 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 54, \u0430 \u043d\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u0432 \u0431\u0430\u0437\u0435 (\u043f\u0440\u0430\u0432\u0434\u0430, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u043e\u0432\u0430\u0440\u0430 \u0441 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 54). <\/p>\n<p>  \u0422\u0443\u0442, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0442\u0435\u0445\u043d\u0438\u043a\u0430 JPPD \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f nested loop join, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a, SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0443\u043c\u0435\u044e\u0442 \u043f\u0440\u043e\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0442\u044c \u0438 hash join. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 balance.product = \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0430 \u00ab\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439\u00bb \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 hash(balance.product) = \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u00ab\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439\u00bb, \u043f\u043e\u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u0443 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 \u043d\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0430 \u0432 SQL, \u043d\u043e \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f).<\/p>\n<p>  \u0412\u043e\u043e\u0431\u0449\u0435 \u0443 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 JPPD \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0435, \u0431\u043e\u043b\u0435\u0435 \u00ab\u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435\u00bb \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u2014 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0422\u0430\u043a, \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435:<\/p>\n<pre><code class=\"sql\">SELECT balance.quantity \tFROM product \tJOIN \t\t(SELECT SUM(quantity) AS quantity \t\t\tFROM \t\t\t\t(SELECT quantity \t\t\t\tFROM receiptDetail  \t\t\t\t\tJOIN receipt ON receiptDetail.receipt = receipt.id \t\t\t\t\tWHERE receiptDetail.product = product.id \t\t\t\tUNION ALL  \t\t\t\tSELECT -quantity \t\t\t\t\tFROM shipmentDetail  \t\t\t\t\tJOIN shipment ON shipmentDetail.shipment = shipment.id \t\t\t\t\tWHERE shipmentDetail.product = product.id \t\t\t\t) details \t\t) balance ON TRUE \tWHERE product.group = 54 <\/code><\/pre>\n<p>  \u0418 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u043a\u043b\u044e\u0447\u0435 (\u0441 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0430) \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c JPPD \u043e\u043f\u0438\u0441\u0430\u043d \u0432 <a href=\"https:\/\/patents.google.com\/patent\/US7945562B2\/en\">\u043f\u0430\u0442\u0435\u043d\u0442\u0435<\/a> Oracle. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0442\u0430\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u043d\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0435 (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 Oracle) \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043f\u043e\u043b\u044f\u043c \u0442\u0430\u0431\u043b\u0438\u0446 \u0438\u0437 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043f\u043e\u0447\u0435\u043c\u0443, \u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0435 \u043c\u044b \u0443\u0436\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u0438\u0441\u044c, \u043a\u043e\u0433\u0434\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445), \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 JPPD, \u0438\u0437 \u0442\u0430\u043a\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u043e.<\/p>\n<p>  \u0421\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0440\u0430\u0434\u0438, \u043d\u0430\u0434\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u0435\u043b\u0430\u044e\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043e\u043d\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 predicate push down, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u044f\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u043b\u0430\u043d, \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442 \u0435\u0433\u043e \u0441\u043e \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0431\u0435\u0437 \u043f\u0440\u043e\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u044c \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u0432. \u0418 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u043b\u0430\u043d\u0430 \u0431\u0435\u0437 \u043f\u0440\u043e\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0448\u0435, \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442 \u043f\u043b\u0430\u043d \u0441 \u043f\u0440\u043e\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u0435\u043c.  <\/div>\n<\/div>\n<p>  \u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c JPPD \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0430\u0436\u0435\u043d \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439. \u0418 \u0435\u0441\u043b\u0438 \u0431\u044b JPPD \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u043e, \u0442\u043e \u0438 \u0432 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0442\u043e\u0436\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u043e \u0441\u043c\u044b\u0441\u043b\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u0431\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0439 (!) \u0431\u0430\u0437\u044b \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u043d\u0438\u043c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0431\u044b\u043b\u0430 \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0436\u0430\u0441\u043d\u0430\u044f.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c JPPD \u0432 \u0421\u0423\u0411\u0414 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u043e \u0443 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0435\u0441\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u043c\u0435\u0434\u0430\u043b\u0438.<\/p>\n<p>  <a name=\"windowjppd\"><\/a><\/p>\n<h3>JPPD: \u041d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043e\u043a\u043e\u043d\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u043c\u0438 CTE<\/h3>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"sql\">SELECT id, seqnum \tFROM  \t\t(SELECT id, row_number() OVER (PARTITION BY shipment ORDER BY id) AS seqnum \t\t\tFROM shipmentdetail \t\t) t \tWHERE t.id=6770436 <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d MS SQL<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 1.2\u0441  <\/p>\n<pre> Rows\tExecutes  Stmt Text 1\t1\t  |--Filter(WHERE:([test].[dbo].[shipmentdetail].[id]=(6770436))) 10000001\t1\t       |--Window Aggregate(DEFINE:([Expr1002]=row_number), PARTITION COLUMNS:([test].[dbo].[shipmentdetail].[shipment]), ROWS BETWEEN:(UNBOUNDED, CURRENT ROW)) 10000001\t1\t            |--Index Scan(OBJECT:([test].[dbo].[shipmentdetail].[shipmentdetail_shipment_fk]), ORDERED FORWARD) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d Oracle<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 14\u0441  <\/p>\n<pre> ---------------------------------------------------------------------------------------------- | Id  | Operation           | Name           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | ---------------------------------------------------------------------------------------------- |   0 | SELECT STATEMENT    |                |       |       |       | 57555 (100)|          | |*  1 |  VIEW               |                |    10M|   247M|       | 57555   (1)| 00:00:03 | |   2 |   WINDOW SORT       |                |    10M|   104M|   191M| 57555   (1)| 00:00:03 | |   3 |    TABLE ACCESS FULL| SHIPMENTDETAIL |    10M|   104M|       | 13841   (1)| 00:00:01 | ---------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): ---------------------------------------------------      1 - filter(\"T\".\"ID\"=6770436) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0437 \u043f\u043b\u0430\u043d\u0430, SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u043e\u043c\u0435\u0440\u0430 \u0441\u0442\u0440\u043e\u043a \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0431\u0430\u0437\u0435 \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u0443\u044e \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (\u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434).<\/p>\n<p>  <a name=\"denormjppd\"><\/a><\/p>\n<h3>JPPD: \u041d\u0438\u0437\u043a\u0430\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0434\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/h3>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u043e\u0442\u0433\u0440\u0443\u0437\u043a\u0438 \u0441 \u0434\u0430\u0442\u044b \u043f\u043e \u0434\u0430\u0442\u0443 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043e\u0431\u0449\u0438\u043c\u0438 \u0441\u0443\u043c\u043c\u0430\u043c\u0438 \u043e\u0442\u0433\u0440\u0443\u0437\u043a\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c (\u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430\u0434\u0443\u043c\u0430\u043d\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u0442\u0443\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e, \u0441\u043a\u0430\u0436\u0435\u043c, \u0441\u0443\u043c\u043c\u0435 \u0437\u0430\u0434\u043e\u043b\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043d\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u0430 \u0437\u0430 \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0432\u044b\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0435\u0441\u0442\u044c):<\/p>\n<pre><code class=\"sql\">SELECT shipment.id, supplied.quantity \tFROM shipment \tJOIN ( \t\tSELECT customer, SUM(quantity) AS quantity \t\t\tFROM shipmentDetail \t\t\tJOIN shipment ON shipment.id = shipmentDetail.shipment \t\t\tGROUP BY customer \t) supplied ON supplied.customer = shipment.customer \tWHERE shipment.date = DATEADD(day, -10, CAST(GETDATE() AS date)) <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0443 \u043d\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u044b\u043b\u0438 \u043e\u0442\u0433\u0440\u0443\u0437\u043a\u0438 \u0437\u0430 \u044d\u0442\u0438 \u0434\u0430\u0442\u044b, \u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0442\u0433\u0440\u0443\u0437\u043e\u043a \u0437\u0430 \u044d\u0442\u0438 \u0434\u0430\u0442\u044b, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0443\u043c\u043c\u0430 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437. <\/p>\n<p>  \u041f\u0440\u0430\u0432\u0434\u0430, \u044d\u0442\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u043a\u043e\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c \u043e\u0442\u0431\u043e\u0440\u0430 \u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u0442\u043e\u0439 \u043e\u0442\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c). \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0442\u0430\u043a\u043e\u0435 \u0431\u044b\u0432\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043d\u043e\u0433\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u043e\u0442\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430), \u043d\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0431\u0430\u0437\u0435, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<p>  <a name=\"commjppd\"><\/a><\/p>\n<h3>JPPD: \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0445 \u0421\u0423\u0411\u0414<\/h3>\n<p>  \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, JPPD \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 PostgreSQL. \u0414\u0430\u0436\u0435 \u0432 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435:<\/p>\n<pre><code class=\"sql\">SELECT income.quantity \tFROM product \tJOIN \t\t(SELECT product, SUM(quantity) AS quantity \t\t\tFROM shipmentDetail  \t\t\tJOIN shipment ON shipmentDetail.shipment = shipment.id \t\t\tGROUP BY product \t\t) income ON income.product = product.id \tWHERE product.\"group\" = 54 <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d PostgreSQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> \"Hash Join  (cost=252901.05..254168.34 rows=49 width=32) (actual time=11580.152..11607.399 rows=48 loops=1)\" \"  Hash Cond: (shipmentdetail.product = product.id)\" \"  -&gt;  HashAggregate  (cost=252763.56..253394.04 rows=50439 width=36) (actual time=11579.912..11603.696 rows=50000 loops=1)\" \"        Group Key: shipmentdetail.product\" \"        -&gt;  Hash Join  (cost=2985.02..202764.28 rows=9999855 width=9) (actual time=46.117..5967.219 rows=10000001 loops=1)\" \"              Hash Cond: (shipmentdetail.shipment = shipment.id)\" \"              -&gt;  Seq Scan on shipmentdetail  (cost=0.00..173528.55 rows=9999855 width=13) (actual time=0.017..1158.157 rows=10000001 loops=1)\" \"              -&gt;  Hash  (cost=1735.01..1735.01 rows=100001 width=4) (actual time=45.798..45.798 rows=100001 loops=1)\" \"                    Buckets: 131072  Batches: 1  Memory Usage: 4540kB\" \"                    -&gt;  Seq Scan on shipment  (cost=0.00..1735.01 rows=100001 width=4) (actual time=0.018..19.940 rows=100001 loops=1)\" \"  -&gt;  Hash  (cost=136.88..136.88 rows=49 width=4) (actual time=0.202..0.202 rows=48 loops=1)\" \"        Buckets: 1024  Batches: 1  Memory Usage: 10kB\" \"        -&gt;  Bitmap Heap Scan on product  (cost=4.67..136.88 rows=49 width=4) (actual time=0.045..0.181 rows=48 loops=1)\" \"              Recheck Cond: (\"group\" = 54)\" \"              Heap Blocks: exact=46\" \"              -&gt;  Bitmap Index Scan on product_group  (cost=0.00..4.66 rows=49 width=0) (actual time=0.025..0.025 rows=48 loops=1)\" \"                    Index Cond: (\"group\" = 54)\" \"Planning Time: 0.658 ms\" \"Execution Time: 11608.602 ms\" <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e \u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 PostgreSQL \u0437\u0430\u043d\u044f\u0442\u044b \u0447\u0435\u043c \u0443\u0433\u043e\u0434\u043d\u043e, \u043d\u043e \u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0435 \u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0437\u0430\u0433\u0430\u0434\u043a\u0430. <\/p>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u043f\u0430\u0442\u0435\u043d\u0442\u0435 \u043d\u0430 JPPD, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 Oracle \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0436 \u0434\u043e 2028 \u0433\u043e\u0434\u0430 (\u043e\u043d\u0438 \u0435\u0433\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u043e\u0434\u043b\u0435\u0432\u0430\u044e\u0442, \u0432\u043d\u043e\u0441\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f). \u041e\u0434\u043d\u0430\u043a\u043e, \u043a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0432\u044b\u0448\u0435, Microsoft&#8217;\u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0430\u0442\u0435\u043d\u0442\u0430 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442.<\/p>\n<p>  <a name=\"jppdgen\"><\/a>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0432\u0441\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b JPPD \u0445\u043e\u0442\u044c \u0438 \u043d\u0435 \u0441\u043c\u0435\u0440\u0442\u0435\u043b\u044c\u043d\u044b\u0435, \u043d\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0435. \u0420\u0435\u0448\u0438\u0442\u044c \u0438\u0445 \u043c\u043e\u0436\u043d\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0438\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c JPPD: \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 JOIN \u0432\u043d\u0443\u0442\u0440\u044c \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<p>  \u0422\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u043a\u043e\u043d\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u043f\u0440\u043e\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT id, seqnum \tFROM  \t\t(SELECT id, row_number() OVER (PARTITION BY shipment ORDER BY id) AS seqnum \t\t\tFROM shipmentdetail \t\t\tJOIN  \t\t\t\t(SELECT t.shipment AS ps \t\t\t\t\tFROM shipmentdetail t  \t\t\t\t\tWHERE t.id = 6770436 \t\t\t) pushed ON pushed.ps = shipment \t\t) t \tWHERE t.id=6770436 <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d MS SQL<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 60\u043c\u0441  <\/p>\n<pre> Rows\tExecutes  Stmt Text 1\t1\t  |--Filter(WHERE:([test].[dbo].[shipmentdetail].[id]=(6770436))) 97\t1\t       |--Sequence Project(DEFINE:([Expr1003]=row_number)) 97\t1\t            |--Segment 97\t1\t                 |--Nested Loops(Inner Join, OUTER REFERENCES:([t].[shipment])) 1\t1\t                      |--Clustered Index Seek(OBJECT:([test].[dbo].[shipmentdetail].[PK__shipment__3213E83F2FF9E454] AS [t]), SEEK:([t].[id]=(6770436)) ORDERED FORWARD) 97\t1\t                      |--Index Seek(OBJECT:([test].[dbo].[shipmentdetail].[shipmentdetail_shipment_fk]), SEEK:([test].[dbo].[shipmentdetail].[shipment]=[test].[dbo].[shipmentdetail].[shipment] as [t].[shipment]) ORDERED FORWARD) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d Oracle<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 30\u043c\u0441  <\/p>\n<pre> --------------------------------------------------------------------------------------------------------------------- | Id  | Operation                              | Name                       | Rows  | Bytes | Cost (%CPU)| Time     | --------------------------------------------------------------------------------------------------------------------- |   0 | SELECT STATEMENT                       |                            |       |       |   106 (100)|          | |*  1 |  VIEW                                  |                            |    99 |  2574 |   106   (1)| 00:00:01 | |   2 |   WINDOW SORT                          |                            |    99 |  2178 |   106   (1)| 00:00:01 | |   3 |    NESTED LOOPS                        |                            |    99 |  2178 |   105   (0)| 00:00:01 | |   4 |     TABLE ACCESS BY INDEX ROWID        | SHIPMENTDETAIL             |     1 |    11 |     3   (0)| 00:00:01 | |*  5 |      INDEX UNIQUE SCAN                 | SYS_C007881                |     1 |       |     2   (0)| 00:00:01 | |   6 |     TABLE ACCESS BY INDEX ROWID BATCHED| SHIPMENTDETAIL             |    99 |  1089 |   102   (0)| 00:00:01 | |*  7 |      INDEX RANGE SCAN                  | SHIPMENTDETAIL_SHIPMENT_FK |    99 |       |     2   (0)| 00:00:01 | --------------------------------------------------------------------------------------------------------------------- <\/pre>\n<p>  Predicate Information (identified by operation id):<br \/>   \u2014  <br \/>   1 \u2014 filter(\u00abT\u00bb.\u00abID\u00bb=6770436)<br \/>   5 \u2014 access(\u00abT\u00bb.\u00abID\u00bb=6770436)<br \/>   7 \u2014 access(\u00abT\u00bb.\u00abSHIPMENT\u00bb=\u00abSHIPMENT\u00bb)  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d PostgreSQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> \"Subquery Scan on t  (cost=400.40..403.62 rows=1 width=12) (actual time=0.810..0.891 rows=1 loops=1)\" \"  Filter: (t.id = 6770436)\" \"  Rows Removed by Filter: 105\" \"  -&gt;  WindowAgg  (cost=400.40..402.38 rows=99 width=16) (actual time=0.688..0.869 rows=106 loops=1)\" \"        -&gt;  Sort  (cost=400.40..400.65 rows=99 width=8) (actual time=0.651..0.668 rows=106 loops=1)\" \"              Sort Key: shipmentdetail.shipment, shipmentdetail.id\" \"              Sort Method: quicksort  Memory: 29kB\" \"              -&gt;  Nested Loop  (cost=5.63..397.12 rows=99 width=8) (actual time=0.094..0.593 rows=106 loops=1)\" \"                    -&gt;  Index Scan using shipmentdetail_pkey on shipmentdetail t_1  (cost=0.43..8.45 rows=1 width=4) (actual time=0.021..0.023 rows=1 loops=1)\" \"                          Index Cond: (id = 6770436)\" \"                    -&gt;  Bitmap Heap Scan on shipmentdetail  (cost=5.19..387.69 rows=98 width=8) (actual time=0.065..0.520 rows=106 loops=1)\" \"                          Recheck Cond: (shipment = t_1.shipment)\" \"                          Heap Blocks: exact=106\" \"                          -&gt;  Bitmap Index Scan on shipmentdetail_shipment_fk  (cost=0.00..5.17 rows=98 width=0) (actual time=0.029..0.029 rows=106 loops=1)\" \"                                Index Cond: (shipment = t_1.shipment)\" \"Planning Time: 0.671 ms\" \"Execution Time: 0.984 ms\" <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u043f\u0440\u043e\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT shipment.id, supplied.quantity \tFROM shipment \tJOIN ( \t\tSELECT customer, SUM(quantity) AS quantity \t\t\tFROM shipmentDetail \t\t\tJOIN shipment ON shipment.id = shipmentDetail.shipment \t\t\tJOIN ( \t\t\t\tSELECT customer AS pcust \t\t\t\t\tFROM shipment \t\t\t\t\tWHERE shipment.date = DATEADD(day, -10, CAST(GETDATE() AS date)) \t\t\t\t\tGROUP BY customer \t\t\t) pushcust ON pushcust.pcust = customer \t\t\tGROUP BY customer \t) supplied ON supplied.customer = shipment.customer \tWHERE shipment.date = DATEADD(day, -10, CAST(GETDATE() AS date)) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u0443 \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u044d\u0442\u0443 \u0442\u0435\u0445\u043d\u0438\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 PostgreSQL. \u0422\u0430\u043a, \u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 JPPD \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0432:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u043f\u0440\u043e\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT balance.quantity \tFROM product \tJOIN \t\t(SELECT product, SUM(quantity) AS quantity \t\t\tFROM \t\t\t\t(SELECT product, quantity \t\t\t\tFROM receiptDetail  \t\t\t\t\tJOIN receipt ON receiptDetail.receipt = receipt.id \t\t\t\t\tJOIN product ON product.id = receiptDetail.product \t\t\t\t\tWHERE product.group = 54 \t\t\t\tUNION ALL  \t\t\t\tSELECT product, -quantity \t\t\t\t\tFROM shipmentDetail  \t\t\t\t\tJOIN shipment ON shipmentDetail.shipment = shipment.id \t\t\t\t\tJOIN product ON product.id = shipmentDetail.product \t\t\t\t\tWHERE product.group = 54 \t\t\t\t) details \t\t \tGROUP BY product \t\t) balance ON balance.product = product.id \tWHERE product.group = 54 <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d PostgreSQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> \"Hash Join  (cost=43596.42..43601.45 rows=1 width=32) (actual time=93.861..93.898 rows=48 loops=1)\" \"  Hash Cond: (receiptdetail.product = product.id)\" \"  -&gt;  HashAggregate  (cost=43458.93..43461.43 rows=200 width=36) (actual time=93.685..93.707 rows=48 loops=1)\" \"        Group Key: receiptdetail.product\" \"        -&gt;  Append  (cost=9.54..43405.03 rows=10780 width=34) (actual time=0.056..89.656 rows=10672 loops=1)\" \"              -&gt;  Nested Loop  (cost=9.54..4448.35 rows=980 width=9) (actual time=0.056..7.524 rows=913 loops=1)\" \"                    -&gt;  Nested Loop  (cost=9.26..4151.50 rows=980 width=13) (actual time=0.043..3.946 rows=913 loops=1)\" \"                          -&gt;  Bitmap Heap Scan on product product_1  (cost=4.67..136.88 rows=49 width=4) (actual time=0.017..0.124 rows=48 loops=1)\" \"                                Recheck Cond: (\"group\" = 54)\" \"                                Heap Blocks: exact=46\" \"                                -&gt;  Bitmap Index Scan on product_group  (cost=0.00..4.66 rows=49 width=0) (actual time=0.011..0.011 rows=48 loops=1)\" \"                                      Index Cond: (\"group\" = 54)\" \"                          -&gt;  Bitmap Heap Scan on receiptdetail  (cost=4.59..81.72 rows=21 width=13) (actual time=0.017..0.072 rows=19 loops=48)\" \"                                Recheck Cond: (product = product_1.id)\" \"                                Heap Blocks: exact=910\" \"                                -&gt;  Bitmap Index Scan on receiptdetail_product_fk  (cost=0.00..4.58 rows=21 width=0) (actual time=0.012..0.012 rows=19 loops=48)\" \"                                      Index Cond: (product = product_1.id)\" \"                    -&gt;  Index Only Scan using receipt_pkey on receipt  (cost=0.29..0.30 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=913)\" \"                          Index Cond: (id = receiptdetail.receipt)\" \"                          Heap Fetches: 913\" \"              -&gt;  Nested Loop  (cost=10.93..38794.98 rows=9800 width=36) (actual time=0.170..80.715 rows=9759 loops=1)\" \"                    -&gt;  Nested Loop  (cost=10.64..35728.52 rows=9800 width=13) (actual time=0.151..35.242 rows=9759 loops=1)\" \"                          -&gt;  Bitmap Heap Scan on product product_2  (cost=4.67..136.88 rows=49 width=4) (actual time=0.030..0.170 rows=48 loops=1)\" \"                                Recheck Cond: (\"group\" = 54)\" \"                                Heap Blocks: exact=46\" \"                                -&gt;  Bitmap Index Scan on product_group  (cost=0.00..4.66 rows=49 width=0) (actual time=0.020..0.020 rows=48 loops=1)\" \"                                      Index Cond: (\"group\" = 54)\" \"                          -&gt;  Bitmap Heap Scan on shipmentdetail  (cost=5.97..724.38 rows=198 width=13) (actual time=0.071..0.678 rows=203 loops=48)\" \"                                Recheck Cond: (product = product_2.id)\" \"                                Heap Blocks: exact=9745\" \"                                -&gt;  Bitmap Index Scan on shipmentdetail_product_fk  (cost=0.00..5.92 rows=198 width=0) (actual time=0.037..0.037 rows=203 loops=48)\" \"                                      Index Cond: (product = product_2.id)\" \"                    -&gt;  Index Only Scan using shipment_pkey on shipment  (cost=0.29..0.31 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=9759)\" \"                          Index Cond: (id = shipmentdetail.shipment)\" \"                          Heap Fetches: 9759\" \"  -&gt;  Hash  (cost=136.88..136.88 rows=49 width=4) (actual time=0.166..0.166 rows=48 loops=1)\" \"        Buckets: 1024  Batches: 1  Memory Usage: 10kB\" \"        -&gt;  Bitmap Heap Scan on product  (cost=4.67..136.88 rows=49 width=4) (actual time=0.041..0.151 rows=48 loops=1)\" \"              Recheck Cond: (\"group\" = 54)\" \"              Heap Blocks: exact=46\" \"              -&gt;  Bitmap Index Scan on product_group  (cost=0.00..4.66 rows=49 width=0) (actual time=0.028..0.028 rows=48 loops=1)\" \"                    Index Cond: (\"group\" = 54)\" \"Planning Time: 1.553 ms\" \"Execution Time: 94.071 ms\" <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 JOIN \u0441 product \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0442\u0440\u0438 \u0440\u0430\u0437\u0430, \u043d\u043e \u044d\u0442\u043e \u043a\u0443\u0434\u0430 \u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u0438\u0437 \u0437\u043e\u043b, \u0447\u0435\u043c \u0440\u0430\u0441\u0447\u0435\u0442 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0439 \u0431\u0430\u0437\u044b.<\/p>\n<p>  <a name=\"joinwhere\"><\/a><\/p>\n<h3>\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u043a\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043d\u0430 \u0442\u0438\u043f\u044b JOIN \u0438 WHERE<\/h3>\n<p>  \u041d\u0435\u043c\u043d\u043e\u0433\u0438\u0435 \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u044e\u0442, \u043d\u043e \u043b\u043e\u0433\u0438\u043a\u0430, \u0432\u043b\u0438\u044f\u044e\u0449\u0430\u044f \u043d\u0430 \u0442\u043e, \u043a\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432 SQL, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0430 \u043d\u0430 2 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\u0422\u0438\u043f JOIN, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0431\u0443\u0434\u0443\u0442 \u043b\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0438\u0437 \u043f\u0440\u0430\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0438\u0437 \u043e\u0431\u0435\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438\u043b\u0438 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446.  <\/li>\n<li>WHERE \u2014 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 AND, OR \u0438 NOT, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c.  <\/li>\n<\/ul>\n<p>  \u0427\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438, \u0442\u0430\u043a \u044d\u0442\u043e \u0442\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u043b\u043e\u0433\u0438\u043a\u0443 JOIN \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u0432 WHERE, \u0432\u0435\u0434\u044c \u0442\u0438\u043f\u044b JOIN \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u0431\u0443\u043b\u0435\u0432\u0443 \u043b\u043e\u0433\u0438\u043a\u0443:<\/p>\n<ul>\n<li>A INNER JOIN B \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 IN JOIN A AND IN JOIN B  <\/li>\n<li>A LEFT JOIN B \u2014 IN JOIN A  <\/li>\n<li>A RIGHT JOIN B \u2014 IN JOIN B  <\/li>\n<li>A FULL JOIN B \u2014 IN JOIN A OR IN JOIN B  <\/li>\n<\/ul>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"sql\">SELECT COALESCE(X.id, D.id)  \tFROM  \t\t(SELECT A.id  \t\t\tFROM A  \t\t\tINNER JOIN B ON A.id = B.id  \t\t\tLEFT JOIN C ON C.id = A.id \t\t) X  \tFULL JOIN D ON X.id = D.id <\/code><\/pre>\n<p>  \u0412\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u0431\u044b \u043a\u0430\u043a:<\/p>\n<pre><code class=\"sql\">SELECT A.id  \tFROM A  \tAUTO JOIN B ON A.id = B.id  \tAUTO JOIN C ON C.id=A.id  \tAUTO JOIN D ON D.id=A.id  \tWHERE (IN JOIN A AND IN JOIN B) OR IN JOIN D <\/code><\/pre>\n<p>  \u0425\u0443\u0436\u0435 \u0432\u0441\u0435\u0433\u043e \u0432 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u0435\u043b\u0430 \u043e\u0431\u0441\u0442\u043e\u044f\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0441 FULL JOIN, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u043b\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c COALESCE, \u0447\u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c PPD \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0432\u043c\u0435\u0441\u0442\u043e FULL JOIN \u0447\u0430\u0449\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 UNION, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e:<\/p>\n<pre><code class=\"sql\">SELECT COALESCE(A.id, B.id)  FROM A  FULL JOIN B ON A.id=B.id <\/code><\/pre>\n<p>  \u041f\u0438\u0448\u0443\u0442:<\/p>\n<pre><code class=\"sql\">SELECT id FROM A  UNION  SELECT id FROM B <\/code><\/pre>\n<p>  \u041f\u0440\u0430\u0432\u0434\u0430, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0443 \u0434\u0432\u0443\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0438\u0437 A \u0438 B, \u0432\u0441\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0445\u0443\u0436\u0435 (\u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e LEFT JOIN). \u0422\u0430\u043a, \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"sql\">SELECT COALESCE(A.id, B.id), COALESCE(A.f,0)+COALESCE(B.f,0)  FROM A  FULL JOIN B ON A.id=B.id <\/code><\/pre>\n<p>  \u0421 UNION \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"sql\">SELECT A.id, A.f + COALESCE(B.f,0)  FROM A  LEFT JOIN B ON A.id = B.id UNION SELECT B.id, B.f + COALESCE(A.f,0)  FROM B  LEFT JOIN A ON A.id = B.id <\/code><\/pre>\n<p>  \u0410 \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446 A, B, C, D \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e (A.f=1 OR B.f=2) AND (C.f=3 OR D.f=4), \u0442\u043e \u0432\u0441\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0435\u0447\u0430\u043b\u044c\u043d\u043e. \u0422\u0430\u043a, \u0441 FULL JOIN \u043c\u044b \u043e\u043f\u044f\u0442\u044c-\u0442\u0430\u043a\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 COALESCE \u0443\u0431\u044c\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0430 \u0441 UNION \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u043c\u0443 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043a \u0414\u041d\u0424 \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0442\u0430\u043a\u043e\u0433\u043e:<\/p>\n<pre><code class=\"sql\">SELECT A.id \tFROM A  \tJOIN C ON A.id = C.id \tWHERE A.f=1 AND C.f=3 UNION SELECT A.id \tFROM A  \tJOIN D ON A.id = D.id \tWHERE A.f=1 AND D.f=4 UNION SELECT B.id \tFROM B  \tJOIN C ON B.id = C.id \tWHERE B.f=2 AND C.f=3 UNION SELECT B.id \tFROM B  \tJOIN D ON B.id = D.id \tWHERE B.f=2 AND D.f=4 <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0435\u0449\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043a\u0430\u043a\u0443\u044e \u0442\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u043e\u0442 \u043f\u043e\u043b\u0435\u0439 \u0438\u0437 A, B, C \u0438 D, \u0442\u043e \u0438\u0437-\u0437\u0430 LEFT JOIN&#8217;\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0440\u0430\u0441\u0442\u0435\u0442 \u0435\u0449\u0435 \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430.<\/p>\n<p>  \u0422\u0443\u0442, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u043a\u0430\u0436\u0443\u0442: \u00ab\u0447\u0442\u043e \u044d\u0442\u043e \u0443 \u0432\u0430\u0441 \u0437\u0430 \u0442\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u043d\u0430\u044f \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c\u00bb, \u043d\u043e, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442 (\u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0435\u0441\u0442\u044c), \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043a\u0430\u043a \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u044d\u0442\u0438 \u043f\u043e\u043b\u044f \u0431\u0443\u0434\u0443\u0442 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u0443\u0434\u0443\u0442 (\u043f\u0440\u0430\u0432\u0434\u0430, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435).<\/p>\n<p>  \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0431\u044b \u0442\u0438\u043f JOIN \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u043c IN JOIN, \u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u043e\u043d \u043c\u043e\u0433 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0437 \u0443\u0441\u043b\u043e\u0432\u0438\u044f (\u0441\u043a\u0430\u0436\u0435\u043c, \u0438\u0437 A.f = 1 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 IN JOIN A), \u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a:<\/p>\n<pre><code class=\"sql\">SELECT A.id  \tFROM A  \tAUTO JOIN B ON A.id = B.id  \tAUTO JOIN C ON A.id = C.id  \tAUTO JOIN D ON A.id = D.id  \tWHERE (A.f=1 OR B.f=2) AND (C.f=3 OR D.f=4) <\/code><\/pre>\n<p>  \u0418 \u0434\u0430\u043b\u044c\u0448\u0435 SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u0443\u0436\u0435 \u0441\u0430\u043c \u043c\u043e\u0433 \u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 UNION \/ FULL JOIN \u0438 \u043a\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b JOIN \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445. \u0421\u0435\u0439\u0447\u0430\u0441 \u0436\u0435 \u044d\u0442\u0443 \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443.<\/p>\n<p>  <a name=\"oropt\"><\/a><\/p>\n<h3>\u041f\u043b\u043e\u0445\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f OR<\/h3>\n<p>  \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b A, B, C, D, \u0430 \u043e\u0434\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 mytable \u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u043e\u043b\u044f A, B, C, D:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b mytable MS SQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">CREATE TABLE mytable (cid INT, A INT, B INT, C INT , D INT, data VARCHAR(400));  WITH numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt; 10000000 ) INSERT INTO mytable (cid, A, B, C, D, data) SELECT n, ABS(checksum(NewId())) % 100 + 1, ABS(checksum(NewId())) % 100 + 1, ABS(checksum(NewId())) % 100 + 1, ABS(checksum(NewId())) % 100 + 1, CONCAT('data',n)  FROM numbers option (maxrecursion 0);  CREATE INDEX AC ON mytable(A,C); CREATE INDEX AD ON mytable(A,D); CREATE INDEX BC ON mytable(B,C); CREATE INDEX BD ON mytable(B,D);  EXEC sp_updatestats; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b mytable Oracle<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">CREATE TABLE mytable (cid INT, A INT, B INT, C INT , D INT, \"data\" VARCHAR(400));  INSERT INTO mytable (cid, A, B, C, D, \"data\") WITH numbers ( n ) AS (    SELECT 1 AS n FROM dual    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt; 10000000 ) SELECT n, round(dbms_random.value() * 100) + 1, round(dbms_random.value() * 100) + 1, round(dbms_random.value() * 100) + 1, round(dbms_random.value() * 100) + 1, CONCAT('data',n)  FROM numbers;  CREATE INDEX AC ON mytable(A,C); CREATE INDEX AD ON mytable(A,D); CREATE INDEX BC ON mytable(B,C); CREATE INDEX BD ON mytable(B,D);  EXEC DBMS_STATS.GATHER_DATABASE_STATS; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b mytable PostgreSQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">CREATE TABLE mytable (cid INT, A INT, B INT, C INT , D INT, \"data\" VARCHAR(400));  INSERT INTO mytable (cid, A, B, C, D, \"data\") WITH RECURSIVE numbers ( n ) AS (    SELECT 1 AS n    UNION ALL    SELECT n + 1 AS n    FROM   numbers    WHERE  n &lt; 10000000 ) SELECT n, floor(random() * 100) + 1, floor(random() * 100) + 1, floor(random() * 100) + 1, floor(random() * 100) + 1, CONCAT('data',n)  FROM numbers;  CREATE INDEX AC ON mytable(A,C); CREATE INDEX AD ON mytable(A,D); CREATE INDEX BC ON mytable(B,C); CREATE INDEX BD ON mytable(B,D);  ANALYZE; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"sql\">SELECT COUNT(*) FROM mytable WHERE (A=1 OR B=2) AND (C=3 OR D=4) <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043f\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f\u043c \u044d\u0442\u0438\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a: AC, BC, AD, BD.<\/p>\n<pre><code class=\"sql\">CREATE INDEX AC ON mytable(A,C); CREATE INDEX AD ON mytable(A,D); CREATE INDEX BC ON mytable(B,C); CREATE INDEX BD ON mytable(B,D); <\/code><\/pre>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d Oracle<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 320\u043c\u0441  <\/p>\n<pre> -------------------------------------------------------------------------------------------------------- | Id  | Operation                            | Name    | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | -------------------------------------------------------------------------------------------------------- |   0 | SELECT STATEMENT                     |         |       |       |       | 12436 (100)|          | |   1 |  SORT AGGREGATE                      |         |     1 |    16 |       |            |          | |*  2 |   TABLE ACCESS BY INDEX ROWID BATCHED| MYTABLE |  3882 | 62112 |       | 12436   (1)| 00:00:01 | |   3 |    BITMAP CONVERSION TO ROWIDS       |         |       |       |       |            |          | |   4 |     BITMAP OR                        |         |       |       |       |            |          | |   5 |      BITMAP CONVERSION FROM ROWIDS   |         |       |       |       |            |          | |   6 |       SORT ORDER BY                  |         |       |       |  1568K|            |          | |*  7 |        INDEX RANGE SCAN              | AC      |       |       |       |   241   (1)| 00:00:01 | |   8 |      BITMAP CONVERSION FROM ROWIDS   |         |       |       |       |            |          | |   9 |       SORT ORDER BY                  |         |       |       |  1568K|            |          | |* 10 |        INDEX RANGE SCAN              | BC      |       |       |       |   235   (1)| 00:00:01 | -------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): ---------------------------------------------------      2 - filter((\"C\"=3 OR \"D\"=4))    7 - access(\"A\"=1)        filter(\"A\"=1)   10 - access(\"B\"=2)        filter(\"B\"=2) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d PostgreSQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> \"Aggregate  (cost=81577.07..81577.08 rows=1 width=8) (actual time=255.927..255.928 rows=1 loops=1)\" \"  -&gt;  Bitmap Heap Scan on mytable  (cost=3863.84..81567.12 rows=3980 width=0) (actual time=60.368..255.477 rows=3886 loops=1)\" \"        Recheck Cond: ((a = 1) OR (b = 2))\" \"        Filter: ((c = 3) OR (d = 4))\" \"        Rows Removed by Filter: 195540\" \"        Heap Blocks: exact=68751\" \"        -&gt;  BitmapOr  (cost=3863.84..3863.84 rows=208664 width=0) (actual time=43.859..43.859 rows=0 loops=1)\" \"              -&gt;  Bitmap Index Scan on ad  (cost=0.00..1924.43 rows=103999 width=0) (actual time=32.954..32.954 rows=100496 loops=1)\" \"                    Index Cond: (a = 1)\" \"              -&gt;  Bitmap Index Scan on bd  (cost=0.00..1937.42 rows=104665 width=0) (actual time=10.902..10.902 rows=100014 loops=1)\" \"                    Index Cond: (b = 2)\" \"Planning Time: 0.603 ms\" \"Execution Time: 256.078 ms\" <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b \u0442\u043e, \u0447\u0442\u043e \u0443\u0432\u0438\u0434\u0435\u043b. \u0422\u043e \u0435\u0441\u0442\u044c \u0432\u0437\u044f\u043b \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u043a\u043e\u0431\u043a\u0443, \u0443\u0432\u0438\u0434\u0435\u043b \u0432 \u043d\u0435\u0439 OR, \u0440\u0430\u0437\u0431\u0438\u043b \u0435\u0433\u043e \u043d\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u0430 \u0432\u0442\u043e\u0440\u0443\u044e \u0441\u043a\u043e\u0431\u043a\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u0441\u0432\u0435\u0440\u0445\u0443.<\/p>\n<p>  \u0411\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0445, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043e\u0442\u043b\u0438\u0447\u0438\u043b\u0441\u044f MS SQL:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d MS SQL<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 1.8\u0441  <\/p>\n<pre> Rows\tExecutes  Stmt Text 0\t0\t  |--Compute Scalar(DEFINE:([Expr1003]=CONVERT_IMPLICIT(int,[Expr1006],0))) 1\t1\t       |--Stream Aggregate(DEFINE:([Expr1006]=Count(*))) 3918\t1\t            |--Table Scan(OBJECT:([test2].[dbo].[mytable]), WHERE:(([test2].[dbo].[mytable].[A]=(1) OR [test2].[dbo].[mytable].[B]=(2)) AND ([test2].[dbo].[mytable].[C]=(3) OR [test2].[dbo].[mytable].[D]=(4)))) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041e\u043d \u0440\u0435\u0448\u0438\u043b \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u044b. \u041d\u043e \u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0431\u043e\u043b\u044c\u0448\u0435, MS SQL \u0443\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043b\u0430\u043d \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 Oracle \u0438 PostgreSQL, \u0442\u0430\u043a \u0447\u0442\u043e \u0441\u043f\u0438\u0448\u0435\u043c \u044d\u0442\u043e \u043d\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.<\/p>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044c \u0432\u0442\u043e\u0440\u0443\u044e \u0441\u043a\u043e\u0431\u043a\u0443:<\/p>\n<pre><code class=\"sql\">SELECT COUNT(*) FROM mytable WHERE ((A=1 OR B=2) AND C=3) OR ((A=1 OR B=2) AND D=4) <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u2014 \u043f\u043b\u0430\u043d\u044b \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435.<\/p>\n<p>  \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u2014 \u044d\u0442\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043a \u0414\u041d\u0424:<\/p>\n<pre><code class=\"sql\">SELECT COUNT(*) FROM mytable WHERE (A=1 AND C=3) OR (B=2 AND C=3) OR (A=1 AND D=4) OR (B=2 AND D=4) <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d Oracle<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 30\u043c\u0441  <\/p>\n<pre> ----------------------------------------------------------------------------------------- | Id  | Operation                        | Name | Rows  | Bytes | Cost (%CPU)| Time     | ----------------------------------------------------------------------------------------- |   0 | SELECT STATEMENT                 |      |       |       |    18 (100)|          | |   1 |  SORT AGGREGATE                  |      |     1 |    16 |            |          | |   2 |   BITMAP CONVERSION COUNT        |      |  3010 | 48160 |    18   (0)| 00:00:01 | |   3 |    BITMAP OR                     |      |       |       |            |          | |   4 |     BITMAP CONVERSION FROM ROWIDS|      |       |       |            |          | |*  5 |      INDEX RANGE SCAN            | BC   |       |       |     5   (0)| 00:00:01 | |   6 |     BITMAP CONVERSION FROM ROWIDS|      |       |       |            |          | |*  7 |      INDEX RANGE SCAN            | BD   |       |       |     5   (0)| 00:00:01 | |   8 |     BITMAP CONVERSION FROM ROWIDS|      |       |       |            |          | |*  9 |      INDEX RANGE SCAN            | AC   |       |       |     4   (0)| 00:00:01 | |  10 |     BITMAP CONVERSION FROM ROWIDS|      |       |       |            |          | |* 11 |      INDEX RANGE SCAN            | AD   |       |       |     4   (0)| 00:00:01 | ----------------------------------------------------------------------------------------- Predicate Information (identified by operation id): ---------------------------------------------------      5 - access(\"B\"=2 AND \"C\"=3)    7 - access(\"B\"=2 AND \"D\"=4)    9 - access(\"A\"=1 AND \"C\"=3)   11 - access(\"A\"=1 AND \"D\"=4) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d MS SQL<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 60\u043c\u0441  <\/p>\n<pre> Rows\tExecutes  Stmt Text 0\t0\t  |--Compute Scalar(DEFINE:([Expr1003]=CONVERT_IMPLICIT(int,[Expr1006],0))) 1\t1\t       |--Stream Aggregate(DEFINE:([Expr1006]=Count(*))) 3918\t1\t            |--Stream Aggregate(GROUP BY:([Bmk1000])) 3951\t1\t                 |--Merge Join(Concatenation) 2986\t1\t                      |--Merge Join(Concatenation) 1978\t1\t                      |    |--Merge Join(Concatenation) 941\t1\t                      |    |    |--Index Seek(OBJECT:([test2].[dbo].[mytable].[AC]), SEEK:([test2].[dbo].[mytable].[A]=(1) AND [test2].[dbo].[mytable].[C]=(3)) ORDERED FORWARD) 1037\t1\t                      |    |    |--Index Seek(OBJECT:([test2].[dbo].[mytable].[BC]), SEEK:([test2].[dbo].[mytable].[B]=(2) AND [test2].[dbo].[mytable].[C]=(3)) ORDERED FORWARD) 1008\t1\t                      |    |--Index Seek(OBJECT:([test2].[dbo].[mytable].[AD]), SEEK:([test2].[dbo].[mytable].[A]=(1) AND [test2].[dbo].[mytable].[D]=(4)) ORDERED FORWARD) 965\t1\t                      |--Index Seek(OBJECT:([test2].[dbo].[mytable].[BD]), SEEK:([test2].[dbo].[mytable].[B]=(2) AND [test2].[dbo].[mytable].[D]=(4)) ORDERED FORWARD) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d PostgreSQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> \"Aggregate  (cost=13171.55..13171.56 rows=1 width=8) (actual time=18.442..18.443 rows=1 loops=1)\" \"  -&gt;  Bitmap Heap Scan on mytable  (cost=93.97..13161.50 rows=4020 width=0) (actual time=3.493..17.545 rows=3886 loops=1)\" \"        Recheck Cond: (((a = 1) AND (c = 3)) OR ((b = 2) AND (c = 3)) OR ((a = 1) AND (d = 4)) OR ((b = 2) AND (d = 4)))\" \"        Heap Blocks: exact=3793\" \"        -&gt;  BitmapOr  (cost=93.97..93.97 rows=4020 width=0) (actual time=1.773..1.774 rows=0 loops=1)\" \"              -&gt;  Bitmap Index Scan on ac  (cost=0.00..22.76 rows=1033 width=0) (actual time=0.516..0.516 rows=993 loops=1)\" \"                    Index Cond: ((a = 1) AND (c = 3))\" \"              -&gt;  Bitmap Index Scan on bc  (cost=0.00..22.83 rows=1040 width=0) (actual time=0.440..0.440 rows=960 loops=1)\" \"                    Index Cond: ((b = 2) AND (c = 3))\" \"              -&gt;  Bitmap Index Scan on ad  (cost=0.00..22.14 rows=971 width=0) (actual time=0.224..0.224 rows=958 loops=1)\" \"                    Index Cond: ((a = 1) AND (d = 4))\" \"              -&gt;  Bitmap Index Scan on bd  (cost=0.00..22.20 rows=977 width=0) (actual time=0.592..0.592 rows=1020 loops=1)\" \"                    Index Cond: ((b = 2) AND (d = 4))\" \"Planning Time: 0.296 ms\" \"Execution Time: 18.539 ms\" <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0437 \u044d\u0442\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0441\u043e\u0431\u043e \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0418 \u044d\u0442\u043e, \u0432 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e, \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0430\u043a\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u2014 NP-\u043f\u043e\u043b\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0438 \u0432\u043e\u0437\u0438\u0442\u0441\u044f \u0441 \u043d\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044f\u043c SQL \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432, \u0432\u0438\u0434\u0438\u043c\u043e, \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u0438 \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 JOIN, \u043e\u043d\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043b\u043e\u0436\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<p>  <a name=\"nullopt\"><\/a><\/p>\n<h3>\u041f\u043b\u043e\u0445\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u0443\u044e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 (shipmentdetail) \u0438 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0443\u0434\u0430 \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0443 (sid) \u0438 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e \u043d\u0435\u0439 (shipment_sd). \u042d\u0442\u0430 \u043a\u043e\u043b\u043e\u043d\u043a\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e null \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0434\u043b\u044f \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b sid, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"sql\">SELECT COUNT(*) FROM ShipmentDetail s1, ShipmentDetail s2 WHERE s1.sd=s2.sd AND s1.id &lt;&gt; s2.id <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d MS SQL<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 3.5\u0441  <\/p>\n<pre> Rows\tExecutes  Stmt Text 1\t1\t  |--Compute Scalar(DEFINE:([Expr1002]=CONVERT_IMPLICIT(int,[Expr1008],0))) 1\t1\t       |--Hash Match(Aggregate, HASH:() DEFINE:([Expr1008]=COUNT(*))) 0\t1\t            |--Nested Loops(Inner Join, OUTER REFERENCES:([s1].[id], [s1].[sd], [Expr1007]) WITH UNORDERED PREFETCH) 10000001\t1\t                 |--Index Scan(OBJECT:([test].[dbo].[shipmentdetail].[shipmentdetail_sd] AS [s1])) 0\t10000001\t                 |--Index Seek(OBJECT:([test].[dbo].[shipmentdetail].[shipmentdetail_sd] AS [s2]), SEEK:([s2].[sd]=[test].[dbo].[shipmentdetail].[sd] as [s1].[sd]),  WHERE:([test].[dbo].[shipmentdetail].[id] as [s1].[id]&lt;&gt;[test].[dbo].[shipmentdetail].[id] as [s2].[id]) ORDERED FORWARD) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, MS SQL, \u043a\u043e\u0433\u0434\u0430 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 shipmentdetail_sd, \u043d\u0435 \u0434\u043e\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u043d\u0430 IS NOT NULL, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043e\u0447\u0435\u043d\u044c \u043d\u0438\u0437\u043a\u0430\u044f.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044f\u0432\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e s1.sd \u0438 s2.sd IS NOT NULL \u043a\u0430\u0440\u0442\u0438\u043d\u0430 \u0440\u0435\u0437\u043a\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"sql\">SELECT COUNT(*) FROM ShipmentDetail s1, ShipmentDetail s2 WHERE s1.sd=s2.sd AND s1.id &lt;&gt; s2.id AND s1.sd IS NOT NULL AND s2.sd IS NOT NULL <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d MS SQL<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 100\u043c\u0441  <\/p>\n<pre> Rows\tExecutes  Stmt Text 0\t0\t  |--Compute Scalar(DEFINE:([Expr1002]=CONVERT_IMPLICIT(int,[Expr1005],0))) 1\t1\t       |--Stream Aggregate(DEFINE:([Expr1005]=Count(*))) 0\t1\t            |--Nested Loops(Inner Join, OUTER REFERENCES:([s1].[id], [s1].[sd])) 100\t1\t                 |--Index Seek(OBJECT:([test].[dbo].[shipmentdetail].[shipmentdetail_sd] AS [s1]), SEEK:([s1].[sd] IsNotNull) ORDERED FORWARD) 0\t100\t                 |--Index Seek(OBJECT:([test].[dbo].[shipmentdetail].[shipmentdetail_sd] AS [s2]), SEEK:([s2].[sd]=[test].[dbo].[shipmentdetail].[sd] as [s1].[sd]),  WHERE:([test].[dbo].[shipmentdetail].[id] as [s1].[id]&lt;&gt;[test].[dbo].[shipmentdetail].[id] as [s2].[id] AND [test].[dbo].[shipmentdetail].[sd] as [s2].[sd] IS NOT NULL) ORDERED FORWARD) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421 PostgreSQL \u0432\u0441\u0435 \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0443 \u043d\u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u043d\u0435 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0438\u043b\u044c\u0442\u0440, \u0430 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 merge join \u0438, \u0432\u0438\u0434\u0438\u043c\u043e, \u0443\u043c\u0435\u0435\u0442 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432 \u043d\u0435\u043c NULL \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0442\u0443\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 MS SQL \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0445\u0438\u043d\u0442\u044b, \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442):<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d PostgreSQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> \"Aggregate  (cost=1216467.81..1216467.82 rows=1 width=8) (actual time=1.021..1.021 rows=1 loops=1)\" \"  -&gt;  Merge Join  (cost=0.87..1216467.81 rows=1 width=0) (actual time=1.017..1.017 rows=0 loops=1)\" \"        Merge Cond: (s1.sd = s2.sd)\" \"        Join Filter: (s1.id &lt;&gt; s2.id)\" \"        Rows Removed by Join Filter: 100\" \"        -&gt;  Index Scan using shipmentdetail_sd on shipmentdetail s1  (cost=0.43..583234.26 rows=9999855 width=8) (actual time=0.047..0.136 rows=101 loops=1)\" \"        -&gt;  Index Scan using shipmentdetail_sd on shipmentdetail s2  (cost=0.43..583234.26 rows=9999855 width=8) (actual time=0.015..0.757 rows=101 loops=1)\" \"Planning Time: 0.332 ms\" \"Execution Time: 1.089 ms\" <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0425\u043e\u0442\u044f, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 estimate \u0438 cost, \u0442\u043e \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e PostgreSQL \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e \u0432\u0441\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044f\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u0441\u043a\u0430\u0436\u0435\u043c, \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u2014 \u043d\u0430\u0439\u0442\u0438 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c &gt; 7<\/p>\n<pre><code class=\"sql\">SELECT COUNT(*) FROM shipmentDetail s1, shipmentDetail s2 WHERE s1.sd=s2.sd AND s1.id &lt;&gt; s2.id AND s1.quantity &gt; 7 AND s2.quantity &gt; 7; <\/code><\/pre>\n<p>  \u0422\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0443 \u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0447\u0442\u043e \u0438 \u0432 MS SQL:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d PostgreSQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> \"Aggregate  (cost=1165667.15..1165667.16 rows=1 width=8) (actual time=5203.586..5203.586 rows=1 loops=1)\" \"  -&gt;  Merge Join  (cost=1128001.01..1165667.15 rows=1 width=0) (actual time=5203.580..5203.580 rows=0 loops=1)\" \"        Merge Cond: (s1.sd = s2.sd)\" \"        Join Filter: (s1.id &lt;&gt; s2.id)\" \"        Rows Removed by Join Filter: 29\" \"        -&gt;  Sort  (cost=564000.51..571533.73 rows=3013290 width=8) (actual time=2802.648..2802.658 rows=30 loops=1)\" \"              Sort Key: s1.sd\" \"              Sort Method: external merge  Disk: 41120kB\" \"              -&gt;  Seq Scan on shipmentdetail s1  (cost=0.00..198528.19 rows=3013290 width=8) (actual time=0.051..2193.193 rows=2999089 loops=1)\" \"                    Filter: (quantity &gt; '7'::numeric)\" \"                    Rows Removed by Filter: 7000912\" \"        -&gt;  Materialize  (cost=564000.51..579066.96 rows=3013290 width=8) (actual time=2400.884..2400.894 rows=30 loops=1)\" \"              -&gt;  Sort  (cost=564000.51..571533.73 rows=3013290 width=8) (actual time=2400.876..2400.882 rows=30 loops=1)\" \"                    Sort Key: s2.sd\" \"                    Sort Method: external merge  Disk: 41120kB\" \"                    -&gt;  Seq Scan on shipmentdetail s2  (cost=0.00..198528.19 rows=3013290 width=8) (actual time=0.033..1833.562 rows=2999089 loops=1)\" \"                          Filter: (quantity &gt; '7'::numeric)\" \"                          Rows Removed by Filter: 7000912\" \"Planning Time: 0.398 ms\" \"Execution Time: 5233.873 ms\" <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043b\u0435\u0447\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u0442\u0435\u043c \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e s1.sd \u0438 s2.sd IS NOT NULL:<\/p>\n<pre><code class=\"sql\">SELECT COUNT(*) FROM shipmentDetail s1, shipmentDetail s2 WHERE s1.sd=s2.sd AND s1.id &lt;&gt; s2.id AND s1.quantity &gt; 7 AND s2.quantity &gt; 7 AND s1.sd IS NOT NULL AND s2.sd IS NOT NULL <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d PostgreSQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> \"Aggregate  (cost=16.93..16.94 rows=1 width=8) (actual time=4.624..4.624 rows=1 loops=1)\" \"  -&gt;  Nested Loop  (cost=0.87..16.93 rows=1 width=0) (actual time=4.617..4.617 rows=0 loops=1)\" \"        Join Filter: ((s1.id &lt;&gt; s2.id) AND (s1.sd = s2.sd))\" \"        Rows Removed by Join Filter: 841\" \"        -&gt;  Index Scan using shipmentdetail_sd on shipmentdetail s1  (cost=0.43..8.46 rows=1 width=8) (actual time=0.055..0.201 rows=29 loops=1)\" \"              Index Cond: (sd IS NOT NULL)\" \"              Filter: (quantity &gt; '7'::numeric)\" \"              Rows Removed by Filter: 71\" \"        -&gt;  Index Scan using shipmentdetail_sd on shipmentdetail s2  (cost=0.43..8.46 rows=1 width=8) (actual time=0.013..0.142 rows=29 loops=29)\" \"              Index Cond: (sd IS NOT NULL)\" \"              Filter: (quantity &gt; '7'::numeric)\" \"              Rows Removed by Filter: 71\" \"Planning Time: 0.570 ms\" \"Execution Time: 4.705 ms\" <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  Oracle \u2014 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439, \u043a\u0442\u043e \u043d\u0435 \u0441\u043f\u043b\u043e\u0445\u043e\u0432\u0430\u043b \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b \u0441\u0430\u043c:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d Oracle<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 30\u043c\u0441  <\/p>\n<pre> ------------------------------------------------------------------------------------------------------------ | Id  | Operation                              | Name              | Rows  | Bytes | Cost (%CPU)| Time     | ------------------------------------------------------------------------------------------------------------ |   0 | SELECT STATEMENT                       |                   |       |       |   201 (100)|          | |   1 |  SORT AGGREGATE                        |                   |     1 |    16 |            |          | |   2 |   NESTED LOOPS                         |                   |    99 |  1584 |   201   (0)| 00:00:01 | |   3 |    NESTED LOOPS                        |                   |   100 |  1584 |   201   (0)| 00:00:01 | |   4 |     TABLE ACCESS BY INDEX ROWID BATCHED| SHIPMENTDETAIL    |   100 |   800 |   101   (0)| 00:00:01 | |*  5 |      INDEX FULL SCAN                   | SHIPMENTDETAIL_SD |   100 |       |     1   (0)| 00:00:01 | |*  6 |     INDEX RANGE SCAN                   | SHIPMENTDETAIL_SD |     1 |       |     0   (0)|          | |*  7 |    TABLE ACCESS BY INDEX ROWID         | SHIPMENTDETAIL    |     1 |     8 |     1   (0)| 00:00:01 | ------------------------------------------------------------------------------------------------------------ Predicate Information (identified by operation id): ---------------------------------------------------      5 - filter(\"S1\".\"SD\" IS NOT NULL)    6 - access(\"S1\".\"SD\"=\"S2\".\"SD\")        filter(\"S2\".\"SD\" IS NOT NULL)    7 - filter(\"S1\".\"ID\"&lt;&gt;\"S2\".\"ID\") <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"lastopt\"><\/a><\/p>\n<h3>\u041f\u043b\u043e\u0445\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438<\/h3>\n<p>  \u0421\u0430\u043c\u044b\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0432 OLTP \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u2014 \u044d\u0442\u043e \u0441\u0443\u043c\u043c\u0430 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 1\u0421 \u044d\u0442\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u0438 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e). \u0421 \u0441\u0443\u043c\u043c\u043e\u0439 \u0432\u0441\u0435 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0430 \u0432\u043e\u0442 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u0430\u043a \u0432 \u043f\u043b\u0430\u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0432 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0442\u0430\u043a\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0432\u043e\u043e\u0431\u0449\u0435, \u0442\u0430\u043a \u0438 \u0435\u0433\u043e \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043b\u044f \u0442\u043e\u0432\u0430\u0440\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0435\u0433\u043e \u043e\u0442\u0433\u0440\u0443\u0437\u043a\u0443. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043e\u0442\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430\u0434\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u043d\u043e\u043c\u0435\u0440\u0443 \u044d\u0442\u043e\u0439 \u043e\u0442\u0433\u0440\u0443\u0437\u043a\u0438 (\u0430 \u043d\u0435, \u0441\u043a\u0430\u0436\u0435\u043c, \u043f\u043e \u0434\u0430\u0442\u0435). \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442 \u043f\u043e\u0438\u0441\u043a \u043f\u043e stackoverflow \u2014 \u044d\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"sql\">SELECT MAX(shipment) AS ls FROM ShipmentDetail s WHERE s.product = 123 <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u043d\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e product, shipment, \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043b\u0430\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (\u0447\u0442\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0434\u0430\u0436\u0435 \u0432 PostgreSQL):<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d \u0432 MSSQL<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 70\u043c\u0441  <\/p>\n<pre> Rows\tExecutes  Stmt Text 1\t1\t  |--Stream Aggregate(DEFINE:([Expr1001]=MAX([test].[dbo].[shipmentdetail].[shipment] as [s].[shipment]))) 1\t1\t       |--Top(TOP EXPRESSION:((1))) 1\t1\t            |--Index Seek(OBJECT:([test].[dbo].[shipmentdetail].[shipmentdetail_p_s] AS [s]), SEEK:([s].[product]=(123)) ORDERED BACKWARD) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d \u0432 Oracle<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 30\u043c\u0441  <\/p>\n<pre> --------------------------------------------------------------------------------------------------- | Id  | Operation                    | Name               | Rows  | Bytes | Cost (%CPU)| Time     | --------------------------------------------------------------------------------------------------- |   0 | SELECT STATEMENT             |                    |       |       |     3 (100)|          | |   1 |  SORT AGGREGATE              |                    |     1 |    10 |            |          | |   2 |   FIRST ROW                  |                    |     1 |    10 |     3   (0)| 00:00:01 | |*  3 |    INDEX RANGE SCAN (MIN\/MAX)| SHIPMENTDETAIL_P_S |     1 |    10 |     3   (0)| 00:00:01 | --------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): ---------------------------------------------------      3 - access(\"S\".\"PRODUCT\"=123) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d \u0432 PostgreSQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre> \"Result  (cost=4.47..4.48 rows=1 width=4) (actual time=0.173..0.174 rows=1 loops=1)\" \"  InitPlan 1 (returns $0)\" \"    -&gt;  Limit  (cost=0.43..4.47 rows=1 width=4) (actual time=0.165..0.166 rows=1 loops=1)\" \"          -&gt;  Index Only Scan Backward using shipmentdetail_p_s on shipmentdetail s  (cost=0.43..808.43 rows=200 width=4) (actual time=0.163..0.163 rows=1 loops=1)\" \"                Index Cond: ((product = 123) AND (shipment IS NOT NULL))\" \"                Heap Fetches: 1\" \"Planning Time: 0.949 ms\" \"Execution Time: 0.241 ms\" <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0432 \u044d\u0442\u043e\u043c \u043f\u043b\u0430\u043d\u0435 \u0432\u0441\u0435 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043e\u0433\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u0440\u044f\u0434 (FIRST ROW \u2014 Oracle, LIMIT \u2014 MS SQL \u0438 PostgreSQL).<\/p>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0447\u0443\u0442\u044c \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0435 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u043e\u0432\u0430\u0440\u0430, \u0430 \u0434\u043b\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0442\u043e\u0432\u0430\u0440\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0441\u0435\u0445 \u0442\u043e\u0432\u0430\u0440\u043e\u0432, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043d\u0430 Product 86 (PostgreSQL \u0441\u0440\u0430\u0437\u0443 \u0432\u044b\u0431\u044b\u0432\u0430\u0435\u0442 \u0438\u0437 \u0433\u043e\u043d\u043a\u0438, \u0442\u0430\u043a \u043a\u0430\u043a JPPD \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435).<\/p>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 Oracle.<\/p>\n<pre><code class=\"sql\">SELECT SUM(cc.ls)          FROM Product pr         LEFT JOIN (SELECT MAX(shipment) AS ls, s.product             FROM shipmentDetail s             GROUP BY s.product) cc ON cc.product=pr.id         WHERE pr.name LIKE 'Product 86%'; <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d \u0432 Oracle<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 60\u043c\u0441  <\/p>\n<pre> -------------------------------------------------------------------------------------------- | Id  | Operation             | Name               | Rows  | Bytes | Cost (%CPU)| Time     | -------------------------------------------------------------------------------------------- |   0 | SELECT STATEMENT      |                    |       |       |   120 (100)|          | |   1 |  SORT AGGREGATE       |                    |     1 |    13 |            |          | |   2 |   VIEW                | VM_NWVW_1          |  4898 | 63674 |   120   (2)| 00:00:01 | |   3 |    HASH GROUP BY      |                    |  4898 |   157K|   120   (2)| 00:00:01 | |   4 |     NESTED LOOPS      |                    |  4898 |   157K|   118   (0)| 00:00:01 | |*  5 |      TABLE ACCESS FULL| PRODUCT            |    25 |   575 |    68   (0)| 00:00:01 | |*  6 |      INDEX RANGE SCAN | SHIPMENTDETAIL_P_S |   198 |  1980 |     2   (0)| 00:00:01 | -------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): ---------------------------------------------------      5 - filter(\"PR\".\"NAME\" LIKE 'Product 86%')    6 - access(\"S\".\"PRODUCT\"=\"PR\".\"ID\") <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0417\u0430\u043f\u0440\u043e\u0441 \u043f\u043e \u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e, \u043d\u043e \u043d\u0430\u0441\u0442\u043e\u0440\u0430\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043e\u0434\u0438\u043d \u0440\u044f\u0434 \u0438\u0441\u0447\u0435\u0437\u043b\u0430, \u0430 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0441\u0442\u0430\u043d\u0435\u0442 \u043c\u043d\u043e\u0433\u043e.<\/p>\n<p>  \u041d\u0443 \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u043e\u0432\u0430\u0440\u043e\u0432.<\/p>\n<pre><code class=\"sql\">SELECT MAX(cc.ls)          FROM Product pr         LEFT JOIN (SELECT MAX(shipment) AS ls, s.product             FROM shipmentDetail s             GROUP BY s.product) cc ON cc.product=pr.id <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d \u0432 Oracle<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 2.6\u0441  <\/p>\n<pre> ------------------------------------------------------------------------------------------------------- | Id  | Operation                | Name               | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | ------------------------------------------------------------------------------------------------------- |   0 | SELECT STATEMENT         |                    |       |       |       | 22222 (100)|          | |   1 |  SORT AGGREGATE          |                    |     1 |    31 |       |            |          | |   2 |   NESTED LOOPS SEMI      |                    | 50001 |  1513K|       | 22222   (2)| 00:00:01 | |   3 |    VIEW                  |                    | 50536 |  1283K|       | 22219   (2)| 00:00:01 | |   4 |     HASH GROUP BY        |                    | 50536 |   493K|   191M| 22219   (2)| 00:00:01 | |   5 |      INDEX FAST FULL SCAN| SHIPMENTDETAIL_P_S |    10M|    95M|       |  7871   (1)| 00:00:01 | |*  6 |    INDEX UNIQUE SCAN     | SYS_C007890        | 49472 |   241K|       |     0   (0)|          | ------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): ---------------------------------------------------      6 - access(\"CC\".\"PRODUCT\"=\"PR\".\"ID\") <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, Oracle, \u043d\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u0432\u0448\u0438\u0441\u044c \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043e\u0434\u0438\u043d \u0440\u044f\u0434, \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 Hash Group By \u0431\u0435\u0437 JPPD (\u0447\u0442\u043e, \u0432\u043f\u0440\u043e\u0447\u0435\u043c, \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u043e\u0434\u0438\u043d \u0440\u044f\u0434) \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0443\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434. \u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 subquery expressions \u0441 ORDER BY \u0438 rownum=1 (\u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e \u0441\u0443\u0442\u0438 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0432 Oracle, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0437\u0430\u043f\u0438\u0441\u044c), \u043f\u043b\u0430\u043d \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0443\u0447\u0448\u0435:<\/p>\n<pre><code class=\"sql\">SELECT MAX(l) FROM (SELECT (SELECT shipment FROM (SELECT shipment FROM ShipmentDetail s WHERE s.product = pr.id ORDER BY s.shipment DESC) s WHERE rownum = 1) AS l FROM product pr) <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d \u0432 Oracle<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 300\u043c\u0441  <\/p>\n<pre> ---------------------------------------------------------------------------------------------------- | Id  | Operation                     | Name               | Rows  | Bytes | Cost (%CPU)| Time     | ---------------------------------------------------------------------------------------------------- |   0 | SELECT STATEMENT              |                    |       |       |   139K(100)|          | |*  1 |  COUNT STOPKEY                |                    |       |       |            |          | |   2 |   VIEW                        |                    |     2 |    26 |     3   (0)| 00:00:01 | |*  3 |    INDEX RANGE SCAN DESCENDING| SHIPMENTDETAIL_P_S |   198 |  1980 |     3   (0)| 00:00:01 | |   4 |  SORT AGGREGATE               |                    |     1 |     5 |            |          | |   5 |   INDEX FAST FULL SCAN        | SYS_C007890        | 50001 |   244K|    27   (0)| 00:00:01 | ---------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): ---------------------------------------------------      1 - filter(ROWNUM=1)    3 - access(\"S\".\"PRODUCT\"=:B1) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0442\u0435\u043d \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434, \u0442\u043e \u0435\u0441\u0442\u044c \u0432 10 \u0440\u0430\u0437 \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u041f\u043e\u0447\u0435\u043c\u0443 Oracle \u043f\u043e \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0435\u0433\u043e \u0432 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0435 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u0437\u0430\u0434\u0430\u043d\u0430 \u044f\u0432\u043d\u043e \u0438 \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 JPPD \u2014 \u0437\u0430\u0433\u0430\u0434\u043a\u0430. \u041d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0432\u043e\u0442 \u043a\u043e\u0441\u0442\u044b\u043b\u0438 \u043a\u0430\u043a \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0432\u044b\u0448\u0435. \u041f\u0440\u0438\u0447\u0435\u043c, \u0435\u0441\u043b\u0438 \u0432 \u0431\u0430\u0437\u0435 \u043d\u0435\u0442 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0438\u043b\u0438 \u0431\u0430\u0437\u0430 \u00ab\u043f\u0443\u0441\u0442\u0430\u044f\u00bb (\u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u043e\u0442\u0433\u0440\u0443\u0437\u043e\u043a \u0435\u0449\u0435 \u043d\u0435\u0442, \u0430 \u0442\u043e\u0432\u0430\u0440\u044b \u0435\u0441\u0442\u044c \u0438 \u0438\u0445 \u043c\u043d\u043e\u0433\u043e), \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u043e\u0441\u0442\u044b\u043b\u044f\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0445\u0443\u0436\u0435, \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0431\u0430\u0437\u043e\u0432\u044b\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u0438 \u0442\u0435\u043c, \u043a\u0430\u043a \u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 Oracle. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u043c\u0443 \u0442\u0430\u043a\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0441\u0430\u043c\u043e\u0439 \u0421\u0423\u0411\u0414, \u0430 \u043d\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0437\u043d\u0430\u0442\u044c \u043d\u0438 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438, \u043d\u0438 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0435\u0441\u0442\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435.<\/p>\n<p>  \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f MS SQL, \u0442\u043e \u0435\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0443 MS SQL \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0430 \u0443 Oracle \u043d\u0435\u0442, \u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. MS SQL \u0434\u043e\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c Top 1 \u0432 \u043f\u043b\u0430\u043d:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d MS SQL<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 300\u043c\u0441  <\/p>\n<pre> Rows\tExecutes  Stmt Text 1\t1\t  |--Hash Match(Aggregate, HASH:() DEFINE:([Expr1005]=MAX([Expr1003]))) 50001\t1\t       |--Nested Loops(Left Outer Join, OUTER REFERENCES:([pr].[id])) 50001\t1\t            |--Index Scan(OBJECT:([test].[dbo].[product].[product_group] AS [pr])) 0\t0\t            |--Compute Scalar(DEFINE:([Expr1003]=[test].[dbo].[shipmentdetail].[shipment] as [s].[shipment])) 50000\t50001\t                 |--Top(TOP EXPRESSION:((1))) 50000\t50001\t                      |--Index Seek(OBJECT:([test].[dbo].[shipmentdetail].[shipmentdetail_p_s] AS [s]), SEEK:([s].[product]=[test].[dbo].[product].[id] as [pr].[id]) ORDERED BACKWARD) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u0434\u043e. \u041f\u0440\u0430\u0432\u0434\u0430, \u0435\u0441\u043b\u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c JOIN \u0441 LEFT \u043d\u0430 INNER, \u0442\u043e Top 1 \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0435\u0442 (\u0445\u043e\u0442\u044f \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0432 \u0447\u0435\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0430, \u0438 \u0437\u0430\u0447\u0435\u043c SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u043e\u0434\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c), \u0438 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0442\u0443 \u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0447\u0442\u043e \u0438 \u0432 Oracle:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043b\u0430\u043d MS SQL<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: 2.8\u0441  <\/p>\n<pre> Rows\tExecutes  Stmt Text 1\t1\t  |--Hash Match(Aggregate, HASH:() DEFINE:([Expr1003]=MAX([Expr1002]))) 50000\t1\t       |--Stream Aggregate(GROUP BY:([s].[product]) DEFINE:([Expr1002]=MAX([test].[dbo].[shipmentdetail].[shipment] as [s].[shipment]))) 10000001\t1\t            |--Index Scan(OBJECT:([test].[dbo].[shipmentdetail].[shipmentdetail_p_s] AS [s]), ORDERED FORWARD) <\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 MS SQL \u0432\u0441\u0435 INNER JOIN \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 MAX \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0432 LEFT JOIN. \u041d\u043e \u044d\u0442\u043e \u0432\u0441\u0435 \u0436\u0435 \u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u0438\u0437 \u0437\u043e\u043b \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 Oracle (\u0433\u0434\u0435, \u043a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438, \u0432\u0441\u0435 JOIN \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 MAX \u043d\u0430\u0434\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0432 subquery expression \u0441 rownum=1).<\/p>\n<p>  \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0443 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0441 MAX \/ MIN \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043e\u0447\u0435\u043d\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0430 \u0434\u0440\u0443\u0433\u043e\u0435 \u043f\u043e\u043b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c (\u0441\u043a\u0430\u0436\u0435\u043c \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043f\u043e \u0434\u0430\u0442\u0435)  <\/li>\n<li>\u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u0440\u0430\u0437\u0443 \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043f\u043e\u043b\u044f\u043c: \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044e, \u0430 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u043e\u043b\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442, \u0442\u043e \u043f\u043e \u0432\u0442\u043e\u0440\u043e\u043c\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e \u0434\u0430\u0442\u0435, \u0430 \u0443\u0436\u0435 \u043f\u043e\u0442\u043e\u043c \u043f\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443).   <\/li>\n<\/ul>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:<\/p>\n<ul>\n<li>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043a\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0430\u043c \u0442\u043e\u0442 \u0436\u0435 stackoverflow, \u0447\u0442\u043e \u0443\u0436\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b  <\/li>\n<li>\u0441\u043e\u0437\u0434\u0430\u0442\u044c custom aggregate \u0444\u0443\u043d\u043a\u0446\u0438\u044e LAST, \u0447\u0442\u043e \u0442\u043e\u0436\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u0442\u043e\u043c \u0436\u0435 MS SQL, \u0433\u0434\u0435 \u044d\u0442\u043e \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 C#, \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043f\u0435\u0440\u0435\u0434 \u0435\u0433\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 (\u043d\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0434\u0430\u0432\u043d\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0432 \u044d\u0442\u043e\u043c \u043f\u043b\u0430\u043d\u0435 \u0447\u0442\u043e-\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c)  <\/li>\n<\/ul>\n<p>  \u041d\u043e \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u0443 \u043e\u0431\u043e\u0438\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e. \u0422\u0430\u043a, \u0434\u043b\u044f \u043e\u043a\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 JPPD \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435. \u0410 \u0441 custom aggregate \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432\u044b\u0448\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f FIRST ROW \/ LIMIT 1. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0435\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u043d\u043e\u0439, \u043d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0435\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0435\u0434\u043e\u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c. \u042d\u0442\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0430\u0436\u043d\u043e\u0439 \u043f\u043e \u043c\u0435\u0440\u0435 \u0440\u043e\u0441\u0442\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043c\u0435\u0441\u044f\u0446\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432\u0441\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u043f\u044f\u0442\u044c-\u0434\u0435\u0441\u044f\u0442\u044c \u043b\u0435\u0442, \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0438\u0445-\u043d\u0438\u0431\u0443\u0434\u044c \u0447\u0430\u0441\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u0445\u043e\u0434\u043e\u0432 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u043b\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c) \u0421\u0423\u0411\u0414 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0430\u0440\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c, \u0447\u0442\u043e, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440, \u043d\u043e \u0438 \u043d\u0430 \u0421\u0425\u0414, \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0440\u043e\u0442\u0430\u0446\u0438\u0438 \u043a\u044d\u0448\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0430 \u044d\u0442\u043e, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043c\u043e\u0436\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043e\u0431\u0449\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p>  <a name=\"nplusone\"><\/a><\/p>\n<h3>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 N+1<\/h3>\n<p>  \u0415\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0435 \u043c\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 SQL (\u0430 \u0442\u043e\u0447\u043d\u0435\u0435 \u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u0445 PL\/SQL, T-SQL \u0438 \u0442.\u043f.), \u0442\u043e \u043e\u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u043e\u0434\u043d\u0438\u0445 \u0438 \u0442\u0435\u0445 \u0436\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043d\u043e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438. \u0410 \u044d\u0442\u043e, \u0441\u043a\u0430\u0436\u0435\u043c \u0442\u0430\u043a, \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0432\u0435\u0440\u043d\u043e. \u041f\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0441\u0447\u0435\u0442\u0443 \u0432 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u0445 SQL \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 N+1 \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u0442\u0435\u0445 \u0436\u0435 ORM-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430:<\/p>\n<pre><code class=\"sql\">   --\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443    CREATE PROCEDURE TestProcedure     (         --\u0412\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b         @CategoryId INT,         @ProductName VARCHAR(100),         @Price MONEY = 0    )    AS    BEGIN         --\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u0412\u0430\u0448 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c                  --\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432         --\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438         SET @ProductName = LTRIM(RTRIM(@ProductName));                  --\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c         INSERT INTO TestTable(CategoryId, ProductName, Price)                 VALUES (@CategoryId, @ProductName, @Price)          --\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435         SELECT * FROM TestTable         WHERE CategoryId = @CategoryId    END     GO <\/code><\/pre>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0434\u043b\u044f 1000 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. \u0418 \u0442\u0443\u0442 \u0443 \u043d\u0430\u0441 \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430: <\/p>\n<ul>\n<li>\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u043c\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c 1000 INSERT \u0438 1000 SELECT.  <\/li>\n<li>\u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443, \u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \/ \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e \u0434\u0440\u0430\u0433\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u043d\u0430\u0440\u0430\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0434\u043e\u043b\u0433, \u043d\u0430\u0440\u0443\u0448\u0438\u0432 DRY \u043f\u0440\u0438\u043d\u0446\u0438\u043f.  <\/li>\n<\/ul>\n<p>  \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0435 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \/ \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043d\u043e \u044d\u0442\u043e, \u043c\u044f\u0433\u043a\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u043b\u0438 \u0441 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430\u043c\u0438 \u0435\u0449\u0435 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e workaround, \u0442\u043e \u0441 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430\u043c\u0438 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0445\u0443\u0436\u0435. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0438\u0433\u0433\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0435\u0447\u0435\u0433\u043e. \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b N+1 \u0432 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0435\u0441\u0442\u044c \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b per statement (\u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0432\u0435\u0441 per row), \u043d\u043e:<\/p>\n<ul>\n<li>\u0412 Oracle \u0438 PostgreSQL \u0432 \u043d\u0438\u0445 \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043d\u043e\u0432\u044b\u043c \u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c, \u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0447\u0443\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 \u0447\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e.  <\/li>\n<li>\u0412 MS SQL \u0432 per statement \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430\u0445 \u0435\u0441\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b inserted \u0438 deleted, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c. \u041d\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b N+1, \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439.   <\/li>\n<\/ul>\n<p>  \u0425\u043e\u0442\u044f, \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0440\u0430\u0434\u0438, \u0435\u0441\u043b\u0438 \u0432 MS SQL \u0432\u0441\u0435 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c inserted \u0438 deleted, \u0438 \u0432\u0435\u0437\u0434\u0435 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0443, \u0447\u0442\u043e \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 (\u043f\u0440\u0430\u0432\u0434\u0430, \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b N+1 \u0441 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430\u043c\u0438), \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b N+1 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0432\u0441\u0435\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u0430\u0432\u0438\u043b \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0418 \u0432 \u044d\u0442\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 MS SQL \u0434\u0430\u0435\u0442 \u0444\u043e\u0440\u0443 Oracle (\u0447\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u043f\u043e\u043d\u044f\u043b, \u0432 \u0447\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0443 Oracle \u0431\u044b\u043b\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b).<\/p>\n<p>  <a name=\"physmodel\"><\/a><\/p>\n<h3>\u0412\u044b\u0441\u043e\u043a\u0430\u044f \u0446\u0435\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0411\u0414<\/h3>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0411\u0414, \u043f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0432\u044b, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0443\u0441\u043b\u044b\u0448\u0438\u0442\u0435 \u0432 \u043e\u0442\u0432\u0435\u0442 \u0431\u0443\u0434\u0435\u0442: \u00ab\u0434\u0430 \u0443 \u0432\u0430\u0441 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0411\u0414\u00bb. \u041f\u0440\u0438\u0447\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u0430 \u00ab\u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c\u00bb \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u0430, \u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u00ab\u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c\u00bb \u043a\u0430\u043a \u043d\u0430 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0442\u043e \u0442\u0443\u0442 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430 \u00ab\u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f\u00bb. \u041e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0443\u0433\u0430\u0434\u0430\u0442\u044c \u043d\u0435 \u0442\u043e \u0447\u0442\u043e, \u043a\u0430\u043a\u0430\u044f \u0442\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430, \u0430 \u043a\u0430\u043a\u043e\u0439 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0431\u0443\u0434\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u044d\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0447\u0435\u0440\u0435\u0437 \u043f\u044f\u0442\u044c-\u0434\u0435\u0441\u044f\u0442\u044c \u043b\u0435\u0442. \u041f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043b\u044e\u0431\u043e\u0433\u043e \u0431\u0438\u0437\u043d\u0435\u0441\u0430 (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043d\u0430 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u044b\u0445 \u0440\u044b\u043d\u043a\u0430\u0445), \u0430 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0441\u0430\u043c\u0438\u043c \u0431\u0438\u0437\u043d\u0435\u0441\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438 \u0435\u0433\u043e \u0418\u0422-\u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u043a\u0430\u043a \u0437\u0435\u0440\u043a\u0430\u043b\u043e \u044d\u0442\u043e\u0433\u043e \u0431\u0438\u0437\u043d\u0435\u0441\u0430). \u0418 \u0442\u043e, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0442\u043e\u043c. \u0422\u0430\u043a \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0432\u0430\u0441 \u0443\u043f\u0440\u0435\u043a\u043d\u0435\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u044b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0411\u0414, \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043c\u0435\u043b\u043e \u043a\u0438\u0434\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u043a\u0430\u043c\u0435\u043d\u044c. \u0423\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u0435\u0433\u043e \u0411\u0414 \u043d\u0443\u0436\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u0430 \u044d\u0442\u043e \u043d\u0435\u0438\u0437\u0431\u0435\u0436\u043d\u043e) \u0435\u0433\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439. <\/p>\n<p>  \u0421 \u00ab\u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e\u00bb \u043a\u0430\u043a \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432\u0441\u0435 \u0435\u0449\u0435 \u0441\u043b\u043e\u0436\u043d\u0435\u0435. \u041a\u0430\u043a \u043c\u044b \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435, \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \/ \u0434\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0411\u0414 \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 SQL-\u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u2014 \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0443\u0436 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u041e\u0442 \u0441\u043b\u043e\u0432\u0430 \u0441\u043e\u0432\u0441\u0435\u043c. \u041d\u043e \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0439 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u043e\u0434\u043d\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u043b\u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u044f \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c, \u0432\u044b, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0441\u0442\u043e\u043b\u043a\u043d\u0435\u0442\u0435\u0441\u044c \u0441 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0438\u043c\u0438 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438 \u0432\u0430\u043c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u0438, \u0442\u0430\u043a \u0438 \u0447\u0442\u0435\u043d\u0438\u044f. \u0422\u0443\u0442, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u0430\u043c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u0440\u0438\u0434\u0443\u0442 \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043d\u043e, \u043a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u0445, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (\u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u044b), \u043f\u043b\u044e\u0441 \u0438\u043c\u0435\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 FULL JOIN \u0438 \u0442.\u043f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043d\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. <\/p>\n<p>  \u0422\u0430\u043a \u0447\u0442\u043e, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0440\u0430\u0431\u043e\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0411\u0414 \u0438 \u043e\u043f\u0430\u0441\u043d\u0430 \u0438 \u0442\u0440\u0443\u0434\u043d\u0430, \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u0435, \u043d\u043e \u0438 \u0440\u0430\u0437\u0432\u0438\u0442\u044b\u0435 \u044d\u043a\u0441\u0442\u0440\u0430\u0441\u0435\u043d\u0441\u043e\u0440\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u043b\u044e\u0431\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0411\u0414 \u043c\u043e\u0436\u0435\u0442 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u0440\u043e\u0433\u043e \u0441\u0442\u043e\u0438\u0442\u044c.<\/p>\n<p>  <a name=\"manyjoins\"><\/a><\/p>\n<h3>\u041d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c JOIN<\/h3>\n<p>  \u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u043d\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (\u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432 JOIN) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 Cost-Based Optimizer (CBO). \u0427\u0430\u0441\u0442\u043e \u0435\u0433\u043e \u043f\u0440\u0435\u043f\u043e\u0434\u043d\u043e\u0441\u044f\u0442 \u043a\u0430\u043a \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0438 \u0443\u043c\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u0438 \u043e\u043d \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043e\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u043f\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u0434\u043e \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u043d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438 \u0438\u0433\u0440\u0430\u0435\u0442 \u0441 \u043d\u0438\u043c \u0437\u043b\u0443\u044e \u0448\u0443\u0442\u043a\u0443 \u2014 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u0442\u043e \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0431\u043e\u0440. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u043a\u0430\u043a \u0438 \u0432 \u043b\u044e\u0431\u043e\u043c \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0435, \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b CBO \u0440\u0430\u0441\u0442\u0435\u0442 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 join&#8217;\u043e\u0432. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a, \u0430 \u043d\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443 \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u043a\u043e\u0441\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u2014 O(n!). \u0422\u043e \u0435\u0441\u0442\u044c \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u0434\u0432\u0435\u043d\u0430\u0434\u0446\u0430\u0442\u0438 join&#8217;\u043e\u0432 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0445 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u043e\u043a\u043e\u043b\u043e 48 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043b\u0430\u043d\u043e\u0432 \u0435\u0441\u0442\u044c \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f, \u043d\u043e \u0441 \u0442\u0430\u043a\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0434\u0430\u0436\u0435 \u043e\u043d\u0438 \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 join&#8217;\u043e\u0432 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044f\u0442 \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u044d\u0432\u0440\u0438\u0441\u0442\u0438\u043a\u0438. \u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0422\u0430\u043a, \u0432 PostgreSQL GEQO \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0443\u043c\u0443\u0434\u0440\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0441\u0447\u0443\u0440 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0434\u043d\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 8 join&#8217;\u043e\u0432 \u043e\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443 \u043d\u0435\u0435 \u043e\u0431\u0449\u0435\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u043f\u043b\u0430\u043d\u0435 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435.<\/p>\n<p>  \u0412\u043e\u043e\u0431\u0449\u0435, \u043e\u043f\u044b\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c join \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434: \u0436\u0430\u0434\u043d\u044f\u043a\u043e\u043c \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c lookahead&#8217;\u043e\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a join, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0432 cost-based \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 join (\u0430 \u043d\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 join, \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435). \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, MS SQL \u0438 Oracle \u0442\u0430\u043a \u0438 \u0434\u0435\u043b\u0430\u044e\u0442, \u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c \u0438\u043c\u0438 \u044d\u0432\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u0442\u044f\u0436\u0435\u043b\u043e (\u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 PostgreSQL). \u0412\u0435\u0437\u0434\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0432 \u0441\u0442\u0438\u043b\u0435:  <\/p>\n<blockquote><p>This heuristic uses sophisticated methods for instantaneously finding particular<br \/>  plans in the search space which are likely to be nearly optimal or, at least, very<br \/>  good execution plans.<\/p><\/blockquote>\n<p>\u0412\u0436\u0438\u0432\u0443\u044e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0432 MS SQL \u0438 Oracle \u043f\u043e\u043a\u0430 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c (\u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443), \u043d\u043e \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c, \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u043e \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0442\u043e\u0433\u0434\u0430 \u044f \u0434\u043e\u043f\u043e\u043b\u043d\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u044d\u0442\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>  <a name=\"inherit\"><\/a><\/p>\n<h3>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430<\/h3>\n<p>  \u041d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c (\u0437\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e subtype \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0435) \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0437\u0430\u0434\u043e\u043b\u0433\u043e \u0434\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f SQL \u0438, \u0437\u0430 \u0441\u0447\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0434\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u043d\u0430\u0440\u0430\u0449\u0438\u0432\u0430\u0442\u044c \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0434\u043e\u043b\u0433 \u043f\u043e \u043c\u0435\u0440\u0435 \u0440\u043e\u0441\u0442\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0440\u0435\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0432 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435, \u0447\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0432\u0448\u0438\u0435 \u0440\u0430\u043d\u0435\u0435 (\u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u0440\u0435\u0432\u043e\u043b\u044e\u0446\u0438\u044e \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u043a\u0441\u0442\u0430\u0442\u0438, \u0432 \u0441\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0434\u0430\u0432 \u043c\u0438\u0440\u0443, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435).<\/p>\n<p>  \u0418 \u0435\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043f\u043e\u043b\u044c\u0437\u0430 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 \u043d\u0435 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430, \u0442\u043e \u043f\u043e \u043c\u0435\u0440\u0435 \u0440\u043e\u0441\u0442\u0430 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c\u0438 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0431\u0430\u0440\u044c\u0435\u0440\u043e\u0432 \u043e\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0432 \u043e\u0434\u0438\u043d \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u00ab\u0441\u043f\u0430\u0433\u0435\u0442\u0442\u0438-\u043a\u043e\u0434\u00bb.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u043f\u043b\u0430\u043d\u0435 \u0443\u043c\u0435\u044e\u0442 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>  \u0423 MS SQL \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u043e\u043d\u0438 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u043d\u0438 \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c. <\/p>\n<p>  \u0412 PostgreSQL \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446 \u0435\u0441\u0442\u044c, \u043d\u043e \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e. \u0410 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0441\u043c\u044b\u0441\u043b\u0430 \u0432 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0435\u0437 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430 \u043d\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e, \u0437\u0430\u0447\u0435\u043c \u0432 PostgreSQL \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0438 \u2014 \u043d\u0435\u044f\u0441\u043d\u043e. <\/p>\n<p>  \u0412\u043e\u043e\u0431\u0449\u0435, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044e \u0441\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u0432 SQL, \u043f\u043e \u0438\u0434\u0435\u0435, \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u0430\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 UNION&#8217;\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435:<\/p>\n<pre><code class=\"sql\">CREATE ABSTRACT VIEW detail (document LONG, quantity NUMBER);  EXTEND VIEW Detail \tSELECT receipt AS document, quantity FROM receiptDetail; \u2026 EXTEND VIEW X \tSELECT shipment AS document, quantity FROM shipmentDetail; <\/code><\/pre>\n<p>  \u041d\u043e \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0438 \u0432 PostgreSQL, \u043d\u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u043d\u0435\u0442.<\/p>\n<p>  \u0412 Oracle \u0440\u0435\u0448\u0438\u043b\u0438 \u0441\u043a\u0440\u0435\u0441\u0442\u0438\u0442\u044c \u00ab\u0435\u0436\u0430 \u0441 \u0443\u0436\u043e\u043c\u00bb: <\/p>\n<ul>\n<li>\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u044f\u0437\u044b\u043a \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u041e\u041e\u041f \u0441 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438, \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0438 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u0435\u0439  <\/li>\n<li>\u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043a\u0430\u043a \u0441\u043f\u0438\u0441\u043a\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430.  <\/li>\n<\/ul>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0432 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 (MEMBER FUNCTION \/ PROCEDURE) \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 N+1. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043a\u043b\u044e\u0447\u0430\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0422\u043e\u0432\u0430\u0440 \u0438 \u0421\u043a\u043b\u0430\u0434). \u041c\u043e\u0436\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0443\u0440\u0440\u043e\u0433\u0430\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0432\u0440\u043e\u0434\u0435 \u0422\u043e\u0432\u0430\u0440\u0421\u043a\u043b\u0430\u0434, \u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0438\u0445 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u043c. \u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0422\u043e\u0432\u0430\u0440\u041c\u0430\u0433\u0430\u0437\u0438\u043d \u0438 \u0422\u043e\u0432\u0430\u0440\u0420\u0426? \u0422\u043e\u0433\u0434\u0430 \u0441 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u0432 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 generics \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u0440\u0430\u0437\u0431\u0435\u0440\u0438\u0445\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0438 \u041c\u0430\u0433\u0430\u0437\u0438\u043d \u0438 \u0422\u043e\u0432\u0430\u0440\u0421\u043a\u043b\u0430\u0434, \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0422\u043e\u0432\u0430\u0440\u041c\u0430\u0433\u0430\u0437\u0438\u043d, \u0430 \u043a\u0430\u043a \u043e\u0431 \u044d\u0442\u043e\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u0437\u043d\u0430\u0442\u044c SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u2014 \u043d\u0435\u044f\u0441\u043d\u043e. \u0412 \u043e\u0431\u0449\u0435\u043c, \u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u043c\u0441\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 \u0438 \u0438\u0445 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432 Oracle \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435, \u043a\u0430\u043a \u0438 \u0441 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u2014 \u043c\u043d\u043e\u0433\u043e \u043a\u0442\u043e \u0441\u043b\u044b\u0448\u0430\u043b, \u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u0438\u0435 \u0438 \u0442\u043e \u0432 \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445.<\/p>\n<p>  <a name=\"abst\"><\/a><\/p>\n<h3>\u0418\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e \u043d\u0438\u0437\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p>  \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, SQL \u2014 \u044f\u0437\u044b\u043a \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0430\u043b\u0433\u0435\u0431\u0440\u044b, \u0442\u043e \u0435\u0441\u0442\u044c \u044f\u0437\u044b\u043a \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u0411\u0414, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435 (\u0438\u043c\u0435\u044e\u0442 \u043a\u043b\u044e\u0447\u0438), \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043b\u044e\u0431\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043a\u043b\u044e\u0447\u0435\u0439 (\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438) \u043d\u0430 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0430\u043b\u0433\u0435\u0431\u0440\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043d\u0435\u043d\u0443\u0436\u043d\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u0434\u0435\u043a\u0430\u0440\u0442\u043e\u0432\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0446, \u0447\u0442\u043e, \u0441\u043a\u0430\u0436\u0435\u043c \u0442\u0430\u043a, \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 (\u0432\u043e \u0432\u0441\u044f\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432 \u0436\u0438\u0437\u043d\u0438 \u043b\u044e\u0434\u0438 \u0441 \u0442\u0430\u043a\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f). \u0418 \u044f \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u043b\u044e\u0434\u044f\u043c, \u043d\u0435 \u0438\u043c\u0435\u0432\u0448\u0438\u043c \u043e\u043f\u044b\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SQL, \u044d\u0442\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u0431\u0435\u0437\u0443\u0441\u043f\u0435\u0448\u043d\u043e. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0432\u0441\u0435 \u0441\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043a \u00ab\u043e\u0431\u0435\u0437\u044c\u044f\u043d\u043d\u043e\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443\u00bb \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f: \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u0434\u0440\u0443\u0433\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u2014 \u0434\u0440\u0443\u0433\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0440\u0430\u0434\u0438, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043c\u0435\u043d\u044f \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c LEFT JOIN \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0435 \u0432\u0441\u0435 \u043a\u043b\u044e\u0447\u0438, \u043c\u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e \u043f\u043e\u043b\u043e\u043c\u0430\u0442\u044c \u043c\u043e\u0437\u0433. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u044f \u0441\u043c\u043e\u0433\u0443, \u043d\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u0443\u043b\u044c\u0442\u043e\u0432\u043e\u043c \u0441\u0435\u0440\u0438\u0430\u043b\u0435: \u00abShe understands, she doesn&#8217;t comprehend\u00bb. \u0410 \u0443 \u043c\u0435\u043d\u044f \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SQL, \u0441\u043a\u0430\u0436\u0435\u043c \u0442\u0430\u043a, \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439, \u043c\u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u0438 \u043a \u0431\u0430\u0433\u0430\u043c \u0432 PostgreSQL, \u043f\u0440\u0438\u0447\u0435\u043c \u0442\u0430\u043a\u0438\u043c, \u0447\u0442\u043e \u043c\u0435\u043d\u044f \u0434\u0430\u0436\u0435 \u043b\u0438\u0447\u043d\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0438 \u0432 Release Notes (\u043f\u043e\u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437 join&#8217;\u043e\u0432 \u0438 =, \u0442\u043e \u0435\u0441\u0442\u044c \u0431\u0430\u0433 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u0435\u0435 \u043d\u0435\u043a\u0443\u0434\u0430)<\/p>\n<p>  \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043e\u0439, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0439 \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 SQL \u043d\u0435 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0430\u043b\u0433\u0435\u0431\u0440\u044b \u2014 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u043c\u0438, \u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u2014 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f\u043c\u0438. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u044d\u0442\u0430 \u0442\u0435\u043c\u0430 \u0443\u0436\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0430\u0441\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 <a href=\"https:\/\/habr.com\/ru\/company\/lsfusion\/blog\/458774\/\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0434\u0435\u0441\u044c \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043b\u0438\u0448\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 2* (\u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432)<\/p>\n<p>  <b>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0430\u043b\u0433\u0435\u0431\u0440\u0430<\/b><\/p>\n<pre><code class=\"sql\">SELECT Person a, Person b, Person c WHERE      likes(a, c) AND NOT friends(a, c) AND      (friends(a, b) OR friends(b, a)) AND      (friends(b, c) OR friends(c, b)); <\/code><\/pre>\n<p>  <b>\u0420\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0430\u043b\u0433\u0435\u0431\u0440\u0430<\/b><\/p>\n<pre><code class=\"sql\">WITH PersonRelationShipCollapsed AS (   SELECT pl.PersonAID         ,pl.PersonBID         ,pl.Relation    FROM #PersonRelationShip      AS pl       UNION     SELECT pl.PersonBID AS PersonAID         ,pl.PersonAID AS PersonBID         ,pl.Relation   FROM #PersonRelationShip      AS pl  ) SELECT     pl.PersonAID   ,pf.PersonBID   ,pff.PersonBID FROM #Persons                      AS p --\u041b\u0430\u0439\u043a\u0438                       JOIN PersonRelationShipCollapsed  AS pl ON pl.PersonAID = p.PersonID                                  AND pl.Relation  = 'Like'                                   --\u0414\u0440\u0443\u0437\u044c\u044f                           JOIN PersonRelationShipCollapsed  AS pf ON pf.PersonAID = p.PersonID                                   AND pf.Relation = 'Friend' --\u0414\u0440\u0443\u0437\u044c\u044f \u0414\u0440\u0443\u0437\u0435\u0439                    JOIN PersonRelationShipCollapsed  AS pff ON pff.PersonAID = pf.PersonBID                                  AND pff.PersonBID = pl.PersonBID                                  AND pff.Relation = 'Friend' --\u0415\u0449\u0451 \u043d\u0435 \u0434\u0440\u0443\u0436\u0430\u0442                    LEFT JOIN PersonRelationShipCollapsed AS pnf ON pnf.PersonAID = p.PersonID                                    AND pnf.PersonBID = pff.PersonBID                                    AND pnf.Relation = 'Friend' WHERE pnf.[PersonAID] IS NULL  <\/code><\/pre>\n<p>  \u0410 \u0443\u0436\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0441\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0448\u0438\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>  <a name=\"ao\"><\/a><\/p>\n<h3>\u0410\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f(AO)<\/h3>\n<p>  \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u043b\u0430\u043d\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \/ \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 \u0432 \u043e\u0431\u0435\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u043c\u0430\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0438\u043b\u0438 \u0438\u0445 \u043c\u0430\u043b\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043c\u043e\u0436\u043d\u043e (\u0438 \u043d\u0443\u0436\u043d\u043e) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0446\u0438\u043a\u043b (nested loop join), \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c hash \u0438\u043b\u0438 merge join. \u041d\u043e \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u0430\u043b\u043e, \u0430 \u0438\u0445 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043c\u043d\u043e\u0433\u043e? \u0412 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e, \u043d\u0438\u0447\u0435\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e. \u041f\u0440\u0438\u0447\u0435\u043c \u0441\u0430\u043c\u044b\u0435 \u0440\u0430\u0437\u0440\u0443\u0448\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0434\u0443\u043c\u0430\u043b \u0447\u0442\u043e \u0432 \u043e\u0431\u0435\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u043c\u0430\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0447\u0442\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u043f\u043e 10\u043a \u0437\u0430\u043f\u0438\u0441\u0435\u0439. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u0435\u0436\u0430\u0442\u044c\u0441\u044f \u043f\u043e 100\u043c\u043b\u043d \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443), \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043a\u0430\u043a \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c), \u0442\u0430\u043a \u0438 \u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u044c (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0443\u044e, \u0442\u043e \u0435\u0441\u0442\u044c \u0421\u0425\u0414). \u0410 \u043e\u0448\u0438\u0431\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u043e\u0439 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u0441\u0430\u043c\u044b\u043c\u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0435\u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0438 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0441 \u044d\u0442\u0438\u043c\u0438 \u044f\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0431\u043e\u0440\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u043e\u0433\u0443\u0442 (\u0442\u0430\u043a, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043e\u043d\u0438 \u0445\u0440\u0430\u043d\u044f\u0442 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, cross-column \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443, \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438\u0435 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u0442.\u043f.), \u043d\u043e \u0434\u0430\u0436\u0435 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u044d\u0442\u0438\u043c\u0438 \u0442\u0435\u0445\u043d\u0438\u043a\u0430\u043c\u0438 \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u0430.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u043e\u043b\u0435\u0435 \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u044b\u043c \u043a \u0442\u0430\u043a\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0430\u043c, SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0442\u0435\u0445\u043d\u0438\u043a\u0443: \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u043c\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u0440\u043e\u0433\u0430, \u0438, \u043f\u043e \u0438\u0434\u0435\u0435, \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f nested loop join, \u043e\u043d\u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0432 \u043f\u043b\u0430\u043d \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443 (\u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 adaptive join), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u0442 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u0443\u0435\u043c\u043e\u0435. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a\u0430\u044f \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0439 \u0432\u044b\u0448\u0435 \u0441\u0430\u043c\u044b\u0439 \u00ab\u0440\u0430\u0437\u0440\u0443\u0448\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439\u00bb \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u2014 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 nested loop join. \u041d\u043e, \u043a\u0430\u043a \u0438 \u0443 JPPD, \u0443 AO \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432.<\/p>\n<p>  <a name=\"commao\"><\/a><\/p>\n<h3>AO: \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0445 \u0421\u0423\u0411\u0414<\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 PostgreSQL. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u0430\u0436\u0435 \u0432 MSSQL \u0435\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u0441\u0435\u0433\u043e 2 \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 PostgreSQL \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f. \u0423\u0441\u0443\u0433\u0443\u0431\u043b\u044f\u0435\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0435\u0449\u0435 \u0442\u043e, \u0447\u0442\u043e PostgreSQL \u0440\u0435\u0434\u043a\u043e\u0441\u0442\u043d\u044b\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0441\u0442. \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 PostgreSQL \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 selectivity, \u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0435\u0435 \u0440\u0430\u0432\u043d\u043e\u0439 0.3 (\u0442\u0430\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0432 \u043a\u043e\u0434\u0435 \u0442\u0430\u043a\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0436\u0435\u043d\u0430), \u043f\u043b\u044e\u0441, \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e \u0434\u0432\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0438\u0445 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0435\u0442 selectivity. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u043e\u043d \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0434\u0443\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c, \u0438 \u0435\u0441\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u0430\u043a \u0440\u0430\u0437 \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u043a\u043b\u0430\u0441\u0441 \u00ab\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439\u00bb), \u0441\u0442\u0440\u0435\u043b\u044f\u0435\u0442 \u0441\u0435\u0431\u0435 \u0432 \u043d\u043e\u0433\u0443 \u0441 \u0437\u0430\u0432\u0438\u0434\u043d\u043e\u0439 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c\u044e. <\/p>\n<p>  \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f JPPD \u0438 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0441\u0442\u044c\u044e GEQO, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0438 \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e PostgreSQL \u0434\u043e\u043b\u0436\u0435\u043d \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438. \u0422\u0430\u043a \u0447\u0442\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 AO, \u043a\u0430\u043a \u0438 \u0438\u0437\u043b\u0438\u0448\u043d\u0438\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u043c \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u044d\u0442\u0443 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0443.<\/p>\n<p>  <a name=\"incorrao\"><\/a><\/p>\n<h3>AO: \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u0430<\/h3>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u0445 join&#8217;\u043e\u0432 \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442 \u043a\u0440\u0430\u0439\u043d\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0438, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438:  <\/p>\n<blockquote><p>This means that a threshold depends on the estimates, so accurate estimates are still important. <\/p><\/blockquote>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u0435\u0441\u043b\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0448\u0438\u0431\u0435\u0442\u0441\u044f \u043d\u0435 \u0432 \u043d\u0438\u0436\u043d\u044e\u044e, \u0430 \u0432 \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443, \u0442\u043e \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u0439 join \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0441\u0442\u0441\u044f, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 SQL \u0441\u0435\u0440\u0432\u0435\u0440, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0443\u0436\u043d\u043e.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u0439 \u0441\u0445\u0435\u043c\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 join \u0441 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0432 \u043d\u0430\u0447\u0430\u043b\u043e, \u0438 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0432\u043e\u0441\u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044e \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u00ab\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e\u00bb join. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u043a\u043e\u0433\u0434\u0430 SQL \u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u0431\u0443\u0434\u0435\u0442 \u0443\u0436\u0435 \u043f\u043e\u0437\u0434\u043d\u043e:  <\/p>\n<blockquote><p>Adaptive plans do not allow the join order to be altered, so even if a better join method or parallel distribution method is used, the execution plan may still be sub-optimal.<\/p><\/blockquote>\n<p>\u0414\u043b\u044f \u0445\u043e\u0442\u044f \u0431\u044b \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432 Oracle \u043f\u043e\u043c\u0438\u043c\u043e adaptive join \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 (adaptive statistics). \u041e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e join, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u043f\u0440\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0436\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0432 \u0435\u0433\u043e. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0443 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u043f\u0440\u043e\u0431\u043b\u0435\u043c:<\/p>\n<ul>\n<li>\u041e\u043d \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0432\u0442\u043e\u0440\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0435\u0441\u043b\u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0431\u0443\u0434\u0435\u0442, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0442\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432\u0435\u0441\u044c \u044d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442)  <\/li>\n<li>\u0422\u0430\u043a \u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0430 \u0441 99% \u0438\u0437 \u043d\u0438\u0445 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435\u0442), \u0443 \u043d\u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0432\u0435\u0440\u0445\u0435\u0434. \u041f\u0440\u0438\u0447\u0435\u043c \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0447\u0442\u043e \u0441\u0430\u043c Oracle \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0435\u0433\u043e \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 OLTP \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445.<br \/> <br \/>\n<blockquote><p>The reasoning for this is many of these optimizations are more appropriate for data warehousing, where there optimization time is is a small proportion of the query runtime. In OLTP environments, where SQL runtime is typically smaller, the additional optimization time may become a significant part of the elapsed time, for little extra benefit.<\/p><\/blockquote>\n<\/li>\n<\/ul>\n<p>  \u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438 \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u0434\u0430\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0415\u0435 \u0441\u043c\u044b\u0441\u043b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0437\u0430\u043f\u0430\u0441\u043e\u043c), \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u043e, \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441, \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0435\u043c \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (\u0441\u043a\u043e\u0440\u0438\u043d\u0433\u043e\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435), \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0435\u0449\u0435 \u0440\u0430\u0437. \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u043f\u043e \u043d\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440\u0443 \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043b\u0430\u043d \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0431\u0430\u0437\u043e\u0432\u044b\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043d\u043e\u0432\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u0430\u043a\u0438\u0445 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e\u043c\u043e\u0433\u043b\u0430 \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0442.\u043f. \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\u0445.<\/p>\n<p>  \u0422\u0443\u0442, \u043f\u0440\u0430\u0432\u0434\u0430, \u043d\u0430\u0434\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439:<\/p>\n<ul>\n<li>\u041f\u0435\u0440\u0435\u0434 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c <a href=\"#jppdgen\">\u00abJPPD \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u00bb<\/a> (\u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043e \u0441\u0431\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0438\u0445 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435), \u0438\u043d\u0430\u0447\u0435 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0439 \u0431\u0430\u0437\u044b, \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u044b \u0432\u0435\u0440\u0445\u043d\u0435\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0433\u043e JPPD.  <\/li>\n<li>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u043e\u0442\u043c\u0435\u043d\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u0441\u0435\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0435\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0442\u0430\u043a\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0443\u0436\u043d\u0430, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 update conflict \u0438 dead lock, \u0442\u0430\u043a \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0435 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f (\u0435\u0441\u043b\u0438 \u0432\u0430\u043c, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043c\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u0441 \u0440\u0443\u0447\u043d\u044b\u043c\u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430\u043c\u0438, \u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435).  <\/li>\n<\/ul>\n<p>  \u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432\u044b\u0448\u0435 \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0442\u043e\u0447\u043d\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0415\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u043b\u044f \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f join, \u043d\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0438 \u043c\u0435\u043d\u0435\u0435 \u043d\u0430\u0434\u0435\u0436\u043d\u043e. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u0447\u0442\u043e \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043e\u0448\u0438\u0431\u0430\u044e\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0438, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430, \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u0430\u043a \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u043e. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u043c\u0438 join&#8217;\u0430\u043c\u0438 \u044d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0435\u0449\u0435 \u043b\u0443\u0447\u0448\u0435, \u0430 \u043b\u0443\u0447\u0448\u0435\u0435, \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0432\u0440\u0430\u0433 \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e. <\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0438\u0442\u043e\u0433, \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0435 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439, \u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u2014 \u0441\u0435\u0431\u0435 \u0434\u043e\u0440\u043e\u0436\u0435. \u0412\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0432 \u043d\u043e\u0433\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0443, \u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u0430\u043d\u0435\u043a\u0434\u043e\u0442 \u043f\u0440\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0432\u0438\u0440\u0443\u0441\u0430 \u043f\u043e\u0434 Linux \u2014 \u0442\u0430\u043c \u0433\u0434\u0435 \u044d\u0442\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0434\u0441\u0442\u0440\u0430\u0445\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>  PostgreSQL \u0436\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0434\u0430\u0436\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 (\u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 JPPD), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u00ab\u043a\u0430\u043a \u0435\u0441\u0442\u044c\u00bb \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438, \u043a\u0430\u043a \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u0441 MS SQL \u0438 Oracle, \u0437\u0430\u0442\u0435\u044f, \u0441\u043a\u0430\u0436\u0435\u043c \u043f\u0440\u044f\u043c\u043e, \u0432\u0435\u0441\u044c\u043c\u0430 \u0442\u0440\u0443\u0434\u043e\u0435\u043c\u043a\u0430\u044f \u0438 \u0440\u0438\u0441\u043a\u043e\u0432\u0430\u043d\u043d\u0430\u044f. \u0415\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u0437\u0430\u0431\u0430\u0432\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043a\u0442\u043e-\u0442\u043e \u0437\u0430\u044f\u0432\u043b\u044f\u0435\u0442 \u043e \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0421\u0423\u0411\u0414 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0442\u0443\u0434\u0430 PostgreSQL), \u043f\u043e\u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u0442\u0443\u0442 \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:<\/p>\n<ul>\n<li>\u0421\u0423\u0411\u0414 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u043a \u043f\u043e\u0434\u043b\u043e\u0436\u043a\u0430 \u043f\u043e\u0434 ORM, \u0438 \u0442\u043e\u0433\u0434\u0430 \u0434\u0430, \u0444\u0438\u043e\u043b\u0435\u0442\u043e\u0432\u043e, \u043a\u0430\u043a\u0430\u044f \u0421\u0423\u0411\u0414 \u0431\u0443\u0434\u0435\u0442, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442\u044c \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445.   <\/li>\n<li>\u043d\u0430 PostgreSQL \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u043e\u043a\u0430 \u0442\u0430\u043c \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0434\u043e 100\u043a \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0430 \u043a\u043e\u0433\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435, \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0443 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f: \u201c\u043d\u0443 \u0430 \u0447\u0442\u043e \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u043e\u0442 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0439 \u0421\u0423\u0411\u0414, \u043f\u043e\u043a\u0443\u043f\u0430\u0439\u0442\u0435 MS SQL \u0438\u043b\u0438 Oracle\u201d. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e, \u043a\u0441\u0442\u0430\u0442\u0438, \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u0431\u0430\u0432\u043d\u044b\u0445 \u0441\u0442\u0435\u0440\u0435\u043e\u0442\u0438\u043f\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043b\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u0441 Oracle \u043d\u0430 PostgreSQL \u0438 \u0443 \u043d\u0430\u0441 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0431\u044b\u043b\u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u0447\u0435\u043c \u0443 \u043d\u0438\u0445 \u0431\u044b\u043b\u043e \u0441 Oracle (\u043f\u0440\u0438 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0435). \u0418 \u044d\u0442\u043e\u0442 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a \u043d\u0430\u0441 \u0435\u0449\u0435 \u0434\u043e\u043b\u0433\u043e \u043c\u0443\u0447\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c: \u00ab\u041a\u0430\u043a \u044d\u0442\u043e? \u0412\u044b \u0436\u0435 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 PostgreSQL \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0443\u0436\u0435\u043d \u0441\u0435\u0440\u0432\u0435\u0440 \u0440\u0430\u0437 \u0432 \u043f\u044f\u0442\u044c \u043c\u043e\u0449\u043d\u0435\u0435\u00bb  <\/li>\n<\/ul>\n<p>  \u0418 \u044d\u0442\u043e \u0432\u0441\u0435, \u0435\u0441\u043b\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f DBA \u0432\u0441\u0435 \u0435\u0449\u0435 \u0445\u0443\u0436\u0435 \u2014 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c (\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \/ \u0434\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438) \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442. \u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 DBA \u2014 \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443, \u0430, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0434\u0440\u0443\u0433\u0438\u0435 KPI \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u00ab\u043e\u043d \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b, \u0430 \u044d\u0442\u043e \u0432\u0430\u0448 MS SQL\/Oracle \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u0442\u0435 \u0435\u0433\u043e \u043a\u0430\u043a-\u043d\u0438\u0431\u0443\u0434\u044c\u00bb \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0442\u0443\u043f\u0438\u043a\u043e\u0432\u043e\u0439. \u0418 \u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0441\u043a\u0430\u043d\u0434\u0430\u043b\u0443, \u0430 \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u2014 \u043a \u0441\u043c\u0435\u043d\u0435 \/ \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044e \u0432\u0441\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441, \u043a \u0447\u0435\u043c\u0443 \u0432\u043e\u043e\u0431\u0449\u0435 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f, \u043a\u0440\u0438\u0442\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u043b\u044e\u0431\u043e\u0439 \u0434\u0443\u0440\u0430\u043a. \u0418, \u0435\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u044f \u043d\u0435 \u043f\u0438\u0441\u0430\u043b \u0431\u044b \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e, \u0435\u0441\u043b\u0438 \u0431\u044b \u043d\u0435 \u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0432\u0441\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c. \u0414\u0430, \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e, \u044f \u0431\u044b \u0434\u0430\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u043b, \u043e\u0447\u0435\u043d\u044c \u0438 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u043e \u0432\u0435\u0434\u044c \u0437\u0430 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0421\u0423\u0411\u0414 \u0441\u0442\u043e\u044f\u0442 \u043e\u0434\u043d\u0438 \u0438\u0437 \u043a\u0440\u0443\u043f\u043d\u0435\u0439\u0448\u0438\u0445 \u0432 \u043c\u0438\u0440\u0435 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0446\u0438\u0439. \u0418 \u0443 \u043d\u0438\u0445 \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u00ab\u043b\u0443\u0447\u0448\u0438\u0435 \u0432 \u043c\u0438\u0440\u0435 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u044b\u00bb. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0435\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0437\u0430 \u043d\u0438\u0445, \u043d\u0435\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u043e\u0432\u0438\u0448\u044c \u0441\u0435\u0431\u044f \u043d\u0430 \u043c\u044b\u0441\u043b\u0438, \u0447\u0442\u043e \u00ab\u0447\u0442\u043e-\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0442\u0430\u043a\u00bb. \u041d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u044d\u0442\u043e \u043d\u0430 \u0438\u0445 \u0441\u043e\u0432\u0435\u0441\u0442\u0438.<\/p>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u043c\u0438\u043d\u0443\u0442\u043a\u0430 \u0440\u0435\u043a\u043b\u0430\u043c\u044b. \u0412\u0441\u0435 \u0432\u044b\u0448\u0435\u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0435\u0448\u0438\u0442\u044c \u0432 <a href=\"https:\/\/lsfusion.org\">lsFusion<\/a>, \u043f\u0440\u0438\u0447\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u041f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u0430\u044f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f (\u0434\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f) \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b \u043d\u0430 \u043b\u044e\u0431\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, JPPD \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0431\u0443\u043b\u0435\u0432\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0446\u0438\u043a\u043b\u043e\u0432 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u2014 \u0438 \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u0430\u0439\u0441\u0431\u0435\u0440\u0433\u0430. \u041f\u043e\u043c\u0438\u043c\u043e \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0447\u0438\u0441\u0442\u043e \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043d\u043e \u044d\u0442\u043e \u0432\u0441\u0435 \u043a SQL \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>  \u041d\u0430\u0441, \u043a\u0441\u0442\u0430\u0442\u0438, \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0443\u043f\u0440\u0435\u043a\u0430\u044e\u0442, \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b lsFusion \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441 DBMS, \u0438, \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0434\u0430\u043b\u0430 \u0445\u043e\u0442\u044f \u0431\u044b \u0447\u0430\u0441\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441. \u0414\u0430, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043c\u0438\u043b\u044e (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f JOIN \u2014 loop\/hash\/merge, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 ACID \u0438 \u0442.\u043f.) lsFusion \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e RDBMS, \u043d\u043e \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0441\u0447\u0435\u0442\u0443 \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 lsFusion, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0432\u0438\u0434\u0438\u0442 (\u0435\u0441\u043b\u0438 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442, \u043a\u043e\u043d\u0435\u0447\u043d\u043e). \u041f\u043b\u044e\u0441, \u0432\u0430\u0436\u043d\u044b\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 lsFusion, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 RDBMS \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u0443\u044e \u0438\u0437 \u043d\u0438\u0445 \u2014 PostgreSQL. \u0418 \u0432 \u044d\u0442\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 lsFusion \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0439 \u043a\u043e\u0441\u0442\u044e\u043c \u0436\u0435\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0434\u043b\u044f PostgreSQL, \u0434\u0430\u044e\u0449\u0438\u0439 \u0435\u043c\u0443 \u00ab\u0441\u0443\u043f\u0435\u0440\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438\u00bb MS SQL \u0438 Oracle, \u0432\u043e \u0432\u0441\u044f\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432 \u043f\u043b\u0430\u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0434\u0430\u043a\u0446\u0438\u044f\u0445 \u0441\u0442\u043e\u044f\u0442 \u043f\u043e 14 \u0442\u044b\u0441\u044f\u0447 \u0434\u043e\u043b\u043b\u0430\u0440\u043e\u0432 \u0437\u0430 \u044f\u0434\u0440\u043e, \u0442\u043e \u0441\u0432\u044f\u0437\u043a\u0430 lsFusion + PostgreSQL \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0430. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0443 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u043a\u0442\u0430 \u0435\u0441\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430, \u043c\u044b \u0442\u0430\u043a \u0438 \u043d\u0435 \u0443\u0431\u0435\u0434\u0438\u043b\u0438 \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0431\u0435 MS SQL \u0438\u043b\u0438 Oracle \u0432 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0443\u044e \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u043e\u0433\u0438\u0435 \u0432\u0435\u0449\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0445 \u0421\u0423\u0411\u0414 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0438\u0441\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u0442\u0435\u043d\u0434\u0430\u0445, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438. \u0422\u0430\u043a \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0433\u0434\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u0442\u0430\u043a\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043d\u0430\u0439\u0434\u0435\u0442, \u043f\u0440\u043e\u0441\u044c\u0431\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e \u043d\u0435\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0438 \u043c\u044b \u0435\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c.<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <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\/company\/lsfusion\/blog\/463095\/\"> https:\/\/habr.com\/ru\/company\/lsfusion\/blog\/463095\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/s1\/uz\/ze\/s1uzzeivaxmzx7jk-1osyp0xeyy.jpeg\"><\/p>\n<p>  \u0411\u0435\u0437 \u043f\u0440\u0435\u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e SQL \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u0432 \u043c\u0438\u0440\u0435 \u044f\u0437\u044b\u043a\u043e\u0432. \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 Java, Python, JavaScript, C#, PHP \u0438 \u0434\u0435\u0441\u044f\u0442\u043a\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u043e\u0432, \u043d\u043e SQL \u0431\u0430\u0437\u0430 \u0432 \u0442\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0442\u0430\u043a\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c. \u0421\u0440\u0435\u0434\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u0441\u0438\u0441\u0442\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 SQL, \u0432\u043e\u043e\u0431\u0449\u0435 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a 100%. <\/p>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u043e SQL \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445 \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043a \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c, \u0432\u0440\u043e\u0434\u0435: \u00ab\u043a\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0431\u044b\u0432\u0430\u044e\u0442\u00bb, \u00ab\u0447\u0435\u043c \u043b\u0435\u0432\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u0440\u0430\u0432\u043e\u0433\u043e\u00bb, \u00ab\u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b\u00bb \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432 \u044d\u0442\u0438\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445 SQL (\u0438 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445), \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u0447\u0435\u043d\u044c \u0438 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043c\u0430\u043b\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0431\u0430 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u0430: \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u043d\u043e\u0433\u0438\u0435 \u0432\u0435\u0449\u0438 \u0432 SQL \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438\u0437\u043d\u0443\u0442\u0440\u0438, \u0430 \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u2014 \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435 \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e \/ \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b.<\/p>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0435\u0447\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u0439\u0434\u0435\u0442 \u043d\u0435 \u043e \u00ab\u0432\u043a\u0443\u0441\u0430\u0445 \u0438 \u0446\u0432\u0435\u0442\u0430\u0445 \u0444\u043b\u043e\u043c\u0430\u0441\u0442\u0435\u0440\u043e\u0432\u00bb. \u0412\u0441\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u043e\u0441\u044f\u0442 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440: \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u00ab\u043a\u0440\u0430\u0441\u043e\u0442\u043e\u0439 \u043a\u043e\u0434\u0430\u00bb, \u0430 \u0432 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043b\u0438\u0431\u043e \u043a \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043f\u0430\u0434\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043b\u0438\u0431\u043e \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u043e\u0441\u0442\u0443 \u043f\u043e\u0440\u043e\u0433\u0430 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f, \u043b\u0438\u0431\u043e \u043a \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.  <\/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-293245","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/293245","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=293245"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/293245\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=293245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=293245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=293245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}