{"id":336259,"date":"2022-07-27T21:00:12","date_gmt":"2022-07-27T21:00:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=336259"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=336259","title":{"rendered":"<span>PostgreSQL 15: \u0427\u0430\u0441\u0442\u044c 5 \u0438\u043b\u0438 \u041a\u043e\u043c\u043c\u0438\u0442\u0444\u0435\u0441\u0442 2022-03<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u043c\u0430\u0440\u0442\u043e\u0432\u0441\u043a\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0444\u0435\u0441\u0442\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0441\u0435\u0440\u0438\u044e \u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u0432 PostgreSQL 15. <\/p>\n<p>  \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u044b \u043f\u0435\u0440\u0432\u044b\u043c \u0447\u0435\u0442\u044b\u0440\u0435\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0444\u0435\u0441\u0442\u0430\u043c: <a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/572782\/\">2021-07<\/a>,<a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/583070\/\"> 2021-09<\/a>,<a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/596567\/\"> 2021-11<\/a>, <a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/651143\/\">2022-01<\/a>.<\/p>\n<p>  \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0443\u0436\u0435 <a href=\"https:\/\/www.postgresql.org\/about\/news\/postgresql-15-beta-2-released-2479\/\">\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430<\/a> \u0432\u0442\u043e\u0440\u0430\u044f \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u044f PostgreSQL 15. \u0412\u0441\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u043d\u0438\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<h4>\u041a\u043e\u043c\u0430\u043d\u0434\u044b SQL<\/h4>\n<p>  <a href=\"#commit_7103ebb7\">MERGE<\/a><br \/>  <a href=\"#commit_a6baa4ba\">\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 SQL\/JSON<\/a><br \/>  <a href=\"#commit_43f33dc0\">COPY: \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/a><br \/>  <a href=\"#commit_cfdd03f4\">CLUSTER \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446<\/a><br \/>  <a href=\"#commit_ae1619b\">range_agg \u0434\u043b\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432<\/a><\/p>\n<h4>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433<\/h4>\n<p>  <a href=\"#commit_5891c7a8\">\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0432 \u043e\u0431\u0449\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c<\/a><br \/>  <a href=\"#commit_ae1619b\">range_agg \u0434\u043b\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432<\/a><br \/>  <a href=\"#commit_57d6aea0\">pg_stat_statements \u0438 JIT<\/a><\/p>\n<h4>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h4>\n<p>  <a href=\"#commit_0bd7af08\">recursive_worktable_factor: \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445<\/a><br \/>  <a href=\"#commit_db0d67db\">\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f GROUP BY<\/a><br \/>  <a href=\"#commit_40af10b5\">\u0411\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u043f\u0440\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0435 \u0441\u0442\u0440\u043e\u043a<\/a><br \/>  <a href=\"#commit_f1ea98a7\">\u0418\u043d\u0434\u0435\u043a\u0441\u044b GiST: \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438<\/a><br \/>  <a href=\"#commit_9d9c02cc\">\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0438\u0445\/\u0443\u0431\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043e\u043a\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <\/a><br \/>  <a href=\"#commit_44fa8488\">\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043c\u043e\u0440\u043e\u0437\u043a\u0438 \u0432\u0435\u0440\u0441\u0438\u0439 \u0441\u0442\u0440\u043e\u043a<\/a><br \/>  <a href=\"#commit_06f5295a\">\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u043c\u0438<\/a><br \/>  <a href=\"#commit_04e706d4\">postgres_fdw: \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445<\/a><\/p>\n<h4>\u0420\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0438 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>  <a href=\"#commit_3500ccc3\">pg_basebackup &#8212;target<\/a><br \/>  <a href=\"#commit_d4509942\">pg_basebackup &#8212;compress<\/a><br \/>  <a href=\"#commit_e9537321\">wal_compression = zstd<\/a><br \/>  <a href=\"#commit_5ef1eefd\">\u041c\u043e\u0434\u0443\u043b\u0438 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438 WAL<\/a><br \/>  <a href=\"#commit_344d62fb\">\u041d\u0435\u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/a><br \/>  <a href=\"#commit_5dc0418f\">\u041f\u0440\u0435\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0430 WAL \u043f\u0440\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438<\/a><br \/>  <a href=\"#commit_0d5c3875\">pg_rewind: \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 &#8212;config-file<\/a><br \/>  <a href=\"#commit_2258e76f\">\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 pg_walinspect \u2015 SQL-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c\u0443 WAL<\/a><br \/>  <a href=\"#commit_127aea2a\">pg_waldump: \u043d\u043e\u0432\u044b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b<\/a><br \/>  <a href=\"#commit_39969e2a\">\u041c\u043e\u043d\u043e\u043f\u043e\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u0430\u043b\u0435\u043d<\/a><\/p>\n<h4>\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f<\/h4>\n<p>  <a href=\"#commit_52e4f0cd\">\u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0432 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/a><br \/>  <a href=\"#commit_923def9a\">\u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/a><br \/>  <a href=\"#commit_705e20f8\">\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438<\/a><br \/>  <a href=\"#commit_208c5d65\">\u041f\u0440\u043e\u043f\u0443\u0441\u043a \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430<\/a><\/p>\n<h4>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c<\/h4>\n<p>  <a href=\"#commit_a0ffa885\">\u041f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c<\/a><br \/>  <a href=\"#commit_7faa5fc8\">\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e<\/a><br \/>  <a href=\"#commit_79de9842\">\u041e\u0431\u044b\u0447\u043d\u0430\u044f \u0440\u043e\u043b\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 ADMIN OPTION \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u0441\u0435\u0431\u044f<\/a><\/p>\n<h4>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>  <a href=\"#commit_f2553d43\">ICU \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/a><br \/>  <a href=\"#commit_37851a8b\">\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0439 \u043f\u0440\u0430\u0432\u0438\u043b \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0434\u043b\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445<\/a><br \/>  <a href=\"#commit_38bfae36\">pg_upgrade: \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432<\/a><br \/>  <a href=\"#commit_9a974cbc\">pg_upgrade: \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u043d \u0444\u0430\u0439\u043b\u043e\u0432 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432 \u0438 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439<\/a><br \/>  <a href=\"#commit_9c08aea6\">CREATE DATABASE \u0441 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432 WAL<\/a><br \/>  <a href=\"#commit_a2c84990\">\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 pg_ident_file_mappings<\/a><br \/>  <a href=\"#commit_76a29ade\">\u041f\u0440\u0435\u043a\u0440\u0430\u0449\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Python<\/a><\/p>\n<h4>\u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h4>\n<p>  <a href=\"#commit_7844c991\">psql: \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/a><\/p>\n<h3>\u041a\u043e\u043c\u0430\u043d\u0434\u044b SQL<\/h3>\n<p>  <a name=\"commit_7103ebb7\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3408\/\">MERGE<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/7103ebb7\">7103ebb7<\/a><\/p>\n<p>  \u0414\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 SQL, \u0441 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e\u0439 <a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/412605\/\">\u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439<\/a> \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043f\u043e\u043f\u0430\u043b\u0430 \u0432 15-\u044e \u0432\u0435\u0440\u0441\u0438\u044e!<\/p>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u041e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 (\u0435\u0451 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0446\u0435\u043b\u0435\u0432\u043e\u0439) \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c (\u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0438\u043b\u0438 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c) \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u043e\u043f\u0430\u0432\u0448\u0435\u0439 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u0441 \u043d\u0435\u0439 \u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0438 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c.<\/p>\n<pre><code class=\"pgsql\">CREATE TABLE source_table (id int primary key, descr text); CREATE TABLE target_table (LIKE source_table INCLUDING ALL);  INSERT INTO source_table VALUES     (0, '\u041d\u043e\u043b\u044c'),     (1, '\u041e\u0434\u0438\u043d'),     (2, '\u0414\u0432\u0430'); INSERT INTO target_table SELECT * FROM source_table;     SELECT * FROM target_table ORDER BY id; <\/code><\/pre>\n<pre><code class=\"plaintext\">id | descr  ----+-------   0 | \u041d\u043e\u043b\u044c   1 | \u041e\u0434\u0438\u043d   2 | \u0414\u0432\u0430 (3 rows) <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0441\u0442\u0440\u043e\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0442\u0430\u043a \u0438 \u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435, \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u0437\u043d\u0430\u043a MATCHED, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 MERGE.<\/p>\n<p>  \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0443 \u0432\u0441\u0435\u0445 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<pre><code class=\"pgsql\">UPDATE target_table SET descr = ''; <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u043e\u0431\u0435\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c. \u041f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0432\u0430 \u043a \u0446\u0435\u043b\u0435\u0432\u043e\u0439:<\/p>\n<pre><code class=\"pgsql\">SELECT s.*, t.* FROM source_table s      FULL OUTER JOIN target_table t ON (t.id=s.id); <\/code><\/pre>\n<pre><code class=\"plaintext\"> id | descr | id | descr ----+-------+----+-------   0 | \u041d\u043e\u043b\u044c  |  0 |   1 | \u041e\u0434\u0438\u043d  |  1 |   2 | \u0414\u0432\u0430   |  2 | (3 rows) <\/code><\/pre>\n<p>  \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 source_table.<\/p>\n<p>  \u0412 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 MERGE \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0430\u0448\u043b\u043e\u0441\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 (MATCHED) \u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 descr. \u0414\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a UPDATE \u0444\u0440\u0430\u0437\u044b FROM \u0438 WHERE \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u0442.\u043a \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"pgsql\">MERGE INTO target_table t USING source_table s     ON t.id = s.id WHEN MATCHED THEN     UPDATE SET descr = s.descr; <\/code><\/pre>\n<pre><code class=\"plaintext\">MERGE 3 <\/code><\/pre>\n<pre><code class=\"pgsql\">SELECT s.*, t.* FROM source_table s      FULL OUTER JOIN target_table t ON (t.id=s.id); <\/code><\/pre>\n<pre><code class=\"plaintext\"> id | descr | id | descr ----+-------+----+-------   0 | \u041d\u043e\u043b\u044c  |  0 | \u041d\u043e\u043b\u044c   1 | \u041e\u0434\u0438\u043d  |  1 | \u041e\u0434\u0438\u043d   2 | \u0414\u0432\u0430   |  2 | \u0414\u0432\u0430 (3 rows) <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u043b\u0430\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code class=\"pgsql\">EXPLAIN (costs off) MERGE INTO target_table t USING source_table s     ON t.id = s.id WHEN MATCHED THEN     UPDATE SET descr = s.descr; <\/code><\/pre>\n<pre><code class=\"plaintext\">                  QUERY PLAN                   ----------------------------------------------  Merge on target_table t    ->  Hash Join          Hash Cond: (t.id = s.id)          ->  Seq Scan on target_table t          ->  Hash                ->  Seq Scan on source_table s <\/code><\/pre>\n<p>  \u0421\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a: \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441\u043b\u0438\u044f\u043d\u0438\u0435\u043c, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0446\u0438\u043a\u043b\u0430\u043c\u0438 \u0438\u043b\u0438, \u043a\u0430\u043a \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0445\u0435\u0448-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0431\u0435\u0437 MERGE. \u041d\u0443\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0440\u0430\u0437\u043e\u0439 FROM \u043a\u043e\u043c\u0430\u043d\u0434\u044b UPDATE:<\/p>\n<pre><code class=\"pgsql\">UPDATE target_table t SET descr = s.descr FROM source_table s WHERE t.id = s.id; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0434\u0430\u043b\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"pgsql\">DELETE FROM target_table WHERE id = 0;  SELECT s.*, t.* FROM source_table s      FULL OUTER JOIN target_table t ON (t.id=s.id); <\/code><\/pre>\n<pre><code class=\"plaintext\"> id | descr | id | descr ----+-------+----+-------   0 | \u041d\u043e\u043b\u044c  |    |   1 | \u041e\u0434\u0438\u043d  |  1 | \u041e\u0434\u0438\u043d   2 | \u0414\u0432\u0430   |  2 | \u0414\u0432\u0430 (3 rows) <\/code><\/pre>\n<p>  \u041a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 MERGE \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c NOT MATCHED. \u0410 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0443\u043a\u0430\u0436\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 INSERT, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443:<\/p>\n<pre><code class=\"pgsql\">MERGE INTO target_table t USING source_table s     ON t.id = s.id WHEN NOT MATCHED THEN     INSERT (id, descr) VALUES (s.id, s.descr) WHEN MATCHED THEN     UPDATE SET descr = s.descr; <\/code><\/pre>\n<pre><code class=\"plaintext\">MERGE 3 <\/code><\/pre>\n<p>  \u0423\u0441\u043b\u043e\u0432\u0438\u044f WHEN \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u0432\u0435\u0440\u0445\u0443-\u0432\u043d\u0438\u0437 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u041f\u0435\u0440\u0432\u043e\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u2015 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f.<\/p>\n<p>  \u0423\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b:<\/p>\n<pre><code class=\"pgsql\">SELECT s.*, t.* FROM source_table s      FULL OUTER JOIN target_table t ON (t.id=s.id); <\/code><\/pre>\n<pre><code class=\"plaintext\"> id | descr | id | descr ----+-------+----+-------   0 | \u041d\u043e\u043b\u044c  |  0 | \u041d\u043e\u043b\u044c   1 | \u041e\u0434\u0438\u043d  |  1 | \u041e\u0434\u0438\u043d   2 | \u0414\u0432\u0430   |  2 | \u0414\u0432\u0430 (3 rows) <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u043b\u0430\u043d \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b MERGE:<\/p>\n<pre><code class=\"pgsql\">EXPLAIN (costs off) MERGE INTO target_table t USING source_table s     ON t.id = s.id WHEN NOT MATCHED THEN     INSERT (id, descr) VALUES (s.id, s.descr) WHEN MATCHED THEN     UPDATE SET descr = s.descr; <\/code><\/pre>\n<pre><code class=\"plaintext\">                  QUERY PLAN                   ----------------------------------------------  Merge on target_table t    ->  Hash Left Join          Hash Cond: (s.id = t.id)          ->  Seq Scan on source_table s          ->  Hash                ->  Seq Scan on target_table t <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u043b\u0435\u0432\u043e\u0435 \u0445\u0435\u0448-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. \u0412\u043d\u0435\u0448\u043d\u0435\u0435 \u043b\u0435\u0432\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0437 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u041c\u044b \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e WHEN NOT MATCHED.<\/p>\n<p>  \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u043e\u043f\u044f\u0442\u044c \u0436\u0435, \u0447\u0442\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"pgsql\">INSERT INTO target_table     SELECT * FROM source_table s         ON CONFLICT (id) DO UPDATE SET descr = EXCLUDED.descr; <\/code><\/pre>\n<pre><code class=\"plaintext\">INSERT 0 3 <\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0443 \u043d\u0438\u0445 \u0440\u0430\u0437\u043d\u044b\u0439. INSERT\u2026 ON CONFLICT \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u0438 \u0435\u0441\u043b\u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0430 \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437-\u0437\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. \u0410 MERGE \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0441 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a [NOT] MATCHED, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0441\u0442\u0440\u043e\u043a \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435.<\/p>\n<p>  \u041d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435?<\/p>\n<pre><code class=\"pgsql\">INSERT INTO target_table VALUES (3, '\u0422\u0440\u0438');  SELECT s.*, t.* FROM source_table s      FULL OUTER JOIN target_table t ON (t.id=s.id); <\/code><\/pre>\n<pre><code class=\"plaintext\"> id | descr | id | descr ----+-------+----+-------   0 | \u041d\u043e\u043b\u044c  |  0 | \u041d\u043e\u043b\u044c   1 | \u041e\u0434\u0438\u043d  |  1 | \u041e\u0434\u0438\u043d   2 | \u0414\u0432\u0430   |  2 | \u0414\u0432\u0430     |       |  3 | \u0422\u0440\u0438 (4 rows) <\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435, \u00ab\u043b\u0438\u0448\u043d\u0438\u0435\u00bb \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>  \u0412 MS SQL Server \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 MATCHED BY SOURCE. \u0412 PostgreSQL \u043e\u043d\u043e \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u043c\u044b \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0439 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430. \u0410 \u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c:<\/p>\n<pre><code class=\"pgsql\">SELECT coalesce(s.id,t.id) full_id, s.* FROM source_table s      FULL OUTER JOIN target_table t ON t.id = s.id; <\/code><\/pre>\n<pre><code class=\"plaintext\"> full_id | id | descr ---------+----+-------        0 |  0 | \u041d\u043e\u043b\u044c        1 |  1 | \u041e\u0434\u0438\u043d        2 |  2 | \u0414\u0432\u0430        3 |    | (4 rows) <\/code><\/pre>\n<p>  \u0412 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 full_id \u2015 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 id \u0438\u0437 \u043e\u0431\u0435\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446. \u0415\u0441\u043b\u0438 full_id \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d, \u0430 s.id \u043d\u0435\u0442, \u0442\u043e \u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0441\u0442\u0440\u043e\u043a\u0438, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435 \u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u0445 \u0443\u0434\u0430\u043b\u0438\u0442\u044c.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 MERGE \u0442\u0430\u043a:<\/p>\n<pre><code class=\"pgsql\">MERGE INTO target_table t USING (     SELECT coalesce(s.id,t.id) full_id, s.*     FROM source_table s               FULL OUTER JOIN target_table t ON t.id = s.id ) s     ON t.id = s.full_id WHEN NOT MATCHED THEN     INSERT (id, descr) VALUES (s.id, s.descr) WHEN MATCHED AND s.id IS NULL THEN     DELETE WHEN MATCHED THEN     UPDATE SET descr = s.descr; <\/code><\/pre>\n<pre><code class=\"plaintext\">MERGE 4 <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f: WHEN MATCHED AND s.id IS NULL. \u0410 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u0432\u0435\u043b\u043e\u0441\u044c \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0441\u043b\u043e\u0432\u0443 DELETE.<\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:<\/p>\n<pre><code class=\"pgsql\">SELECT s.*, t.* FROM source_table s      FULL OUTER JOIN target_table t ON (t.id=s.id); <\/code><\/pre>\n<pre><code class=\"plaintext\"> id | descr | id | descr ----+-------+----+-------   0 | \u041d\u043e\u043b\u044c  |  0 | \u041d\u043e\u043b\u044c   1 | \u041e\u0434\u0438\u043d  |  1 | \u041e\u0434\u0438\u043d   2 | \u0414\u0432\u0430   |  2 | \u0414\u0432\u0430 (3 rows) <\/code><\/pre>\n<p>  \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u0438 \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 MERGE?<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043f\u043b\u0430\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043d\u0430\u0434\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0444\u0440\u0430\u0437\u0430 RETURNING \u0434\u043b\u044f MERGE \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f).<\/p>\n<pre><code class=\"pgsql\">EXPLAIN (analyze, costs off, timing off, summary off) MERGE INTO target_table t USING (     SELECT coalesce(s.id,t.id) full_id, s.*     FROM source_table s               FULL OUTER JOIN target_table t ON t.id = s.id ) s     ON t.id = s.full_id WHEN NOT MATCHED THEN     INSERT (id, descr) VALUES (s.id, s.descr) WHEN MATCHED AND s.id IS NULL THEN     DELETE WHEN MATCHED THEN     UPDATE SET descr = s.descr; <\/code><\/pre>\n<pre><code class=\"plaintext\">                                  QUERY PLAN                                   ------------------------------------------------------------------------------  Merge on target_table t (actual rows=0 loops=1)    Tuples Inserted: 0    Tuples Updated: 3    Tuples Deleted: 0    Tuples Skipped: 0    ->  Hash Left Join (actual rows=3 loops=1)          Hash Cond: (COALESCE(s.id, t_1.id) = t.id)          ->  Hash Full Join (actual rows=3 loops=1)                Hash Cond: (s.id = t_1.id)                ->  Seq Scan on source_table s (actual rows=3 loops=1)                ->  Hash (actual rows=3 loops=1)                      Buckets: 2048  Batches: 1  Memory Usage: 17kB                      ->  Seq Scan on target_table t_1 (actual rows=3 loops=1)          ->  Hash (actual rows=3 loops=1)                Buckets: 2048  Batches: 1  Memory Usage: 17kB                ->  Seq Scan on target_table t (actual rows=3 loops=1) <\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u043c \u0447\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u043e \u0437\u0430\u0447\u0435\u043c? \u0412\u0435\u0434\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f descr \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435 \u0438 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0435.<\/p>\n<p>  \u0423\u0442\u043e\u0447\u043d\u0438\u043c \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0442\u043a\u0435 WHEN \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a.<\/p>\n<pre><code class=\"pgsql\">EXPLAIN (analyze, costs off, timing off, summary off) MERGE INTO target_table t USING (     SELECT coalesce(s.id,t.id) full_id, s.*     FROM source_table s               FULL OUTER JOIN target_table t ON t.id = s.id ) s     ON t.id = s.full_id WHEN NOT MATCHED THEN     INSERT (id, descr) VALUES (s.id, s.descr) WHEN MATCHED AND s.id IS NULL THEN     DELETE WHEN MATCHED AND t.descr IS DISTINCT FROM s.descr THEN     UPDATE SET descr = s.descr; <\/code><\/pre>\n<pre><code class=\"plaintext\">                                  QUERY PLAN                                   ------------------------------------------------------------------------------  Merge on target_table t (actual rows=0 loops=1)    Tuples Inserted: 0    Tuples Updated: 0    Tuples Deleted: 0    Tuples Skipped: 3    ->  Hash Left Join (actual rows=3 loops=1)          Hash Cond: (COALESCE(s.id, t_1.id) = t.id)          ->  Hash Full Join (actual rows=3 loops=1)                Hash Cond: (s.id = t_1.id)                ->  Seq Scan on source_table s (actual rows=3 loops=1)                ->  Hash (actual rows=3 loops=1)                      Buckets: 2048  Batches: 1  Memory Usage: 17kB                      ->  Seq Scan on target_table t_1 (actual rows=3 loops=1)          ->  Hash (actual rows=3 loops=1)                Buckets: 2048  Batches: 1  Memory Usage: 17kB                ->  Seq Scan on target_table t (actual rows=3 loops=1) <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043b\u0438\u0448\u043d\u0438\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445 \u043f\u043e\u0447\u0442\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0438\u0442\u043e\u0433\u0438.  <\/p>\n<ul>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f MERGE \u0432 PostgreSQL \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0432\u0430\u0436\u043d\u044b\u0439 \u0448\u0430\u0433 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 SQL.<\/li>\n<li>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 MERGE \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 PostgreSQL \u0441 \u0434\u0440\u0443\u0433\u0438\u0445 \u0421\u0423\u0411\u0414, \u0433\u0434\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0430\u0432\u043d\u043e.<\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c MERGE \u0448\u0438\u0440\u0435, \u0447\u0435\u043c \u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b INSERT\u2026 ON CONFLICT. \u042d\u0442\u0438 \u0434\u0432\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c\u044b.<\/li>\n<\/ul>\n<p>  \u0417\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <a href=\"https:\/\/www.postgresql.org\/docs\/devel\/sql-merge.html\">MERGE<\/a>.<\/p>\n<p>  <a href=\"https:\/\/www.depesz.com\/2022\/03\/31\/waiting-for-postgresql-15-add-support-for-merge-sql-command\/\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a> \u043e\u0442 depesz.<\/p>\n<p>  <a name=\"commit_a6baa4ba\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/2901\/\">\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 SQL\/JSON<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/a6baa4ba\">a6baa4ba<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/f79b803d\">f79b803d<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/f4fb45d1\">f4fb45d1<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/33a37760\">33a37760<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/1a36bc9d\">1a36bc9d<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/606948b0\">606948b0<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/49082c2c\">49082c2c<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/4e34747c\">4e34747c<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/fadb48b0\">fadb48b0<\/a><\/p>\n<p>  \u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u0432 \u043b\u0438\u0448\u044c \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043c \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e \u0432 PostgreSQL \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 SQL\/JSON. \u0415\u0449\u0435 \u0432 12-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0443\u0442\u0435\u0439 JSONPATH \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0447\u0430\u0441\u0442\u044f\u043c JSON. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 JSON. \u0412\u0441\u0451 \u0432\u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 JSON \u0438 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0421\u0423\u0411\u0414.<\/p>\n<p>  \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u043e\u0431\u0437\u043e\u0440 \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0445 \u043f\u0430\u0442\u0447\u0435\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0432 <a href=\"https:\/\/postgrespro.com\/blog\/pgsql\/5969433\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u041e\u043b\u0435\u0433\u0430 \u0411\u0430\u0440\u0442\u0443\u043d\u043e\u0432\u0430, \u0438\u0434\u0435\u0439\u043d\u043e\u0433\u043e \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u0442\u0435\u043b\u044f \u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0430\u0432\u0442\u043e\u0440\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043d\u0430 \u0434\u0435\u043c\u043e-\u0431\u0430\u0437\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f JSON \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439-\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432. \u041e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c JSON \u0438\u0437 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"pgsql\">SELECT JSON_OBJECT('id': passenger_id, 'name': passenger_name RETURNING jsonb) FROM tickets t WHERE t.book_ref = '000010'; <\/code><\/pre>\n<pre><code class=\"plaintext\">                     json_object                      -----------------------------------------------------  {\"id\": \"5722 837257\", \"name\": \"ALEKSANDR SOKOLOV\"}  {\"id\": \"0564 044306\", \"name\": \"LYUDMILA BOGDANOVA\"} <\/code><\/pre>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440. \u041c\u044b \u0445\u043e\u0442\u0438\u043c \u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0432 \u043d\u0438\u0445 \u0431\u0438\u043b\u0435\u0442\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 JSON \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u0411\u0438\u043b\u0435\u0442\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, JSON_ARRAY \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u0438\u0445 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"pgsql\">CREATE TABLE bookings_json AS SELECT b.book_ref,        JSON_OBJECT(            'book_ref': b.book_ref,            'book_date': b.book_date,            'total_amount': b.total_amount,            'tickets': JSON_ARRAY(                    SELECT JSON_OBJECT(                           'ticket_no': ticket_no,                           'passenger': JSON_OBJECT('id':passenger_id, 'name': passenger_name)                       )                FROM tickets t                WHERE t.book_ref = b.book_ref            )            RETURNING jsonb        ) data FROM bookings b WHERE b.book_ref = '000010'; <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c:<\/p>\n<pre><code class=\"pgsql\">SELECT book_ref, jsonb_pretty(data) FROM bookings_json; <\/code><\/pre>\n<pre><code class=\"plaintext\"> book_ref |                 jsonb_pretty                   ----------+-----------------------------------------------  000010   | {                                            +           |     \"tickets\": [                             +           |         {                                    +           |             \"passenger\": {                   +           |                 \"id\": \"5722 837257\",         +           |                 \"name\": \"ALEKSANDR SOKOLOV\"  +           |             },                               +           |             \"ticket_no\": \"0005432295359\"     +           |         },                                   +           |         {                                    +           |             \"passenger\": {                   +           |                 \"id\": \"0564 044306\",         +           |                 \"name\": \"LYUDMILA BOGDANOVA\" +           |             },                               +           |             \"ticket_no\": \"0005432295360\"     +           |         }                                    +           |     ],                                       +           |     \"book_ref\": \"000010\",                    +           |     \"book_date\": \"2017-01-08T19:45:00+03:00\",+           |     \"total_amount\": 50900.00                 +           | } <\/code><\/pre>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 JSON_OBJECT, JSON_ARRAY \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435: JSON, JSON_ARRAYAGG, JSON_OBJECTAGG.<\/p>\n<p>  <a href=\"https:\/\/www.depesz.com\/2022\/03\/31\/waiting-for-postgresql-15-sql-json-constructors\/\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a> \u0444\u0443\u043d\u043a\u0446\u0438\u0439-\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u043e\u0442 depesz.<\/p>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0442\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f JSON \u0432 \u0441\u0442\u043e\u043b\u0431\u0446\u0435 data:<\/p>\n<pre><code class=\"pgsql\">SELECT data IS JSON AS is_json,        data IS JSON WITH UNIQUE KEYS AS is_unique_keys,        data IS JSON ARRAY AS is_json_array,        data IS JSON OBJECT AS is_json_object,        data IS JSON SCALAR AS is_json_scalar FROM bookings_json\\gx <\/code><\/pre>\n<pre><code class=\"plaintext\">-[ RECORD 1 ]--+-- is_json        | t is_unique_keys | t is_json_array  | f is_json_object | t is_json_scalar | f <\/code><\/pre>\n<p>  <a href=\"https:\/\/www.depesz.com\/2022\/04\/01\/waiting-for-postgresql-15-is-json-predicate\/\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a> \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u0432 \u043e\u0442 depesz.<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0431\u0438\u043b\u0435\u0442\u043e\u0432, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432 \u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<pre><code class=\"pgsql\">SELECT book_ref,        JSON_QUERY(data, '$.tickets[$i].ticket_no' PASSING g.x as i) FROM bookings_json, generate_series(0,1) AS g(x); <\/code><\/pre>\n<pre><code class=\"plaintext\"> book_ref |   json_query     ----------+-----------------  000010   | \"0005432295359\"  000010   | \"0005432295360\" <\/code><\/pre>\n<p>  \u0412\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 JSON_QUERY \u0443\u043a\u0430\u0437\u0430\u043d \u043f\u0443\u0442\u044c \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 JSONPATH \u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0431\u0438\u043b\u0435\u0442\u043e\u0432. \u0412 \u044d\u0442\u043e\u0442 \u043f\u0443\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 (PASSING) \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043a\u043b\u044e\u0447\u0430 \u0432 JSON \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"pgsql\">SELECT JSON_EXISTS(data, '$.book_ref') book_ref_exists,        JSON_VALUE(data, '$.book_ref') book_ref_value FROM bookings_json; <\/code><\/pre>\n<pre><code class=\"plaintext\"> book_ref_exists | book_ref_value -----------------+----------------  t               | 000010 <\/code><\/pre>\n<p>  \u042d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0432 JSON \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u043a\u043b\u044e\u0447 book_date, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430 book_ref \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u043b\u043e \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0430 book_ref. <\/p>\n<pre><code class=\"pgsql\">ALTER TABLE bookings_json    ADD CONSTRAINT chk_book_ref CHECK (JSON_VALUE(data, '$.book_ref') = book_ref),    ADD CONSTRAINT chk_book_date CHECK (JSON_EXISTS(data, '$.book_date'));  INSERT INTO bookings_json     VALUES ('_12345', JSON_OBJECT('book_ref': '123456')); <\/code><\/pre>\n<pre><code class=\"plaintext\">ERROR:  new row for relation \"bookings_json\" violates check constraint \"chk_book_date\" DETAIL:  Failing row contains (_12345, {\"book_ref\": \"123456\"}). <\/code><\/pre>\n<pre><code class=\"pgsql\">INSERT INTO bookings_json     VALUES ('_12345', JSON_OBJECT('book_ref': '123456', 'book_date': now())); <\/code><\/pre>\n<pre><code class=\"plaintext\">ERROR:  new row for relation \"bookings_json\" violates check constraint \"chk_book_ref\" DETAIL:  Failing row contains (_12345, {\"book_ref\": \"123456\", \"book_date\": \"2022-06-15T19:05:28.33306+0...). <\/code><\/pre>\n<pre><code class=\"pgsql\">INSERT INTO bookings_json     VALUES ('_12345', JSON_OBJECT('book_ref': '_12345', 'book_date': now())); <\/code><\/pre>\n<pre><code class=\"plaintext\">INSERT 0 1 <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<p>  <a href=\"https:\/\/www.depesz.com\/2022\/04\/01\/waiting-for-postgresql-15-sql-json-query-functions\/\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a> \u0444\u0443\u043d\u043a\u0446\u0438\u0439 JSON_QUERY, JSON_EXISTS, JSON_VALUE \u043e\u0442 depesz.<\/p>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 JSON \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u043c\u0443 \u0432\u0438\u0434\u0443:<\/p>\n<pre><code class=\"pgsql\">SELECT b.book_ref, jt.* FROM bookings_json b,      JSON_TABLE(b.data,          '$[*]'          COLUMNS (              book_date date PATH '$.book_date',              total_amount numeric(18,2) PATH '$.total_amount',              NESTED PATH '$.tickets[*]'              COLUMNS (                  ticket_no text PATH '$.ticket_no',                  passenger_id text PATH '$.passenger.id',                  passenger_name text PATH '$.passenger.name'              )          )      ) jt; <\/code><\/pre>\n<pre><code class=\"plaintext\"> book_ref | book_date  | total_amount |   ticket_no   | passenger_id |   passenger_name    ----------+------------+--------------+---------------+--------------+--------------------  000010   | 2017-01-08 |     50900.00 | 0005432295359 | 5722 837257  | ALEKSANDR SOKOLOV  000010   | 2017-01-08 |     50900.00 | 0005432295360 | 0564 044306  | LYUDMILA BOGDANOVA  _12345   | 2022-06-15 |              |               |              | (3 rows) <\/code><\/pre>\n<p>  <a href=\"https:\/\/www.depesz.com\/2022\/04\/06\/waiting-for-postgresql-15-json_table\/\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a> JSON_TABLE \u043e\u0442 depesz.<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u043b\u0438\u0448\u044c \u0447\u0430\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0443\u043c\u0435\u044e\u0442 \u043d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 SQL\/JSON. \u0418\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0448\u0438\u0440\u0435. \u041f\u043e\u043b\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u0444\u043e\u0440\u043c\u0438\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u043c (\u043f\u0435\u0440\u0432\u044b\u0439 \u0432 \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435).<\/p>\n<p>  <a href=\"https:\/\/www.depesz.com\/2022\/04\/08\/waiting-for-postgresql-15-documentation-for-sql-json-features\/\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a> \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 SQL\/JSON \u043e\u0442 depesz.<\/p>\n<p>  <a name=\"commit_43f33dc0\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/2780\/\">COPY: \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/43f33dc0\">43f33dc0<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/072132f0\">072132f0<\/a><\/p>\n<p>  \u0414\u043e 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 COPY \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u0430 \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0430 csv. \u0412 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0438 \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430:<\/p>\n<pre><code class=\"pgsql\">COPY (SELECT * FROM bookings LIMIT 3) TO stdout (header); <\/code><\/pre>\n<pre><code class=\"plaintext\">book_ref    book_date    total_amount 000004    2016-08-13 15:40:00+03    55800.00 00000F    2017-07-05 03:12:00+03    265700.00 000010    2017-01-08 19:45:00+03    50900.00 <\/code><\/pre>\n<p>  \u0421\u0442\u0440\u043e\u043a\u0430 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435:<\/p>\n<pre><code class=\"pgsql\">COPY bookings FROM stdout (header match); <\/code><\/pre>\n<pre><code class=\"plaintext\">Enter data to be copied followed by a newline. End with a backslash and a period on a line by itself, or an EOF signal. >> book_ref    book_date    total_amount >> _12345    2022-05-24    1000 >> \\. COPY 1 <\/code><\/pre>\n<p>  \u0423\u043a\u0430\u0437\u0430\u043d\u0438\u0435 header \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 match \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438\u043c\u0435\u043d \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u041f\u0440\u0438 \u043d\u0435\u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u0435\u0441\u044c\u043c\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443:<\/p>\n<pre><code class=\"pgsql\">COPY bookings FROM stdout (header match); <\/code><\/pre>\n<pre><code class=\"plaintext\">Enter data to be copied followed by a newline. End with a backslash and a period on a line by itself, or an EOF signal. >> book_id      book_date    total_amount >> _12345    2022-05-24    1000 >> \\. ERROR:  column name mismatch in header line field 1: got \"book_id\", expected \"book_ref\" CONTEXT:  COPY bookings, line 1: \"book_id    book_date    total_amount\" <\/code><\/pre>\n<p>  <a href=\"https:\/\/www.depesz.com\/2022\/01\/28\/waiting-for-postgresql-15-add-header-support-to-copy-text-format\/\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a> \u043e\u0442 depesz.<\/p>\n<p>  <a name=\"commit_cfdd03f4\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/2800\/\">CLUSTER \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/cfdd03f4\">cfdd03f4<\/a><\/p>\n<p>  VACUUM FULL \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 10-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0445\u043e\u0436\u0430\u044f \u043f\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 CLUSTER.<\/p>\n<p>  <a name=\"commit_ae1619b\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3465\/\">range_agg \u0434\u043b\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/ae1619b\">ae1619b<\/a><\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f range_agg \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043d\u044b\u0435, \u043d\u043e \u0438 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u0435\u0441\u044f \u0432 14-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"pgsql\">\\df range_agg <\/code><\/pre>\n<pre><code class=\"plaintext\">                           List of functions    Schema   |   Name    | Result data type | Argument data types | Type ------------+-----------+------------------+---------------------+------  pg_catalog | range_agg | anymultirange    | anymultirange       | agg  pg_catalog | range_agg | anymultirange    | anyrange            | agg <\/code><\/pre>\n<p>  <\/p>\n<h3>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433<\/h3>\n<p>  <a name=\"commit_5891c7a8\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3589\/\">\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0432 \u043e\u0431\u0449\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/5891c7a8\">5891c7a8<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/b3abca68\">b3abca68<\/a><\/p>\n<p>  \u0412 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0441\u0431\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u2015 \u043a\u043e\u043b\u043b\u0435\u043a\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u2015 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0442 \u0432\u0441\u0435\u0445 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0438 \u0440\u0430\u0437 \u0432 \u043f\u043e\u043b\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0435\u0435 \u043d\u0430 \u0434\u0438\u0441\u043a \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0442\u044c \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442. <\/p>\n<p>  \u0411\u043e\u0440\u043e\u0442\u044c\u0441\u044f \u0441 \u0434\u0438\u0441\u043a\u043e\u0432\u044b\u043c \u0432\u0432\u043e\u0434\u043e\u043c\/\u0432\u044b\u0432\u043e\u0434\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 <i>stats_temp_directory<\/i> \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0442\u0430\u043a\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u043e\u0432.<\/p>\n<p>  \u0412 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0431\u043e\u0440 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043d \u0432 \u043e\u0431\u0449\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c. \u041e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (\u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435) \u0441\u0430\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435. \u041f\u0440\u0438 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e\u043c \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0438\u0437 \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 pg_stat \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0431\u043e\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043a\u0430\u043a \u0438 \u0440\u0430\u043d\u044c\u0448\u0435.<\/p>\n<p>  \u0427\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c? \u0411\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 stats collector, \u0432\u0435\u0434\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0441\u0430\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443. \u0414\u0430 \u0438 \u0441\u0430\u043c\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u00ab\u043a\u043e\u043b\u043b\u0435\u043a\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438\u00bb \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u043e \u043d\u0430 \u00ab\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u0443\u043c\u0443\u043b\u044f\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438\u00bb (<a href=\"https:\/\/www.postgresql.org\/docs\/devel\/monitoring-stats.html\">Cumulative Statistics System<\/a>). \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <i>stats_temp_directory<\/i>, \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0430\u0434\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b. \u0410 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <a href=\"https:\/\/www.postgresql.org\/docs\/devel\/runtime-config-statistics.html#GUC-STATS-FETCH-CONSISTENCY\"><i>stats_fetch_consistency<\/i><\/a>. <\/p>\n<p>  \u0418\u0437 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u0432 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u044d\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b \u0434\u0432\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u2015 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0432 \u043e\u0431\u0449\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u0432\u0442\u043e\u0440\u043e\u0439 \u2015 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>  <a name=\"commit_efb0ef90\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3298\/\">explain \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u0432\u043e\u0434\/\u0432\u044b\u0432\u043e\u0434 \u0434\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/efb0ef90\">efb0ef90<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/76cbf7ed\">76cbf7ed<\/a><\/p>\n<p>  \u0412\u043a\u043b\u044e\u0447\u0438\u043c track_io_timing \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 14-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438:<\/p>\n<pre><code class=\"pgsql\">14=# SET track_io_timing = on;  14=# EXPLAIN (analyze, buffers, costs off) SELECT count(*) FROM generate_series(1,1000000); <\/code><\/pre>\n<pre><code class=\"plaintext\">                                        QUERY PLAN                                          -------------------------------------------------------------------------------------------  Aggregate (actual time=206.451..206.452 rows=1 loops=1)    Buffers: temp read=1709 written=1709    ->  Function Scan on generate_series (actual time=92.500..164.520 rows=1000000 loops=1)          Buffers: temp read=1709 written=1709  Planning Time: 0.052 ms  Execution Time: 208.279 ms <\/code><\/pre>\n<p>  \u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c. \u0414\u0430 \u0438 \u043e\u0442\u043a\u0443\u0434\u0430 \u0435\u0439 \u0432\u0437\u044f\u0442\u044c\u0441\u044f, \u0432\u0435\u0434\u044c \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c \u043c\u044b \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u043b\u0438\u0441\u044c.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e:<\/p>\n<pre><code class=\"pgsql\">15=# SET track_io_timing = on;  15=# EXPLAIN (analyze, buffers, costs off) SELECT count(*) FROM generate_series(1,1000000); <\/code><\/pre>\n<pre><code class=\"plaintext\">                                        QUERY PLAN                                          -------------------------------------------------------------------------------------------  Aggregate (actual time=182.130..182.132 rows=1 loops=1)    Buffers: temp read=1709 written=1709    I\/O Timings: temp read=2.573 write=9.350    ->  Function Scan on generate_series (actual time=82.422..143.206 rows=1000000 loops=1)          Buffers: temp read=1709 written=1709          I\/O Timings: temp read=2.573 write=9.350  Planning Time: 0.045 ms  Execution Time: 183.608 ms <\/code><\/pre>\n<p>  \u0412\u0432\u043e\u0434\/\u0432\u044b\u0432\u043e\u0434 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f. \u0421\u0442\u0440\u043e\u043a\u0438 \u0441 I\/O Timings \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u0430 \u0432 \u0432\u044b\u0432\u043e\u0434 EXPLAIN \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u043b\u0438\u0441\u044c.<\/p>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043c\u043c\u0438\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u043e\u043b\u0431\u0446\u044b temp_blk_read_time \u0438 temp_blk_write_time \u0432 pg_stat_statements \u0434\u043b\u044f \u0442\u0435\u0445 \u0436\u0435 \u0446\u0435\u043b\u0435\u0439.<\/p>\n<p>  <a name=\"commit_57d6aea0\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3572\/\">pg_stat_statements \u0438 JIT<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/57d6aea0\">57d6aea0<\/a><\/p>\n<p>  \u0412 pg_stat_statements \u043d\u043e\u0432\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b, \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0449\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0440\u0430\u0431\u043e\u0442\u0435 JIT:<\/p>\n<pre><code class=\"pgsql\">\\d pg_stat_statements <\/code><\/pre>\n<pre><code class=\"plaintext\">                      View \"public.pg_stat_statements\"          Column         |       Type       | Collation | Nullable | Default ------------------------+------------------+-----------+----------+---------  ...  jit_functions          | bigint           |           |          |  jit_generation_time    | double precision |           |          |  jit_inlining_count     | bigint           |           |          |  jit_inlining_time      | double precision |           |          |  jit_optimization_count | bigint           |           |          |  jit_optimization_time  | double precision |           |          |  jit_emission_count     | bigint           |           |          |  jit_emission_time      | double precision |           |          | <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0449\u0435 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u043b\u0438\u044f\u043d\u0438\u0435 JIT \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<h3>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p>  <a name=\"commit_0bd7af08\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3400\/\">recursive_worktable_factor: \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/0bd7af08\">0bd7af08<\/a><\/p>\n<p>  <a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/318398\/\">\u0420\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b<\/a>, \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u0435\u0439. \u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e, \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u041d\u043e \u043a\u0430\u043a \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0443 \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u0438 \u043a\u0430\u043a\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438? \u041e\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u044d\u0442\u0438 \u0434\u0432\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043b\u0430\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u043d.<\/p>\n<p>  \u041e\u0442\u0432\u0435\u0442\u044b \u0434\u043e 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0436\u0435\u0441\u0442\u043a\u043e \u0437\u0430\u0448\u0438\u0442\u044b \u0432 \u043a\u043e\u0434\u0435. \u041e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e 10 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0430 \u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0432 10 \u0440\u0430\u0437 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0440\u044f\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u043c. \u0414\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 \u043c\u0430\u043b\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435, \u0430 \u0434\u043b\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0443\u0437\u043b\u043e\u0432 \u0432 \u0433\u0440\u0430\u0444\u043e\u0432\u044b\u0445 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u0431\u043e\u043b\u044c\u0448\u0435. \u041e\u0448\u0438\u0431\u043a\u0430 \u0436\u0435 \u0432 \u0440\u0430\u0441\u0447\u0435\u0442\u0435 \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0432\u044b\u0431\u043e\u0440\u0443 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043b\u0430\u043d\u0430.<\/p>\n<p>  \u0412 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f 10, \u043d\u043e \u0432\u0442\u043e\u0440\u0443\u044e \u0434\u0435\u0441\u044f\u0442\u043a\u0443 \u0432\u044b\u043d\u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <a href=\"https:\/\/www.postgresql.org\/docs\/devel\/runtime-config-query.html#GUC-RECURSIVE-WORKTABLE-FACTOR\"><i>recursive_worktable_factor<\/i><\/a>, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0440\u0430\u0432\u043d\u044b\u0439 \u0442\u0430\u043a\u0436\u0435 10. \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u043e\u0439 \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u043b\u0430\u043d \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0433\u043e \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code class=\"pgsql\">EXPLAIN WITH RECURSIVE t(n) AS (     SELECT 1                                    UNION ALL     SELECT n+1 FROM t WHERE n &lt; 1000 ) SELECT * FROM t; <\/code><\/pre>\n<pre><code class=\"plaintext\">                               QUERY PLAN                                 -------------------------------------------------------------------------  CTE Scan on t  (cost=2.95..3.57 rows=31 width=4)    CTE t      ->  Recursive Union  (cost=0.00..2.95 rows=31 width=4)            ->  Result  (cost=0.00..0.01 rows=1 width=4)            ->  WorkTable Scan on t t_1  (cost=0.00..0.23 rows=3 width=4)                  Filter: (n &lt; 1000) <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u043e\u043a \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 (\u0443\u0437\u0435\u043b WorkTable Scan) \u0440\u0430\u0432\u043d\u0430 3, \u0430 \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u043e\u043a \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0443\u0437\u0435\u043b Recursive Union) \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 10 \u0440\u0430\u0437 \u0431\u043e\u043b\u044c\u0448\u0435 \u2015 31. <\/p>\n<p>  \u041d\u043e \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 1000 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0438 \u0432\u0435\u0440\u043d\u0435\u0442 1000 \u0441\u0442\u0440\u043e\u043a, \u0447\u0442\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043e\u0446\u0435\u043d\u043a\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 30 \u0440\u0430\u0437. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043d\u043e\u0432\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0434\u043b\u044f \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f \u043e\u0446\u0435\u043d\u043a\u0438:<\/p>\n<pre><code class=\"pgsql\">SET recursive_worktable_factor = 300; -- 10*30  EXPLAIN WITH RECURSIVE t(n) AS (     SELECT 1                                    UNION ALL     SELECT n+1 FROM t WHERE n &lt; 1000 ) SELECT * FROM t; <\/code><\/pre>\n<pre><code class=\"plaintext\">                                QUERY PLAN                                  ---------------------------------------------------------------------------  CTE Scan on t  (cost=90.03..110.05 rows=1001 width=4)    CTE t      ->  Recursive Union  (cost=0.00..90.03 rows=1001 width=4)            ->  Result  (cost=0.00..0.01 rows=1 width=4)            ->  WorkTable Scan on t t_1  (cost=0.00..7.00 rows=100 width=4)                  Filter: (n &lt; 1000) <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u0449\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441\u0442\u0430\u043b\u0430 \u0442\u043e\u0447\u043d\u043e\u0439, \u043f\u0440\u0430\u0432\u0434\u0430 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044f \u0438\u043b\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <i>recursive_worktable_factor<\/i> \u043c\u043e\u0436\u043d\u043e \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043e\u0446\u0435\u043d\u043a\u0443 \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0443\u0437\u043b\u0430 WorkTable Scan, \u0447\u0442\u043e \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043e\u0446\u0435\u043d\u043a\u0443 \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0443\u0437\u043b\u0430 Recursive Union.<\/p>\n<p>  <a name=\"commit_db0d67db\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/1651\/\">\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f GROUP BY<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/db0d67db\">db0d67db<\/a><\/p>\n<p>  \u041e\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u044b \u043c\u0435\u0441\u0442 \u0441\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0445 \u0441\u0443\u043c\u043c\u0430 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u0418 \u043e\u0442 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 GROUP BY \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0430 \u0432\u043e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u0435\u0442!<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 ticket_flights, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c ticket_no, flight_id:<\/p>\n<pre><code class=\"pgsql\">\\d ticket_flights <\/code><\/pre>\n<pre><code class=\"plaintext\">                     Table \"bookings.ticket_flights\"      Column      |         Type          | Collation | Nullable | Default -----------------+-----------------------+-----------+----------+---------  ticket_no       | character(13)         |           | not null |  flight_id       | integer               |           | not null |  fare_conditions | character varying(10) |           | not null |  amount          | numeric(10,2)         |           | not null | Indexes:     \"ticket_flights_pkey\" PRIMARY KEY, btree (ticket_no, flight_id) ... <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0438 GROUP BY \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043c\u0435\u0441\u0442\u0430\u043c\u0438, \u0442\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u00ab\u043d\u0435 \u0432\u0438\u0434\u0438\u0442\u00bb \u0438\u043d\u0434\u0435\u043a\u0441, \u0432\u044b\u0431\u0438\u0440\u0430\u044f \u043f\u043e\u043b\u043d\u043e\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<pre><code class=\"pgsql\">14=# EXPLAIN (analyze, costs off, timing off) SELECT flight_id,ticket_no, count(*) FROM ticket_flights GROUP BY flight_id,ticket_no; <\/code><\/pre>\n<pre><code class=\"plaintext\">                           QUERY PLAN                            ----------------------------------------------------------------  HashAggregate (actual rows=8391852 loops=1)    Group Key: flight_id, ticket_no    Batches: 745  Memory Usage: 4409kB  Disk Usage: 384560kB    ->  Seq Scan on ticket_flights (actual rows=8391852 loops=1)  Planning Time: 0.154 ms  Execution Time: 5622.852 ms <\/code><\/pre>\n<p>  \u0421\u0442\u043e\u0438\u0442 \u043b\u0438\u0448\u044c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0432 GROUP BY \u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435:<\/p>\n<pre><code class=\"pgsql\">14=# EXPLAIN (analyze, costs off, timing off) SELECT flight_id,ticket_no, count(*) FROM ticket_flights GROUP BY ticket_no,flight_id; <\/code><\/pre>\n<pre><code class=\"plaintext\">                                           QUERY PLAN                                             -------------------------------------------------------------------------------------------------  GroupAggregate (actual rows=8391852 loops=1)    Group Key: ticket_no, flight_id    ->  Index Only Scan using ticket_flights_pkey on ticket_flights (actual rows=8391852 loops=1)          Heap Fetches: 0  Planning Time: 0.161 ms  Execution Time: 2342.767 ms <\/code><\/pre>\n<p>  \u0412 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043d\u0430\u0443\u0447\u0438\u043b\u0441\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043b\u0430\u043d \u043f\u0440\u0438 \u043b\u044e\u0431\u043e\u043c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432:<\/p>\n<pre><code class=\"pgsql\">15=# EXPLAIN (analyze, costs off, timing off) SELECT flight_id,ticket_no, count(*) FROM ticket_flights GROUP BY flight_id,ticket_no; <\/code><\/pre>\n<pre><code class=\"plaintext\">                                           QUERY PLAN                                             -------------------------------------------------------------------------------------------------  GroupAggregate (actual rows=8391852 loops=1)    Group Key: ticket_no, flight_id    ->  Index Only Scan using ticket_flights_pkey on ticket_flights (actual rows=8391852 loops=1)          Heap Fetches: 0  Planning Time: 0.221 ms  Execution Time: 2302.012 ms <\/code><\/pre>\n<p>  \u0412\u043f\u0440\u043e\u0447\u0435\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <i>enable_group_by_reordering<\/i>.<\/p>\n<p>  <a name=\"commit_40af10b5\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3381\/\">\u0411\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u043f\u0440\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0435 \u0441\u0442\u0440\u043e\u043a<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/40af10b5\">40af10b5<\/a><\/p>\n<p>  \u0423\u0432\u0438\u0434\u0435\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043d\u0430 \u0442\u0430\u043a\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<pre><code class=\"pgsql\">14=# SET max_parallel_workers_per_gather = 0;  14=# EXPLAIN (analyze, costs off, timing off, summary off) SELECT * FROM bookings WHERE total_amount > 300000 ORDER BY total_amount; <\/code><\/pre>\n<pre><code class=\"plaintext\">                       QUERY PLAN                        --------------------------------------------------------  Sort (actual rows=45623 loops=1)    Sort Key: total_amount    Sort Method: external merge  Disk: 1480kB    ->  Seq Scan on bookings (actual rows=45623 loops=1)          Filter: (total_amount > '300000'::numeric)          Rows Removed by Filter: 2065487 <\/code><\/pre>\n<p>  \u0412 14-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u043b\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 external merge \u0441 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u043d\u0430 \u0434\u0438\u0441\u043a.<\/p>\n<p>  \u0422\u043e\u0442 \u0436\u0435 \u0437\u0430\u043f\u0440\u043e\u0441, \u043d\u0430 \u0442\u0435\u0445 \u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 quicksort:<\/p>\n<pre><code class=\"plaintext\">                       QUERY PLAN                        --------------------------------------------------------  Sort (actual rows=45623 loops=1)    Sort Key: total_amount    Sort Method: quicksort  Memory: 3969kB    ->  Seq Scan on bookings (actual rows=45623 loops=1)          Filter: (total_amount > '300000'::numeric)          Rows Removed by Filter: 2065487 <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0438 \u0432 14-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c quicksort, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432 <i>work_mem<\/i>. \u041d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u2015 \u043f\u0440\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u043c \u043e\u0431\u044a\u0435\u043c\u0435 <i>work_mem<\/i> \u043f\u0430\u043c\u044f\u0442\u044c \u0440\u0430\u0441\u0445\u043e\u0434\u0443\u0435\u0442\u0441\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438.<\/p>\n<p>  <a name=\"commit_f1ea98a7\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3488\/\">\u0418\u043d\u0434\u0435\u043a\u0441\u044b GiST: \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/f1ea98a7\">f1ea98a7<\/a><\/p>\n<p>  \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439, 14-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/522428\/\">\u043f\u0430\u0442\u0447<\/a> \u0410\u043d\u0434\u0440\u0435\u044f \u0411\u043e\u0440\u043e\u0434\u0438\u043d\u0430 \u043d\u0430\u0443\u0447\u0438\u043b PostgreSQL \u0441\u0442\u0440\u043e\u0438\u0442\u044c GiST-\u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0431\u044b\u0441\u0442\u0440\u0435\u0435 (\u043f\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c \u0441 \u0442\u0438\u043f\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 point) \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 Z-\u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u0414\u0430, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0430\u0441\u044c, \u043d\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u043c\u043e\u0433\u043b\u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430. \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/283\/10b\/68b\/28310b68b2cd841cb36def1070491fc1.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/283\/10b\/68b\/28310b68b2cd841cb36def1070491fc1.png\"\/><\/div>\n<p>  \u0410 \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u2014 \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435, \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0439 \u0441\u0442\u0430\u043b\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043c\u0435\u043d\u044c\u0448\u0435:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/b37\/8b5\/e42\/b378b5e429bf4402481b5b3988a4bc2a.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b37\/8b5\/e42\/b378b5e429bf4402481b5b3988a4bc2a.png\"\/><\/div>\n<p>  \u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u2014 \u0435\u0449\u0435 \u0447\u0443\u0442\u044c \u043b\u0443\u0447\u0448\u0435 \u2014 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u043e\u0442 \u0436\u0435 \u0438\u043d\u0434\u0435\u043a\u0441, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u043e \u0441\u0442\u0430\u0440\u0438\u043d\u043a\u0435, \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0438 \u0431\u0435\u0437 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/9af\/a28\/caf\/9afa28caf5ba2a3185ad0ad1189d35d8.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9af\/a28\/caf\/9afa28caf5ba2a3185ad0ad1189d35d8.png\"\/><\/div>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 \u0432\u044b\u0431\u043e\u0440\u0430 \u043c\u0435\u0436\u0434\u0443 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0410\u043d\u0434\u0440\u0435\u0439 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b \u0432 \u0441\u0432\u043e\u0435\u043c <a href=\"https:\/\/pgconf.ru\/2022\/315963\">\u0434\u043e\u043a\u043b\u0430\u0434\u0435<\/a> \u043d\u0430 PGConf.Russia 2022.<\/p>\n<p>  <a name=\"commit_9d9c02cc\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3234\/\">\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0438\u0445\/\u0443\u0431\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043e\u043a\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/9d9c02cc\">9d9c02cc<\/a><\/p>\n<p>  \u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 5 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 bookings? \u0412 PostgreSQL \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"pgsql\">14=# CREATE INDEX ON bookings(book_date); 14=# SET jit=off;  14=# EXPLAIN (analyze, costs off) SELECT * FROM bookings ORDER BY book_date DESC LIMIT 5; <\/code><\/pre>\n<pre><code class=\"plaintext\">                                           QUERY PLAN                                             -------------------------------------------------------------------------------------------------  Limit (actual time=0.016..0.022 rows=5 loops=1)    ->  Index Scan Backward using book_date on bookings (actual time=0.015..0.020 rows=5 loops=1)  Planning Time: 0.086 ms  Execution Time: 0.037 ms <\/code><\/pre>\n<p>  \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u043e\u043b\u0431\u0435\u0446 book_date \u0431\u044b\u043b \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d, \u0447\u0442\u043e \u0438 \u0431\u044b\u043b\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e.<\/p>\n<p>  \u0424\u0440\u0430\u0437\u0430 LIMIT \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043d\u0435 \u0432\u043e \u0432\u0441\u0435\u0445 \u0421\u0423\u0411\u0414. \u0412 \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435 \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0441 \u043e\u043a\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 row_number:<\/p>\n<pre><code class=\"pgsql\">14=# EXPLAIN (analyze, costs off) SELECT * FROM (     SELECT *, row_number() OVER (ORDER BY book_date desc) row_num     FROM bookings ) t WHERE row_num &lt;= 5; <\/code><\/pre>\n<pre><code class=\"plaintext\">                                                   QUERY PLAN                                                    ----------------------------------------------------------------------------------------------------------------  Subquery Scan on t (actual time=0.037..1737.146 rows=5 loops=1)    Filter: (t.row_num &lt;= 5)    Rows Removed by Filter: 2111105    ->  WindowAgg (actual time=0.036..1661.209 rows=2111110 loops=1)          ->  Index Scan Backward using book_date on bookings (actual time=0.018..1011.011 rows=2111110 loops=1)  Planning Time: 0.118 ms  Execution Time: 1737.174 ms <\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0437\u043a\u043e \u043f\u0430\u0434\u0430\u0435\u0442. \u041e\u043a\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f row_number \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u044f\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u0437\u0435\u043b WindowAgg \u0447\u0435\u0441\u0442\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432\u0441\u0435 2 \u0441 \u043b\u0438\u0448\u043d\u0438\u043c \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0438\u0445 \u0443\u0437\u043b\u0443 Subquery Scan. \u0410 \u0443\u0437\u0435\u043b Subquery Scan \u0447\u0435\u0441\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u043a \u043d\u0438\u043c \u0444\u0438\u043b\u044c\u0442\u0440 (t.row_num &lt;=5).<\/p>\n<p>  \u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438:<\/p>\n<pre><code class=\"pgsql\">15=# EXPLAIN (analyze, costs off) SELECT * FROM (     SELECT *, row_number() OVER (ORDER BY book_date desc) row_num     FROM bookings ) t WHERE row_num &lt;= 5; <\/code><\/pre>\n<pre><code class=\"plaintext\">                                                  QUERY PLAN                                                   --------------------------------------------------------------------------------------------------------------  WindowAgg (actual time=0.037..0.041 rows=5 loops=1)    Run Condition: (row_number() OVER (?) &lt;= 5)    ->  Index Scan Backward using bookings_book_date_idx on bookings (actual time=0.018..0.026 rows=8 loops=1)  Planning Time: 0.107 ms  Execution Time: 0.069 ms <\/code><\/pre>\n<p>  \u0423\u0437\u043b\u0430 Subquery Scan \u043d\u0435\u0442 \u0432\u043e\u043e\u0431\u0449\u0435, \u0430 \u0443\u0437\u0435\u043b WindowAgg \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f 5-\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u0432\u0438\u0434\u043d\u043e \u043f\u043e \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u043c\u0443\u0441\u044f \u0432 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044e Run Condition. \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0441 LIMIT.<\/p>\n<p>  \u041a\u0430\u043a \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c? \u0414\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 row_number \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 <a href=\"https:\/\/postgrespro.ru\/docs\/postgresql\/14\/xfunc-optimization\">\u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0443 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0442\u044c. \u0410 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u0441\u043e\u0431\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 Run Condition. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432 Run Condition \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0443\u0437\u043b\u0430 WindowAgg \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u043c \u043e\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0415\u0441\u043b\u0438 \u0431\u044b \u0443 \u043e\u043a\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0444\u0440\u0430\u0437\u0430 PARTITION BY \u0438\u043b\u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043a\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0431\u044b\u043b\u0430 \u0431\u044b \u043d\u0438\u0436\u0435.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u0435 \u0436\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f row_number, \u043d\u043e \u0438 \u0434\u043b\u044f rank(), dense_rank(), count(*) \u0438 count(expr). <\/p>\n<p>  <a name=\"commit_44fa8488\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3433\/\">\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043c\u043e\u0440\u043e\u0437\u043a\u0438 \u0432\u0435\u0440\u0441\u0438\u0439 \u0441\u0442\u0440\u043e\u043a<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/44fa8488\">44fa8488<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/872770fd\">872770fd<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/05023a23\">05023a23<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/0b018fab\">0b018fab<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/f3c15cbe\">f3c15cbe<\/a><\/p>\n<p>  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f\u043c \u0438 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0443 \u043a\u043e\u0434\u0430, \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043d\u0430\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u043f\u0440\u043e\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 relfrozenxid \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446. \u0410 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u043c\u043e\u0440\u043e\u0437\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u044b. <\/p>\n<p>  \u0423\u0432\u0438\u0434\u0435\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043d\u0430 \u0442\u0430\u043a\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u043e\u0447\u0438\u0441\u0442\u043a\u0443:<\/p>\n<pre><code class=\"pgsql\">CREATE TABLE t (id integer); INSERT INTO t VALUES (1);  VACUUM VERBOSE t; <\/code><\/pre>\n<pre><code class=\"plaintext\">INFO:  vacuuming \"demo.bookings.t\" INFO:  finished vacuuming \"demo.bookings.t\": index scans: 0 pages: 0 removed, 1 remain, 1 scanned (100.00% of total) tuples: 0 removed, 1 remain, 0 are dead but not yet removable removable cutoff: 942, older by 0 xids when operation ended new relfrozenxid: 941, which is 1 xids ahead of previous value index scan not needed: 0 pages from table (0.00% of total) had 0 dead item identifiers removed avg read rate: 79.923 MB\/s, avg write rate: 79.923 MB\/s buffer usage: 5 hits, 4 misses, 4 dirtied WAL usage: 5 records, 4 full page images, 33167 bytes system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s VACUUM <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0443\u044e\u0441\u044f \u0441 \u00abnew relfrozenxid:\u00bb. \u041f\u043e \u043d\u0435\u0439 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 relfrozenxid \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u043b\u043e\u0441\u044c \u043d\u0430 1. \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. <\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 relfrozenxid \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 pg_class. \u0422\u0435\u043f\u0435\u0440\u044c VACUUM VERBOSE, \u043a\u0430\u043a \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0436\u0443\u0440\u043d\u0430\u043b \u043f\u0440\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0438 <i>log_autovacuum_min_duration<\/i>, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 relfrozenxid.<\/p>\n<p>  <a name=\"commit_06f5295a\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3517\/\">\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u043c\u0438<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/06f5295a\">06f5295a<\/a><\/p>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 (SAVEPOINT). \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u0435\u0430\u043d\u0441\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u0435\u0448\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u043c\u0435\u0440 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. \u0427\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0435\u0436\u0435 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043b\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 SLRU, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0446\u0438\u044f (\u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f SubtransSLRULock \u0432 pg_stat_activity).<\/p>\n<p>  <a name=\"commit_04e706d4\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3392\/\">postgres_fdw: \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445<\/a><\/b><br \/>  commit:<a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/04e706d4\">04e706d4<\/a><\/p>\n<p>  \u041f\u0440\u0438 \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u043e postgres_fdw, \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442\u044c\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, \u0430 \u043d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0434\u043d\u0430 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u0439.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i>parallel_commit<\/i>:<\/p>\n<pre><code class=\"pgsql\">CREATE SERVER srv_1     FOREIGN DATA WRAPPER postgres_fdw     OPTIONS (         ...          parallel_commit true     ); <\/code><\/pre>\n<p>  \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0432 \u0442\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043e\u0434\u043d\u0443 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c <i>parallel_commit<\/i>. <\/p>\n<pre><code class=\"pgsql\">BEGIN INSERT INTO tab_srv_1; INSERT INTO tab_srv_2; INSERT INTO tab_srv_3; COMMIT; <\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440. \u0415\u0441\u043b\u0438, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0442\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0437\u0430\u043c\u0435\u0434\u043b\u0435\u043d\u0438\u044e.<\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430, \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u0442\u043c\u0435\u043d\u0443 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0438 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u043f\u0430\u0434\u0435\u0442 \u0432 16-\u044e \u0432\u0435\u0440\u0441\u0438\u044e.<\/p>\n<h3>\u0420\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0438 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>  <a name=\"commit_3500ccc3\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3600\/\">pg_basebackup &#8212;target<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/3500ccc3\">3500ccc3<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/e4ba69f3\">e4ba69f3<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/c6306db2\">c6306db2<\/a><\/p>\n<p>  \u0414\u043e 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438, \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u0430\u044f \u043a\u043e\u043f\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0430\u0441\u044c \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435, \u0442.\u0435. \u0442\u0430\u043c \u0436\u0435, \u0433\u0434\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f pg_basebackup.<\/p>\n<p>  \u041d\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 &#8212;target \u0438\u043b\u0438 -t \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0433\u0434\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u0443\u044e \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u0443\u044e \u043a\u043e\u043f\u0438\u044e (\u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u043e\u043c\u043c\u0438\u0442).<\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e client (\u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438) \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c:  <\/p>\n<ul>\n<li>server \u2015 \u043a\u043e\u043f\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/li>\n<li>blackhole \u2015 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u0430\u044f \u043a\u043e\u043f\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0439 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. <\/li>\n<\/ul>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0446\u0435\u043b\u0438 (\u0432\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043c\u043c\u0438\u0442). <\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f, \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 contrib \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u2015 <a href=\"https:\/\/www.postgresql.org\/docs\/devel\/basebackup-to-shell.html\">basebackup_to_shell<\/a> (\u0442\u0440\u0435\u0442\u0438\u0439 \u043a\u043e\u043c\u043c\u0438\u0442). \u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 shell \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 target. \u0427\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u0443\u044e \u043a\u043e\u043f\u0438\u044e \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 pg_basebackup.<\/p>\n<p>  \u041d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0440\u043e\u043c\u0435 client \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442, \u0447\u0442\u043e \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u0430\u044f \u043a\u043e\u043f\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 (\u0433\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 pg_basebackup) \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0423\u043a\u0430\u0437\u0430\u0442\u044c \u0446\u0435\u043b\u044c, \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u043e\u0442 client, \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c WAL \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b pg_basebackup, \u0442.\u0435. \u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d \u0440\u0435\u0436\u0438\u043c Xstream. <\/p>\n<p>  <a name=\"commit_d4509942\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/36\/3462\/\">pg_basebackup &#8212;compress<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/d4509942\">d4509942<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/5c649fe1\">5c649fe1<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/0ad80329\">0ad80329<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/751b8d23\">751b8d23<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/7cf085f0\">7cf085f0<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/dab29847\">dab29847<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/51c0d186\">51c0d186<\/a><\/p>\n<p>  \u0414\u043e 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 compress \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0434\u043b\u044f \u0441\u0436\u0430\u0442\u0438\u044f \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0439 \u043a\u043e\u043f\u0438\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 tar \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u043c gzip.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0436\u0430\u0442\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432. <\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0441\u0436\u0438\u043c\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043f\u0435\u0440\u0435\u0434 \u0438\u0445 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0435\u0441\u043b\u0438, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u0435\u0442\u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u0430 \u0438 \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u043e\u0436\u0435\u0440\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 \u0441\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u043a\u043e\u043f\u0438\u0438 \u043f\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u0412\u0430\u0436\u043d\u043e\u0435 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0436\u0438\u043c\u0430\u0442\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u043d\u0435 \u0444\u0430\u0439\u043b\u044b WAL. WAL \u043c\u043e\u0436\u043d\u043e \u0441\u0436\u0438\u043c\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p>  \u041f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432\u044b\u0431\u043e\u0440 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0436\u0430\u0442\u0438\u044f. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f: gzip, lz4, zstd. \u041a\u0430\u043a \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435, \u0442\u0430\u043a \u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043a\u043e\u043c\u043f\u0440\u0435\u0441\u0441\u0438\u044f zstd \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0432 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435. \u0412 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u044b\u0435 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 pg_basebackup \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0436\u0430\u0442\u0438\u044f \u0438 \u0446\u0435\u043b\u0435\u0439 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<p>  <a href=\"http:\/\/rhaas.blogspot.com\/2022\/02\/server-side-lz4-backup-compression.html\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a> \u0441\u0436\u0430\u0442\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c LZ4 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043e\u0442 \u0420\u043e\u0431\u0435\u0440\u0442\u0430 \u0425\u0430\u0430\u0441\u0430.<br \/>  <a href=\"http:\/\/rhaas.blogspot.com\/2022\/05\/parallel-server-side-backup-compression.html\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a> \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0436\u0430\u0442\u0438\u044f zstd \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043e\u0442 \u0420\u043e\u0431\u0435\u0440\u0442\u0430 \u0425\u0430\u0430\u0441\u0430.<\/p>\n<p>  <a name=\"commit_e9537321\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3557\/\">wal_compression = zstd<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/e9537321\">e9537321<\/a><\/p>\n<p>  \u0412 <a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/572782\/#commit_4035cd5d\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043e\u0431 \u0438\u044e\u043b\u044c\u0441\u043a\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0444\u0435\u0441\u0442\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u0436\u0430\u0442\u0438\u044f WAL \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e pglz, \u043d\u043e \u0438 lz4. \u042d\u0442\u043e\u0442 \u043f\u0430\u0442\u0447 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0436\u0430\u0442\u0438\u044f zstd:<\/p>\n<pre><code class=\"pgsql\">SELECT enumvals FROM pg_settings WHERE name = 'wal_compression'; <\/code><\/pre>\n<pre><code class=\"plaintext\">        enumvals         ------------------------  {pglz,lz4,zstd,on,off} <\/code><\/pre>\n<p>  \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0441\u0436\u0430\u0442\u0438\u0435 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e. \u041d\u043e \u0443 \u0442\u0435\u0445 \u043a\u043e\u043c\u0443 \u0432\u0430\u0436\u043d\u043e \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0430 \u043e\u0431\u044a\u0435\u043c\u0435 WAL, \u043f\u043e\u0436\u0435\u0440\u0442\u0432\u043e\u0432\u0430\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043d\u0430 \u0441\u0436\u0430\u0442\u0438\u0435, \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440.<\/p>\n<p>  <a name=\"commit_5ef1eefd\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3337\/\">\u041c\u043e\u0434\u0443\u043b\u0438 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438 WAL<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/5ef1eefd\">5ef1eefd<\/a><\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0433\u043e \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f WAL \u043c\u044b \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 archive_mode, \u0430 \u0432 archive_command \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 WAL \u0432 \u0430\u0440\u0445\u0438\u0432. <\/p>\n<p>  \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0431\u0435\u0437 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432. \u041f\u0440\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0447\u0430\u0441\u0442\u043e \u0438 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043d\u0430 \u043f\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u041e\u0421 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<p>  \u0412 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <a href=\"https:\/\/www.postgresql.org\/docs\/15\/archive-modules.html\">\u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438<\/a>. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b WAL \u0434\u043b\u044f \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0434\u0443\u043b\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u043e\u0432\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 <a href=\"https:\/\/www.postgresql.org\/docs\/15\/runtime-config-wal.html#GUC-ARCHIVE-LIBRARY\">archive library<\/a>. \u041e\u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. <\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 contrib, \u044d\u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 <a href=\"https:\/\/www.postgresql.org\/docs\/15\/basic-archive.html\">basic_archive<\/a>.<\/p>\n<p>  \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i>archive_library<\/i> \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d (\u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430) \u0438 \u0434\u043b\u044f \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0438\u0437 <i>archive_command<\/i>, \u043a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445.<\/p>\n<p>  <a href=\"https:\/\/www.depesz.com\/2022\/02\/06\/waiting-for-postgresql-15-allow-archiving-via-loadable-modules\/\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a> \u043e\u0442 depesz.<\/p>\n<p>  <a name=\"commit_344d62fb\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/2167\/\">\u041d\u0435\u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/344d62fb\">344d62fb<\/a><\/p>\n<p>  \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438. \u0427\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e.<\/p>\n<pre><code class=\"pgsql\">CREATE TEMP TABLE temp_table (     id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY ); SELECT relname, relkind, relpersistence FROM pg_class WHERE relname LIKE 'temp_table%'; <\/code><\/pre>\n<pre><code class=\"plaintext\">      relname      | relkind | relpersistence -------------------+---------+----------------  temp_table        | r       | t  temp_table_id_seq | S       | t  temp_table_pkey   | i       | t <\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043d\u0435\u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u0430\u044f (<strong>p<\/strong>ersistent) \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/p>\n<pre><code class=\"pgsql\">14=# CREATE UNLOGGED TABLE unlogged_table (     id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY );  14=# SELECT relname, relkind, relpersistence FROM pg_class WHERE relname LIKE 'unlogged_table%'; <\/code><\/pre>\n<pre><code class=\"plaintext\">        relname        | relkind | relpersistence -----------------------+---------+----------------  unlogged_table        | r       | u  unlogged_table_id_seq | S       | p  unlogged_table_pkey   | i       | u <\/code><\/pre>\n<p>  \u0412 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a relpersistence \u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. <\/p>\n<pre><code class=\"pgsql\">15=# CREATE UNLOGGED TABLE unlogged_table (     id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY ); 15=# SELECT relname, relkind, relpersistence FROM pg_class WHERE relname LIKE 'unlogged_table%'; <\/code><\/pre>\n<pre><code class=\"plaintext\">        relname        | relkind | relpersistence -----------------------+---------+----------------  unlogged_table        | r       | u  unlogged_table_id_seq | S       | u  unlogged_table_pkey   | i       | u <\/code><\/pre>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0435\u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u044f\u0432\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 CREATE UNLOGGED SEQUENCE.<\/p>\n<p>  \u0412\u0430\u0436\u043d\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435\u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0435 \u0440\u0435\u043f\u043b\u0438\u0446\u0438\u0440\u0443\u044e\u0442\u0441\u044f, \u0432\u0435\u0434\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u0432 WAL. \u042d\u0442\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a\u0430\u043a \u043a \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438, \u0442\u0430\u043a \u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043a \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438. (\u041f\u0430\u0442\u0447 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0431\u044b\u043b <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/2c7ea57e\">\u043e\u0442\u043c\u0435\u043d\u0435\u043d<\/a> \u0434\u043b\u044f 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438.)<\/p>\n<p>  <a name=\"commit_5dc0418f\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3397\/\">\u041f\u0440\u0435\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0430 WAL \u043f\u0440\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/5dc0418f\">5dc0418f<\/a><\/p>\n<p>  \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u0440\u0435\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0438\u0441\u043a\u043e\u0432\u0430\u044f \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u0430) \u0438 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043e \u0431\u0438\u0442\u043e\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u0435 (Bitmap Heap Scan).<\/p>\n<p>  \u0421\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0442\u043e\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0443. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 13 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437 \u043d\u0438\u0445 \u0432\u044b\u0447\u0438\u0449\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438; \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 14 \u0441\u0431\u043e\u0440 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0420\u0430\u0437\u043c\u0435\u0440 \u043f\u0440\u0435\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0434\u043b\u044f \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <i>maintenance_io_concurrency<\/i>.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0438 \u043f\u0440\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0438\u0437 \u0436\u0443\u0440\u043d\u0430\u043b\u0430: \u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0441\u043a\u043e\u0440\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f, \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0439 \u043a\u0435\u0448. \u042d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u044f \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044e.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <i>recovery_prefetch<\/i>; \u0431\u0443\u0434\u0435\u0442 \u043b\u0438 \u043e\u043d\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2015 \u0440\u0435\u0448\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u043f\u0443\u0441\u043a\u043e\u043c 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i>wal_decode_buffer_size<\/i> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a \u0434\u0430\u043b\u0435\u043a\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u0442\u044c \u0432 \u0436\u0443\u0440\u043d\u0430\u043b, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043c \u043d\u043e\u043c\u0435\u0440\u0430 \u043d\u0443\u0436\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f 512 \u041a\u0431\u0430\u0439\u0442, \u0438\u043b\u0438 64 \u0436\u0443\u0440\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b).<\/p>\n<p>  \u0414\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 pg_stat_recovery_prefetch, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0431\u044b\u043b\u043e \u043f\u0440\u0435\u0434\u0432\u044b\u0431\u0440\u0430\u043d\u043e, \u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0442 (\u0438 \u043f\u043e \u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435).<\/p>\n<p>  <a name=\"commit_0d5c3875\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3562\/\">pg_rewind: \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 &#8212;config-file<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/0d5c3875\">0d5c3875<\/a><\/p>\n<p>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u044b PostgreSQL \u0432\u044b\u043d\u043e\u0441\u044f\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 (PGDATA). \u0418 pg_rewind \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 postgresql.conf \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041d\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0443\u0442\u0438\u043b\u0438\u0442\u044b &#8212;config-file \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 postgresql.conf \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432.<\/p>\n<p>  <a name=\"commit_2258e76f\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3419\/\">\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 pg_walinspect \u2015 SQL-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c\u0443 WAL<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/2258e76f\">2258e76f<\/a><\/p>\n<p>  \u0414\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f WAL \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 pg_waldump, \u043d\u043e \u0438 SQL-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f <a href=\"https:\/\/www.postgresql.org\/docs\/devel\/pgwalinspect.html\">pg_walinspect<\/a>.<\/p>\n<pre><code class=\"pgsql\">CREATE EXTENSION pg_walinspect;  SELECT pg_current_wal_insert_lsn(); <\/code><\/pre>\n<pre><code class=\"plaintext\"> pg_current_wal_insert_lsn ---------------------------  1\/57ACBCA8 (1 row) <\/code><\/pre>\n<pre><code class=\"pgsql\">CREATE TABLE t (id int);  SELECT pg_current_wal_insert_lsn(); <\/code><\/pre>\n<pre><code class=\"plaintext\"> pg_current_wal_insert_lsn ---------------------------  1\/57ADC288 (1 row) <\/code><\/pre>\n<pre><code class=\"pgsql\">SELECT * FROM pg_get_wal_stats('1\/57ACBCA8', '1\/57ADC288') WHERE count >0; <\/code><\/pre>\n<pre><code class=\"plaintext\"> resource_manager\/record_type | count | count_percentage | record_size | record_size_percentage | fpi_size | fpi_size_percentage | combined_size | combined_size_percentage ------------------------------+-------+------------------+-------------+------------------------+----------+---------------------+---------------+--------------------------  Transaction                  |     2 |        3.7735848 |         790 |              15.259803 |        0 |                   0 |           790 |                1.1851007  Storage                      |     1 |        1.8867924 |          42 |             0.81128067 |        0 |                   0 |            42 |               0.06300536  Standby                      |     1 |        1.8867924 |          42 |             0.81128067 |        0 |                   0 |            42 |               0.06300536  Heap2                        |    19 |        35.849056 |        1980 |               38.24609 |     4760 |           7.7418513 |          6740 |                 10.11086  Heap                         |     3 |        5.6603775 |         625 |              12.072629 |        0 |                   0 |           625 |                0.9375797  Btree                        |    27 |        50.943398 |        1698 |               32.79892 |    56724 |            92.25815 |         58422 |                 87.64045 (6 rows) <\/code><\/pre>\n<p>  <a name=\"commit_127aea2a\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3565\/\">pg_waldump: \u043d\u043e\u0432\u044b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/127aea2a\">127aea2a<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/52b55684\">52b55684<\/a><\/p>\n<p>  \u041d\u043e\u0432\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u0443\u0442\u0438\u043b\u0438\u0442\u044b pg_waldump:  <\/p>\n<ul>\n<li>&#8212;relation \u2015 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f,<\/li>\n<li>&#8212;fork \u2015 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f (main, vm, fsm, init),<\/li>\n<li>&#8212;block \u2015 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430,<\/li>\n<li>&#8212;fullpage \u2015 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u043b\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 (full page writes).<\/li>\n<\/ul>\n<p>  <a name=\"commit_39969e2a\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3436\/\">\u041c\u043e\u043d\u043e\u043f\u043e\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u0430\u043b\u0435\u043d<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/39969e2a\">39969e2a<\/a><\/p>\n<p>  \u041d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u043a \u043c\u043e\u043d\u043e\u043f\u043e\u043b\u044c\u043d\u044b\u0439, \u0442\u0430\u043a \u0438 \u043d\u0435\u043c\u043e\u043d\u043e\u043f\u043e\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c. \u0417\u0430 \u0432\u044b\u0431\u043e\u0440 \u0440\u0435\u0436\u0438\u043c\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 pg_start_backup. <\/p>\n<p>  \u041c\u043e\u043d\u043e\u043f\u043e\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e (\u0441 9.6) \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c. \u0418 \u0432 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043e\u0442 \u043d\u0435\u0433\u043e \u0440\u0435\u0448\u0438\u043b\u0438 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u0432\u0441\u0435\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0435\u043c\u043e\u043d\u043e\u043f\u043e\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435. \u0412\u043c\u0435\u0441\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 pg_start_backup\/pg_stop_backup \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435: pg_backup_start\/pg_backup_stop.<\/p>\n<h3>\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f<\/h3>\n<p>  <a name=\"commit_52e4f0cd\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/2906\/\">\u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0432 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/52e4f0cd\">52e4f0cd<\/a><\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c\u044b\u0445 \u0441\u0442\u0440\u043e\u043a. <\/p>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0440\u044f\u0434 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b test \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0446\u0435 id:<\/p>\n<pre><code class=\"pgsql\">pub=# CREATE TABLE test (     id int PRIMARY KEY,      creation_date timestamptz DEFAULT now() ); pub=# INSERT INTO test VALUES (-1), (0); <\/code><\/pre>\n<p>  \u042d\u0442\u0438 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u043f\u043b\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440:<\/p>\n<pre><code class=\"pgsql\">pub=# CREATE PUBLICATION test_pub FOR TABLE test WHERE (id >= 0); <\/code><\/pre>\n<p>  <a name=\"commit_923def9a\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3230\/\">\u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/923def9a\">923def9a<\/a><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0434\u0430\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u0441\u0442\u043e\u043b\u0431\u0435\u0446 creation_date) \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 test.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e, \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0432 \u043a\u0430\u043a\u0438\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0440\u0435\u043f\u043b\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<pre><code class=\"pgsql\">pub=# DROP PUBLICATION test_pub; pub=# CREATE PUBLICATION test_pub FOR TABLE test (id) WHERE (id >= 0); pub=# \\dRp+ <\/code><\/pre>\n<pre><code class=\"plaintext\">                            Publication test_pub   Owner   | All tables | Inserts | Updates | Deletes | Truncates | Via root ----------+------------+---------+---------+---------+-----------+----------  postgres | f          | t       | t       | t       | t         | f Tables:     \"public.test\" (id) WHERE (id >= 0) <\/code><\/pre>\n<p>  \u041d\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 test \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u043c id \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e:<\/p>\n<pre><code class=\"pgsql\">sub=# CREATE TABLE test (id int PRIMARY KEY); sub=# CREATE SUBSCRIPTION test_sub        CONNECTION 'port=5415 user=postgres dbname=postgres'        PUBLICATION test_pub; <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:<\/p>\n<pre><code class=\"pgsql\">sub=# SELECT * FROM test; <\/code><\/pre>\n<pre><code class=\"plaintext\"> id ----   0 (1 row) <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 test \u043e\u0434\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c.<\/p>\n<p>  <a name=\"commit_705e20f8\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3407\/\">\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/705e20f8\">705e20f8<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/8d74fc96\">8d74fc96<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/7a850732\">7a850732<\/a><\/p>\n<p>  \u0412 \u0440\u0430\u0431\u043e\u0442\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0431\u043e\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437-\u0437\u0430 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 logical replication worker \u0437\u0430\u043f\u0438\u0448\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u0432 \u0436\u0443\u0440\u043d\u0430\u043b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f. \u041d\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0441\u044b\u043f\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u043e\u043f\u044b\u0442\u043a\u0430\u0445 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0443\u0441\u043f\u0435\u0445\u0430 \u043e\u043f\u044f\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0436\u0443\u0440\u043d\u0430\u043b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u00ab\u0437\u0430\u0441\u044b\u043f\u0430\u0442\u044c\u00bb. \u0418 \u0442\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430.<\/p>\n<p>  \u0412 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0430 \u043d\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0445 logical replication worker.<\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i>disable_on_error<\/i> (\u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438):<\/p>\n<pre><code class=\"pgsql\">sub=# ALTER SUBSCRIPTION test_sub SET (disable_on_error);  sub=# \\x \\dRs+ <\/code><\/pre>\n<pre><code class=\"plaintext\">Expanded display is on. List of subscriptions -[ RECORD 1 ]------+---------------------------------------- Name               | test_sub Owner              | postgres Enabled            | t Publication        | {test_pub} Binary             | f Streaming          | f Two phase commit   | d Disable on error   | t Synchronous commit | off Conninfo           | port=5415 user=postgres dbname=postgres Skip LSN           | 0\/0 <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 id=1 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 id \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u041f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a:<\/p>\n<pre><code class=\"pgsql\">sub=# INSERT INTO test VALUES (1); <\/code><\/pre>\n<p>  \u041d\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0434\u0432\u0443\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u0445. \u042d\u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0430\u0442\u0447\u0430:<\/p>\n<pre><code class=\"pgsql\">pub=# BEGIN; pub=# INSERT INTO test VALUES (1); pub=# INSERT INTO test VALUES (2); pub=# COMMIT;  pub=# BEGIN; pub=# INSERT INTO test VALUES (3); pub=# COMMIT; <\/code><\/pre>\n<p>  \u041d\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e\u0449\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"pgsql\">pub=# SELECT * FROM test; <\/code><\/pre>\n<pre><code class=\"plaintext\"> id |         creation_date          ----+-------------------------------  -1 | 2022-07-22 13:15:43.602303+03   0 | 2022-07-22 13:15:43.602303+03   1 | 2022-07-23 11:00:30.465183+03   2 | 2022-07-23 11:00:30.465183+03   3 | 2022-07-23 11:01:03.928878+03 <\/code><\/pre>\n<p>  \u0410 \u043d\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0435 \u0438\u0437-\u0437\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0442\u043e\u0440\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0441 id=1 \u0442\u0430\u043a \u0438 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u0432\u0435:<\/p>\n<pre><code class=\"pgsql\">sub=# SELECT * FROM test; <\/code><\/pre>\n<pre><code class=\"plaintext\"> id ----   0   1 (2 rows) <\/code><\/pre>\n<p>  \u0412 \u0436\u0443\u0440\u043d\u0430\u043b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0435:<\/p>\n<pre><code class=\"plaintext\">2022-07-23 11:00:47.977 MSK [37313] CONTEXT:  processing remote data for replication origin \"pg_32773\" during \"INSERT\" for replication target relation \"public.test\" in transaction 1618 finished at 3\/87E716B8 2022-07-23 11:00:47.978 MSK [37313] LOG:  logical replication subscription \"test_sub\" has been disabled due to an error <\/code><\/pre>\n<p>  \u2026 \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f (\u0432\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0435), \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 disable_on_conflict. <\/p>\n<pre><code class=\"pgsql\">sub=# \\dRs <\/code><\/pre>\n<pre><code class=\"plaintext\">            List of subscriptions    Name   |  Owner   | Enabled | Publication ----------+----------+---------+-------------  test_sub | postgres | f       | {test_pub} <\/code><\/pre>\n<p>  \u0412 \u043d\u043e\u0432\u043e\u043c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 pg_stat_subscription_stats \u0435\u0441\u0442\u044c \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"pgsql\">SELECT * FROM pg_stat_subscription_stats; <\/code><\/pre>\n<pre><code class=\"plaintext\"> subid | subname  | apply_error_count | sync_error_count | stats_reset -------+----------+-------------------+------------------+-------------  32773 | test_sub |                 1 |                0 | <\/code><\/pre>\n<p>  <a name=\"commit_208c5d65\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3205\/\">\u041f\u0440\u043e\u043f\u0443\u0441\u043a \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/208c5d65\">208c5d65<\/a><\/p>\n<p>  \u0414\u043b\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0435. \u042d\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430.<\/p>\n<p>  \u0414\u0440\u0443\u0433\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2015 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439. \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 ALTER SUBSCRIPTION \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 SKIP, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c LSN \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0435\u0439 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<p>  \u041a\u0430\u043a \u0443\u0437\u043d\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043d\u043e\u043c\u0435\u0440 LSN? \u041e\u043d \u0435\u0441\u0442\u044c \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0415\u0449\u0435 \u0440\u0430\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u0438\u0437 \u0436\u0443\u0440\u043d\u0430\u043b\u0430:<\/p>\n<pre><code class=\"plaintext\">2022-07-23 11:00:47.977 MSK [37313] CONTEXT:  processing remote data for replication origin \"pg_32773\" during \"INSERT\" for replication target relation \"public.test\" in transaction 1618 finished at 3\/87E716B8 <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e:<\/p>\n<pre><code class=\"pgsql\">sub=# ALTER SUBSCRIPTION test_sub SKIP (lsn = '3\/87E716B8'); <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443:<\/p>\n<pre><code class=\"pgsql\">sub=# ALTER SUBSCRIPTION test_sub ENABLE; sub=# SELECT * FROM test; <\/code><\/pre>\n<pre><code class=\"plaintext\"> id ----   0   1   3 (3 rows) <\/code><\/pre>\n<p>  \u0420\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u0443. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0435\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u043f\u0438\u0441\u044c \u0441 id=2 \u00ab\u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0430\u0441\u044c\u00bb.<\/p>\n<h3>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p>  <a name=\"commit_a0ffa885\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3413\/\">\u041f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/a0ffa885\">a0ffa885<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/3e707fbb\">3e707fbb<\/a><\/p>\n<p>  \u0423 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u043e \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0437\u0430\u0434\u0430\u0447 \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043d\u0435\u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u0440\u043e\u043b\u044f\u043c. <\/p>\n<p>  \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b GRANT, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0440\u0443\u0447\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0440\u043e\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432 \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u043e\u043c\u043c\u0438\u0442). \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 \u0441\u0435\u0430\u043d\u0441\u0435, \u043d\u043e \u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b (ALTER SYSTEM). <\/p>\n<pre><code class=\"pgsql\">CREATE ROLE alice LOGIN;  GRANT SET, ALTER SYSTEM      ON PARAMETER log_min_duration_statement, pg_stat_statements.track     TO alice; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0410\u043b\u0438\u0441\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u043c\u0435\u043b\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u0441\u0435\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u0436\u0443\u0440\u043d\u0430\u043b \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<pre><code class=\"pgsql\">\\c - alice SET log_min_duration_statement=0; <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0436\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430? \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 psql \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \\dconfig (\u0432\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043c\u043c\u0438\u0442), \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 pg_parameter_acl.<\/p>\n<pre><code class=\"pgsql\">\\dconfig+ log_min_duration_statement <\/code><\/pre>\n<pre><code class=\"plaintext\">                        List of configuration parameters          Parameter          | Value |  Type   |  Context  |  Access privileges    ----------------------------+-------+---------+-----------+----------------------  log_min_duration_statement | -1    | integer | superuser | postgres=sA\/postgres+                             |       |         |           | alice=sA\/postgres <\/code><\/pre>\n<p>  \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u0443\u044e \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 (SECURITY DEFINER), \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u043c \u0440\u043e\u043b\u044f\u043c.<\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0437\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \\dconfig \u0441\u0442\u043e\u0438\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e. \u0415\u0439 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0447\u0435\u043c SHOW \u0438\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u043a pg_settings. \u041a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0430\u0432\u0442\u043e\u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439? \u041f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"pgsql\">\\dconfig auto* <\/code><\/pre>\n<pre><code class=\"plaintext\">         List of configuration parameters                Parameter               |   Value    ---------------------------------------+-----------  autovacuum                            | on  autovacuum_analyze_scale_factor       | 0.1  autovacuum_analyze_threshold          | 50  autovacuum_freeze_max_age             | 200000000  autovacuum_max_workers                | 3  autovacuum_multixact_freeze_max_age   | 400000000  autovacuum_naptime                    | 1min  autovacuum_vacuum_cost_delay          | 2ms  autovacuum_vacuum_cost_limit          | -1  autovacuum_vacuum_insert_scale_factor | 0.2  autovacuum_vacuum_insert_threshold    | 1000  autovacuum_vacuum_scale_factor        | 0.2  autovacuum_vacuum_threshold           | 50  autovacuum_work_mem                   | -1 <\/code><\/pre>\n<p>  <a name=\"commit_7faa5fc8\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3466\/\">\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/7faa5fc8\">7faa5fc8<\/a><\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0443 SECURITY INVOKER \u0438\u043b\u0438 SECURITY DEFINER, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0443\u044e \u0441 \u0447\u044c\u0438\u043c\u0438 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f SECURITY INVOKER, \u0442.\u0435. \u0431\u0435\u0437 \u044f\u0432\u043d\u044b\u0445 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u043f\u043e\u0434\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e.<\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430. \u0418 \u0434\u043e 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044e flights_v \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e alice \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438:<\/p>\n<pre><code class=\"pgsql\">CREATE ROLE alice LOGIN; GRANT USAGE ON SCHEMA bookings TO alice; GRANT SELECT ON flights_v TO alice; <\/code><\/pre>\n<pre><code class=\"pgsql\">alice=> SELECT count(*) FROM flights_v; <\/code><\/pre>\n<pre><code class=\"plaintext\"> count   --------  214867 <\/code><\/pre>\n<p>  \u0412 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e. \u041c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445:<\/p>\n<pre><code class=\"pgsql\">\\c - postgres ALTER VIEW flights_v SET (security_invoker = true);  \\c - alice alice=> SELECT count(*) FROM flights_v; <\/code><\/pre>\n<pre><code class=\"plaintext\">ERROR:  permission denied for table flights <\/code><\/pre>\n<p>  <a href=\"https:\/\/www.depesz.com\/2022\/03\/22\/waiting-for-postgresql-15-add-support-for-security-invoker-views\/\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/a> \u043e\u0442 depesz.<\/p>\n<p>  <a name=\"commit_79de9842\"><\/a><b><a href=\"https:\/\/www.postgresql.org\/message-id\/flat\/CA%2BTgmoawdt03kbA%2BdNyBcNWJpRxu0f4X%3D69Y3%2BDkXXZqmwMDLg%40mail.gmail.com#8d28970dcb457f18b144ebfe58b207c7\">\u041e\u0431\u044b\u0447\u043d\u0430\u044f \u0440\u043e\u043b\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 ADMIN OPTION \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u0441\u0435\u0431\u044f<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/79de9842\">79de9842<\/a><\/p>\n<p>  \u0417\u0430 \u0442\u0443\u043c\u0430\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435. \u0420\u043e\u043b\u044c \u0441 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0435\u0439 LOGIN \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u043e\u043b\u0435\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u0432\u0435 \u0440\u043e\u043b\u0438 \u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u043b alice \u0432 bob:<\/p>\n<pre><code class=\"pgsql\">CREATE ROLE alice LOGIN; CREATE ROLE bob LOGIN; GRANT alice TO bob; \\du alice|bob <\/code><\/pre>\n<pre><code class=\"plaintext\">           List of roles  Role name | Attributes | Member of -----------+------------+-----------  alice     |            | {}  bob       |            | {alice} <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c alice \u0445\u043e\u0447\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0435\u0431\u044f \u0438\u0437 \u0440\u043e\u043b\u0438 bob. \u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 14-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438:<\/p>\n<pre><code class=\"pgsql\">alice(14)=> REVOKE alice FROM bob; <\/code><\/pre>\n<pre><code class=\"plaintext\">REVOKE ROLE <\/code><\/pre>\n<pre><code class=\"pgsql\">alice(14)=> \\du alice|bob <\/code><\/pre>\n<pre><code class=\"plaintext\">           List of roles  Role name | Attributes | Member of -----------+------------+-----------  alice     |            | {}  bob       |            | {} <\/code><\/pre>\n<p>  \u0422\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0432 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438:<\/p>\n<pre><code class=\"pgsql\">alice(15)=> REVOKE alice FROM bob; <\/code><\/pre>\n<pre><code class=\"plaintext\">ERROR:  must have admin option on role \"alice\" <\/code><\/pre>\n<p>  \u0411\u043e\u043b\u044c\u0448\u0435 alice \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0435\u0431\u044f \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u043e\u043b\u0435\u0439.<\/p>\n<p>  \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e \u043a\u043e\u043c\u043c\u0438\u0442\u0435, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043b\u044e\u0431\u043e\u0439 \u0440\u043e\u043b\u0438 \u0435\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0434\u0430\u0432\u0430\u043b\u0430\u0441\u044c ADMIN OPTION \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u0441\u0435\u0431\u044f. \u0418 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0434\u0430\u0432\u043d\u043e \u0438 \u043d\u0435\u043f\u0440\u0435\u0434\u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u043d\u0435\u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0430\u044f \u0440\u043e\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0440\u0443\u0448\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0439 \u0432\u044b\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. \u041e\u0431\u044b\u0447\u043d\u043e \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 alice \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u0440\u043e\u043b\u0438 \u0431\u0435\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 LOGIN, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0438\u043c\u0435\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f, \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438 REVOKE. \u0412\u0438\u0434\u0438\u043c\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0433\u043e \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<h3>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>  <a name=\"commit_f2553d43\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/2256\/\">ICU \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/f2553d43\">f2553d43<\/a><\/p>\n<p>  \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 ICU \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438, \u043d\u043e \u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0432\u0441\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<pre><code class=\"pgsql\">CREATE DATABASE db     LOCALE_PROVIDER = icu     ICU_LOCALE = 'ru-x-icu'     TEMPLATE = template0; <\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0435\u0441\u0442\u044c \u0438 \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430.<\/p>\n<pre><code class=\"plaintext\">$ initdb --help | grep icu       --icu-locale=LOCALE   set ICU locale ID for new databases       --locale-provider={libc|icu} <\/code><\/pre>\n<p>  \u041d\u043e\u0432\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b datlocprovider, daticulocale \u0432 pg_database \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u043c \u0434\u043b\u044f \u0411\u0414 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0435 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 ICU. \u041e\u043d\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \\list \u0432 psql:<\/p>\n<pre><code class=\"pgsql\">\\list db <\/code><\/pre>\n<pre><code class=\"plaintext\">                                             List of databases  Name |  Owner   | Encoding |   Collate   |    Ctype    | ICU Locale | Locale Provider | Access privileges ------+----------+----------+-------------+-------------+------------+-----------------+-------------------  db   | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | ru-x-icu   | icu             | <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b\u0439 \u0438 \u0434\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0442\u0447. \u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 ICU \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 libc. \u0411\u0443\u0434\u044c \u0442\u043e \u0441\u043c\u0435\u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u0438 libc \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443.<\/p>\n<p>  <a name=\"commit_37851a8b\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3526\/\">\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0439 \u043f\u0440\u0430\u0432\u0438\u043b \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0434\u043b\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/37851a8b\">37851a8b<\/a><\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u043e\u043c\u0435\u0440\u0430 \u0432\u0435\u0440\u0441\u0438\u0438 \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 pg_collation. \u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0438 \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"pgsql\">SELECT datname,        pg_database_collation_actual_version(oid) actual_version,        datcollversion,        datlocprovider FROM pg_database; <\/code><\/pre>\n<pre><code class=\"plaintext\">  datname  | actual_version | datcollversion | datlocprovider -----------+----------------+----------------+----------------  postgres  | 2.31           | 2.31           | c  demo      | 2.31           | 2.31           | c  template1 | 2.31           | 2.31           | c  template0 | 2.31           |                | c  db        | 153.14.36.8    | 153.14.36.8    | i (5 rows) <\/code><\/pre>\n<p>  \u041d\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f pg_database_collation_actual_version \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u0410 \u043d\u043e\u0432\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b ALTER DATABASE\u2026 REFRESH COLLATION VERSION \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u043c\u0443\u044e \u0432 pg_database \u0432\u0435\u0440\u0441\u0438\u044e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p>  <a name=\"commit_38bfae36\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3453\/\">pg_upgrade: \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/38bfae36\">38bfae36<\/a><\/p>\n<p>  pg_upgrade \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0431\u043e\u044f \u0438\u043b\u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c &#8212;retain \u0432\u0441\u0435 \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0442\u0430\u043a \u0438 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0434\u043b\u044f \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c. <\/p>\n<p>  \u0412 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 pg_upgrade_output.d, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c \u0432 PGDATA \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0411\u0414.<\/p>\n<p>  <a name=\"commit_9a974cbc\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3296\/\">pg_upgrade: \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u043d \u0444\u0430\u0439\u043b\u043e\u0432 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432 \u0438 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/9a974cbc\">9a974cbc<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/aa010514\">aa010514<\/a><\/p>\n<p>  \u0423\u0442\u0438\u043b\u0438\u0442\u0430 pg_upgrade \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b pg_database.oid, pg_tablespace.oid \u0438 pg_class.relfilenode. \u0410 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u0434\u043b\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439 \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u043f\u0440\u0435\u0436\u043d\u0438\u043c\u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>  <a name=\"commit_9c08aea6\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3192\/\">CREATE DATABASE \u0441 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432 WAL<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/9c08aea6\">9c08aea6<\/a><\/p>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0441\u0431\u043e\u0439. \u041a\u0430\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430? <\/p>\n<p>  \u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b CREATE DATABASE \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430, \u0437\u0430\u0442\u0435\u043c \u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u044b \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e template1), \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0444\u0430\u0439\u043b\u044b \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0431\u043e\u044f \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u043d\u0430 \u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u043b\u0433\u0430\u044f \u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0435\u043c\u043a\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0435\u0451, \u0432 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0439 \u0431\u0430\u0437\u044b, \u0441 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432 WAL. \u0418 \u044d\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 WAL \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0441\u0431\u043e\u0435.<\/p>\n<p>  \u0412\u0441\u0451 \u0431\u044b \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u0441\u0442\u0430\u0440\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0441 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0430\u0439\u043b\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430. \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0435\u0435, \u0432\u0435\u0434\u044c \u0432 WAL \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043c\u0435\u043d\u044c\u0448\u0435.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0438 \u00ab\u043f\u043e-\u0441\u0442\u0430\u0440\u0438\u043d\u043a\u0435\u00bb, \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0432 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e FILE_COPY:<\/p>\n<pre><code class=\"pgsql\">CREATE DATABASE new_db WITH strategy=FILE_COPY; <\/code><\/pre>\n<p>  <a name=\"commit_a2c84990\"><\/a><b><a href=\"https:\/\/commitfest.postgresql.org\/37\/3602\/\">\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 pg_ident_file_mappings<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/a2c84990\">a2c84990<\/a><\/p>\n<p>  \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 pg_ident.conf \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044e pg_ident_file_mappings.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c SQL-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e \u0432\u0441\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u0430\u043c. \u0412 \u0432\u0435\u0440\u0441\u0438\u0438 9.5 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 pg_file_settings \u0434\u043b\u044f postgresql.conf \u0438 postgresql.auto.conf. \u0410 \u0432 10-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 pg_hba_file_rules \u0434\u043b\u044f pg_hba.conf.<\/p>\n<p>  <a name=\"commit_76a29ade\"><\/a><b><a href=\"https:\/\/www.postgresql.org\/message-id\/flat\/20211031184548.g4sxfe47n2kyi55r%40alap3.anarazel.de\">\u041f\u0440\u0435\u043a\u0440\u0430\u0449\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Python<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/76a29ade\">76a29ade<\/a><\/p>\n<p>  \u0425\u0440\u0430\u043d\u0438\u043c\u044b\u0435 \u043f\u043e\u0434\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 Python \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 plpython3u. plpython2u \u0438 plpythonu \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b. <\/p>\n<h3>\u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>  <a name=\"commit_7844c991\"><\/a> <b><a href=\"https:\/\/commitfest.postgresql.org\/37\/2096\/\">psql: \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/a><\/b><br \/>  commit: <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/7844c991\">7844c991<\/a><\/p>\n<p>  \u042d\u0442\u043e\u0442 \u043f\u0430\u0442\u0447 \u0443\u0441\u043f\u0435\u043b <a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/550632#commit_fae65629\">\u043f\u043e\u043f\u0430\u0441\u0442\u044c<\/a> \u0435\u0449\u0435 \u0432 14-\u044e \u0432\u0435\u0440\u0441\u0438\u044e, \u043d\u043e \u043f\u043e\u0437\u0436\u0435 \u0431\u044b\u043b \u043e\u0442\u043c\u0435\u043d\u0435\u043d. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0440\u0435\u0447\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e psql \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430 \u0440\u0430\u0437:<\/p>\n<pre><code class=\"pgsql\">=# SELECT 1\\; SELECT 2; <\/code><\/pre>\n<pre><code class=\"plaintext\"> ?column? ----------         1 (1 row)   ?column? ----------         2 (1 row) <\/code><\/pre>\n<p>  \u0420\u0430\u043d\u044c\u0448\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<hr\/>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0451. \u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0415\u0433\u043e\u0440\u0443 \u0420\u043e\u0433\u043e\u0432\u0443 \u0437\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u0418 \u0436\u0434\u0435\u043c \u043e\u0441\u0435\u043d\u044c\u044e \u0432\u044b\u0445\u043e\u0434 15-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. <\/p>\n<p>  \u0410 \u0432 \u043a\u043e\u043d\u0446\u0435 \u044d\u0442\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u043e\u043c\u043c\u0438\u0442\u0444\u0435\u0441\u0442 16-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442!<\/p><\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/679264\/\"> https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/679264\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u043c\u0430\u0440\u0442\u043e\u0432\u0441\u043a\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0444\u0435\u0441\u0442\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0441\u0435\u0440\u0438\u044e \u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u0432 PostgreSQL 15. <\/p>\n<p>  \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u044b \u043f\u0435\u0440\u0432\u044b\u043c \u0447\u0435\u0442\u044b\u0440\u0435\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0444\u0435\u0441\u0442\u0430\u043c: <a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/572782\/\">2021-07<\/a>,<a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/583070\/\"> 2021-09<\/a>,<a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/596567\/\"> 2021-11<\/a>, <a href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/651143\/\">2022-01<\/a>.<\/p>\n<p>  \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0443\u0436\u0435 <a href=\"https:\/\/www.postgresql.org\/about\/news\/postgresql-15-beta-2-released-2479\/\">\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430<\/a> \u0432\u0442\u043e\u0440\u0430\u044f \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u044f PostgreSQL 15. \u0412\u0441\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u043d\u0438\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e.  <\/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-336259","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336259","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=336259"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336259\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}