{"id":473573,"date":"2025-09-02T16:58:22","date_gmt":"2025-09-02T16:58:22","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=473573"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=473573","title":{"rendered":"<span>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0432 PostgreSQL<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 PostgreSQL \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043e 13 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0442\u0441\u044f <code>pg_attribute<\/code>,\u00a0<code>pg_class<\/code>, <code>pg_depend<\/code>\u00a0\u0438 <code>pg_type<\/code>. \u041c\u0430\u0441\u0441\u043e\u0432\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432 1C:ERP. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0432 \u0421\u0423\u0411\u0414 Tantor Postgres. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 17.5, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f. \u041d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438\u00a0<code>enable_temp_memory_catalog<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0443\u0440\u043e\u0432\u043d\u044f\u0445, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0435\u0441\u0441\u0438\u0438, \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430.<\/p>\n<h2>\u0420\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0432 PostgreSQL<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439 \u0432 PostgreSQL \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430. \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0438 \u043d\u0435\u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435, \u043c\u043e\u0433\u0443\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u044b. \u0412 \u043e\u0431\u0449\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044e\u0442 \u0434\u043e 13 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430. \u0427\u0438\u0441\u043b\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0441\u0442\u0440\u043e\u043a \u0432 \u044d\u0442\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043f\u0440\u043e\u0441<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>select &#8216;pg_class&#8217; table, pg_total_relation_size(&#8216;pg_class&#8217;) size, count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_class union all<\/strong><\/p>\n<p><strong>select &#8216;pg_attribute&#8217;, pg_total_relation_size(&#8216;pg_attribute&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_attribute union all<\/strong><\/p>\n<p><strong>select &#8216;pg_type&#8217;, pg_total_relation_size(&#8216;pg_type&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_type union all<\/strong><\/p>\n<p><strong>select &#8216;pg_depend&#8217;, pg_total_relation_size(&#8216;pg_depend&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_depend union all<\/strong><\/p>\n<p><strong>select &#8216;pg_inherits&#8217;, pg_total_relation_size(&#8216;pg_inherits&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_inherits union all<\/strong><\/p>\n<p><strong>select &#8216;pg_statistic&#8217;, pg_total_relation_size(&#8216;pg_statistic&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_statistic union all<\/strong><\/p>\n<p><strong>select &#8216;pg_attrdef&#8217;, pg_total_relation_size(&#8216;pg_attrdef&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_attrdef union all<\/strong><\/p>\n<p><strong>select &#8216;pg_collation&#8217;, pg_total_relation_size(&#8216;pg_collation&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_collation union all<\/strong><\/p>\n<p><strong>select &#8216;pg_constraint&#8217;, pg_total_relation_size(&#8216;pg_constraint&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_constraint union all<\/strong><\/p>\n<p><strong>select &#8216;pg_description&#8217;, pg_total_relation_size(&#8216;pg_description&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_description union all<\/strong><\/p>\n<p><strong>select &#8216;pg_index&#8217;, pg_total_relation_size(&#8216;pg_index&#8217;), count(*) from<\/strong><\/p>\n<p><strong>\u00a0pg_index union all<\/strong><\/p>\n<p><strong>select &#8216;pg_namespace&#8217;, pg_total_relation_size(&#8216;pg_namespace&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_namespace union all<\/strong><\/p>\n<p><strong>select &#8216;pg_sequence&#8217;, pg_total_relation_size(&#8216;pg_sequence&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_sequence;<\/strong><\/p>\n<\/div>\n<\/details>\n<p><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/strong><\/p>\n<pre><code class=\"bash\">\u00a0\u00a0\u00a0\u00a0 table\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 size\u00a0\u00a0\u00a0 | count ----------------+------------+-------\u00a0 pg_sequence\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8192 |\u00a0\u00a0\u00a0\u00a0 0\u00a0 pg_attrdef\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 24576 |\u00a0\u00a0\u00a0\u00a0 0\u00a0 pg_inherits\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 16384 |\u00a0\u00a0\u00a0\u00a0 0\u00a0 pg_namespace\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 57344 |\u00a0\u00a0 102\u00a0 pg_constraint\u00a0 |\u00a0\u00a0\u00a0\u00a0 114688 |\u00a0\u00a0 114\u00a0 pg_index\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 65536 |\u00a0\u00a0 168\u00a0 pg_collation\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 229376 |\u00a0\u00a0 822\u00a0 pg_description |\u00a0\u00a0\u00a0\u00a0 565248 |\u00a0 5233\u00a0 pg_statistic\u00a0\u00a0 |\u00a0\u00a0\u00a0 2187264 |\u00a0\u00a0 416\u00a0 pg_class\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0 542957568 |\u00a0\u00a0 428\u00a0 pg_attribute\u00a0\u00a0 | 3064348672 |\u00a0 3195\u00a0 pg_depend\u00a0\u00a0\u00a0\u00a0\u00a0 | 1002225664 |\u00a0 1808\u00a0 pg_type\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | 1000480768 |\u00a0\u00a0 637 (13 rows)<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0442\u0435\u0441\u0442 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u043e\u043a \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0440\u0443\u0433\u0438\u0445. \u0414\u043b\u044f \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0437\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0431\u0443\u0444\u0435\u0440\u043d\u043e\u0433\u043e \u043a\u044d\u0448\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435:<\/p>\n<pre><code>postgres=#\u00a0create extension pg_buffercache; CREATE EXTENSION<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0440\u043e\u043a \u0440\u0430\u0437\u043c\u0435\u0440 \u044d\u0442\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446.<\/p>\n<pre><code class=\"bash\">postgres@tantor:~$ cat gen2.pydef main():\u00a0\u00a0\u00a0  for count in [100]:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  with open(f'workl1c_{count}.sql', 'w') as f:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  for i in range(1, count):\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  f.write(f\"\"\"create temporary table ttt{i} (c int); drop table ttt{i}; \"\"\") if __name__ == \"__main__\": main()<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u0442\u0435\u0441\u0442\u0430 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c workl1c_100.sql:<\/p>\n<pre><code class=\"bash\">postgres@tantor:~$ python3 gen2.py<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043d\u0435 \u043e\u0447\u0438\u0449\u0430\u043b\u0438\u0441\u044c, \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442 \u0431\u0430\u0437\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0435\u0441\u0441\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432 \u043d\u0435\u0439 \u043b\u044e\u0431\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">postgres=# begin; create temporary table xt (n int); BEGIN; CREATE TABLE<\/code><\/pre>\n<p>\u0410\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c, \u043f\u0440\u0438 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0438 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0442\u0440\u043e\u043a. \u0414\u043b\u044f \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0437\u0430 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u043e\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440: <\/p>\n<pre><code class=\"bash\">postgres=# alter system set log_autovacuum_min_duration = '1s'; select pg_reload_conf();  pg_reload_conf ----------------  t (1 row) ALTER SYSTEM<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043a\u0443\u0443\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u0442 \u043e\u0434\u043d\u0443 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043b\u043e\u0433\u0435.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"bash\">postgres@tantor:~$ cat $PGDATA\/postgresql.auto.conf # Do not edit this file manually! # It will be overwritten by the ALTER SYSTEM command. max_connections = '1000' shared_preload_libraries = 'pg_stat_statements' logging_collector = 'on' log_filename = 'postgresql-%F.log' log_autovacuum_min_duration = '1s'<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 pgbench:<\/p>\n<pre><code>postgres@tantor:~$ pgbench -n -T 10000 -c 16 -P 60 -f workl1c_100.sql\\ progress: 60.0 s, 19.8 tps, lat 798.487 ms stddev 97.788, 0 failed progress: 120.0 s, 16.0 tps, lat 1000.391 ms stddev 100.195, 0 failed ... progress: 2340.0 s, 2.2 tps, lat 7131.160 ms stddev 1289.401, 0 failed progress: 2400.0 s, 2.2 tps, lat 7343.940 ms stddev 1204.763, 0 failed<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435\u00a0tps \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0444\u0435\u0440\u043d\u043e\u0433\u043e \u043a\u044d\u0448\u0430. \u041f\u043e \u043c\u0435\u0440\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0438\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u0432\u044b\u0442\u0435\u0441\u043d\u044f\u0442\u044c \u0438\u0437 \u043a\u044d\u0448\u0430 \u0431\u043b\u043e\u043a\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0439 \u043a\u044d\u0448 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u043c:  <\/p>\n<pre><code class=\"bash\">postgres=# select * from pg_buffercache_usage_counts();  usage_count | buffers | dirty | pinned -------------+---------+-------+--------            0 |     776 |    71 |      0            1 |     833 |    85 |      1            2 |    1134 |   102 |      0            3 |     801 |    26 |      0            4 |    2758 |    28 |      0            5 |   10082 |   139 |      1 (6 rows)<\/code><\/pre>\n<p>\u0420\u0430\u0437\u043c\u0435\u0440\u044b \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0438\u0441\u044c: <\/p>\n<pre><code class=\"bash\">     table      |   size    | count ----------------+-----------+-------  pg_class       | 161521664 |   431  pg_type        | 293175296 |   637  pg_depend      | 298180608 |  1836  pg_attribute   | 899604480 |  3251 (13 rows)<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0435\u0441\u0442, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0437\u0430\u043d\u043e\u0432\u043e, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f tps \u0432\u0435\u0440\u043d\u0443\u0442\u0441\u044f \u043a \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0442\u0435\u0441\u0442\u0430 bgwriter \u0443\u0441\u043f\u0435\u0432\u0430\u0435\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u0431\u0443\u0444\u0435\u0440\u044b (\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0440\u0430\u0437\u043c\u044b\u0448\u043b\u044f\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u0438 \u044d\u0442\u043e \u0442\u0430\u043a):  <\/p>\n<pre><code class=\"bash\">postgres=# select * from pg_buffercache_usage_counts();  usage_count | buffers | dirty | pinned -------------+---------+-------+--------            0 |   15946 |     0 |      0            1 |     242 |    81 |      0            2 |       9 |     0 |      0            3 |       9 |     0 |      0            4 |     174 |    25 |      0            5 |       4 |     2 |      0 (6 rows)<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043d\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442\u0441\u044f, \u0430 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0434\u0430\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440, \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0436\u043d\u0438\u043c. \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442\u0441\u044f:  <\/p>\n<pre><code class=\"bash\">progress: 60.0 s, 18.9 tps, lat 841.028 ms stddev 95.998, 0 failed progress: 120.0 s, 15.4 tps, lat 1038.162 ms stddev 107.813, 0 failed progress: 180.0 s, 13.1 tps, lat 1218.092 ms stddev 119.285, 0 failed progress: 240.0 s, 11.7 tps, lat 1370.945 ms stddev 97.170, 0 failed ... progress: 7380.0 s, 1.0 tps, lat 15925.498 ms stddev 2271.770, 0 failed progress: 7440.0 s, 1.0 tps, lat 16131.646 ms stddev 2646.911, 0 failed progress: 7500.0 s, 0.9 tps, lat 16450.132 ms stddev 3068.155, 0 failed<\/code><\/pre>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0435 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u0430 \u0438 \u0430\u0432\u0442\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441\u043f\u0443\u0441\u0442\u044f 6000 \u0441\u0435\u043a\u0443\u043d\u0434:  <\/p>\n<pre><code class=\"bash\">postgres@tantor:~$ cat $PGDATA\/log\/postgresql*  10:06:58.014 MSK [24548] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_class\"  elapsed: 2.59 s  10:07:27.693 MSK [24551] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_attribute\": index scans: 0  tuples: 0 removed, 19759720 remain, 19759694 are dead but not yet removable, oldest xmin: 13261300 elapsed: 35.63 s  10:07:29.844 MSK [24551] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_attribute\" elapsed: 2.15 s  10:07:40.733 MSK [24551] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_depend\": index scans: 0  removable cutoff: 13261300, which was 5661621 XIDs old when operation ended elapsed: 10.87 s  10:07:43.996 MSK [24551] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_depend\" elapsed: 3.26 s  10:07:49.832 MSK [24554] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_type\": index scans: 0  tuples: 0 removed, 5659547 remain, 5658922 are dead but not yet removable, oldest xmin: 13261300 elapsed: 17.41 s  10:07:52.590 MSK [24551] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_class\": index scans: 0 elapsed: 8.57 s  10:07:52.891 MSK [24554] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_type\" elapsed: 3.05 s  10:07:55.511 MSK [24551] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_class\" elapsed: 2.92 s<\/code><\/pre>\n<p>\u041c\u044b \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u0437\u0434\u0435\u0441\u044c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043b\u043e\u0433\u0430. \u041f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e\u00a0elapsed\u00a0\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u0440\u0430\u0442\u0438\u0442 \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u2014\u00a0pg_attribute,\u00a0pg_type,\u00a0pg_depend. \u0415\u0441\u043b\u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u0442\u0440\u0430\u0442\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0432\u043f\u0443\u0441\u0442\u0443\u044e, \u0440\u0430\u0441\u0445\u043e\u0434\u0443\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u044b.<\/p>\n<p>\u0426\u0438\u043a\u043b \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u0430 \u0438 \u0430\u0432\u0442\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u043b\u0438\u043b\u0441\u044f \u0431\u043e\u043b\u0435\u0435 70 \u0441\u0435\u043a\u0443\u043d\u0434, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043d\u0435 \u0431\u044b\u043b\u043e \u2014 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u043d\u0435 \u043c\u043e\u0433 \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u0437-\u0437\u0430 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430. \u0426\u0438\u043a\u043b\u044b \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u0430 \u0438 \u0430\u0432\u0442\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u043c\u0435\u0436\u0434\u0443 \u0446\u0438\u043a\u043b\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435\u0432\u0435\u043b\u0438\u043a\u0430 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c\u00a0autovacuum_naptime = 1min.<\/p>\n<p>\u041d\u0430\u0431\u043e\u0440 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<pre><code class=\"bash\">autovacuum_vacuum_cost_delay          | 2ms autovacuum_vacuum_cost_limit          | -1 vacuum_cost_delay                     | 0 vacuum_cost_limit                     | 200<\/code><\/pre>\n<p>\u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u043c\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439, \u0438 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u0430 \u0438 \u0430\u0432\u0442\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0441\u0434\u0432\u0438\u0433 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430 \u0431\u0430\u0437\u044b. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u0438 \u0430\u0432\u0442\u043e\u0430\u043d\u0430\u043b\u0438\u0437 \u043c\u043e\u0433\u0443\u0442 \u0441\u0430\u043c\u0438 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442, \u0447\u0442\u043e \u043d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e.  <\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u0430. \u0423\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">postgres=# alter system set autovacuum_vacuum_cost_delay=0; select pg_reload_conf();<\/code><\/pre>\n<p>\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u0430\u043a\u0443\u0443\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u0441\u044f:<\/p>\n<pre><code class=\"bash\">10:15:00.457 MSK [24588] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_depend\": index scans: 0 elapsed: 6.69 s 10:15:01.999 MSK [24588] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_depend\" elapsed: 1.54 s 10:15:04.983 MSK [24588] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_class\": index scans: 0 elapsed: 2.96 s 10:15:31.568 MSK [24595] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_type\": index scans: 0 elapsed: 6.74 s 10:15:32.864 MSK [24595] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_type\" elapsed: 1.28 s 10:15:50.476 MSK [24595] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_attribute\": index scans: 0 elapsed: 17.59 s 10:15:51.878 MSK [24595] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_attribute\" elapsed: 1.40 s<\/code><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u0430\u043a\u0443\u0443\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b\u00a0pg_attribute\u00a0\u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u043e\u0441\u044c \u0441 35 \u0434\u043e 17 \u0441\u0435\u043a\u0443\u043d\u0434. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043f\u043e\u043a\u0430 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442 \u0431\u0430\u0437\u044b, \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u043f\u0443\u0441\u0442\u0443\u044e \u2014 \u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0447\u0438\u0449\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0442\u0440\u043e\u043a. \u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u043d\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0443\u0434\u0430\u0441\u0442\u0441\u044f \u043b\u0438 \u0435\u043c\u0443 \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0445\u043e\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0447\u0430\u0441\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u0439 \u0441\u0442\u0440\u043e\u043a.\u00a0\u0410\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u043c\u043e\u0433 \u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0441\u0434\u0432\u0438\u043d\u0443\u043b\u0441\u044f \u043b\u0438 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442 \u0431\u0430\u0437\u044b \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0446\u0438\u043a\u043b\u043e\u043c, \u043d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0446\u0438\u043a\u043b\u044b \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b, \u0438 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442 \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0435\u0440\u0441\u0438\u0439 \u0441\u0442\u0440\u043e\u043a, \u0432\u044b\u0448\u0435\u0434\u0448\u0438\u0445 \u0437\u0430 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0441\u0434\u0432\u0438\u0433\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u043e\u043a. <\/p>\n<\/p>\n<h2>\u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446<\/h2>\n<h4>\u041a\u043e\u0433\u0434\u0430 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0435\u0432\u0435\u043b\u0438\u043a\u043e<\/h4>\n<p>\u0420\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f relations:<\/p>\n<pre><code class=\"bash\">postgres=# \\timing on \\\\ Timing is on. postgres=# create temp table aaa (x int); CREATE TABLE Time: 15.370 ms postgres=# create table aaa1 (x int); CREATE TABLE Time: 1.750 ms<\/code><\/pre>\n<p>\u0422\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<h4>\u041a\u043e\u0433\u0434\u0430 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e<\/h4>\n<p>\u0412 \u0445\u043e\u0434\u0435 \u0442\u0435\u0441\u0442\u0430 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"bash\">explain (analyze, buffers) SELECT n.nspname, c.relname ROM pg_catalog.pg_class c  LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace  LEFT JOIN pg_catalog.pg_am am ON am.oid = c.relam WHERE n.nspname &lt;&gt; 'pg_catalog';    -&gt;  Bitmap Heap Scan on pg_class c  (cost=165.17..491.18 rows=86 width=72) (actual time=179.958..179.967 rows=1 loops=135)                Buffers: shared hit=2707 read=547283 written=5695  Planning Time: 13.527 ms  Execution Time: 24299.326 ms (17 rows) Time: 24319.014 ms (00:24.319)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0442\u0435\u0441\u0442\u0430:<\/p>\n<pre><code class=\"bash\">  -&gt;  Bitmap Heap Scan on pg_class c  (cost=166.25..747.37 rows=161 width=72) (actual time=24.597..24.599 rows=1 loops=135)          Buffers: shared hit=556152 read=106322 dirtied=53 written=187  Planning Time: 3.363 ms  Execution Time: 3324.657 ms Time: 3333.285 ms (00:03.333)<\/code><\/pre>\n<h2>\u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u044d\u0448\u0430 Linux \u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0440\u0430\u0437\u0434\u0443\u0442\u044b\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430<\/h2>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0437\u0430\u043c\u0435\u0434\u043b\u0438\u0442\u0441\u044f:<\/p>\n<pre><code class=\"bash\">  -&gt;  Bitmap Heap Scan on pg_class c  (cost=165.78..681.47 rows=141 width=72) (actual time=49.566..49.568 rows=1 loops=135)          Buffers: shared hit=556164 read=106310 written=10  Planning Time: 7.597 ms  Execution Time: 6695.839 ms Time: 6715.433 ms (00:06.715)<\/code><\/pre>\n<p>\u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0432\u044b\u0442\u0435\u0441\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0438\u0437 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u044d\u0448\u0430 Linux, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 PostgreSQL.<\/p>\n<h2>\u041f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430<\/h2>\n<p>\u041d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u043d\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u043d\u044f\u0442\u0438\u044f \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430 \u0438 \u0432\u0430\u043a\u0443\u0443\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0444\u0430\u0439\u043b\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446 \u0442\u0430\u043a\u0436\u0435 \u043d\u0438\u0437\u043a\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f, \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u0431\u043b\u0438\u0436\u0435 \u043a \u043a\u043e\u043d\u0446\u0443 \u0444\u0430\u0439\u043b\u043e\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c.<\/p>\n<p>\u0414\u043e \u0441\u043d\u044f\u0442\u0438\u044f \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u0432\u0435\u043b\u0438\u043a\u043e:<\/p>\n<pre><code class=\"bash\">postgres=# \\timing on \\\\ Timing is on. postgres=# explain (analyze, buffers) select 'pg_attribute', pg_total_relation_size('pg_attribute'), count(*) from pg_attribute;          Buffers: shared hit=6 read=598191  Planning Time: 0.084 ms  Execution Time: 39773.733 ms Time: 39774.720 ms (00:39.775)<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 TSC \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u043c \u0440\u0430\u0441\u0445\u043e\u0434\u0430\u043c \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0442 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\u00a0explain(analyse)\u00a0\u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 \u0442\u0440\u0438 \u0440\u0430\u0437\u0430. \u0411\u0435\u0437 \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442:  <\/p>\n<pre><code class=\"bash\">postgres=# explain (analyze, buffers, timing off) select 'pg_attribute', pg_total_relation_size('pg_attribute'), count(*) from pg_attribute;          Buffers: shared hit=1 read=598196  Planning Time: 0.065 ms  Execution Time: 12976.249 ms Time: 12976.864 ms (00:12.977)<\/code><\/pre>\n<p>\u0420\u0430\u0437\u043c\u0435\u0440\u044b \u0442\u0430\u0431\u043b\u0438\u0446 \u043f\u043e\u0441\u043b\u0435 10 000 \u0441\u0435\u043a\u0443\u043d\u0434 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0435\u0441\u0442\u0430:<\/p>\n<pre><code class=\"bash\">     table      |    size    | count ----------------+------------+-------  pg_class       | 1041825792 |   425  pg_attribute   | 5905104896 |  3171  pg_depend      | 1936924672 |  1796  pg_type        | 1891008512 |   627 (13 rows) Time: 30579.073 ms (00:30.579)<\/code><\/pre>\n<p>\u041f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u00a0pg_attribute\u00a0\u0438\u00a0pg_class\u00a0\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445. \u0412 \u0442\u0435\u0441\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0434\u043d\u0438\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u043c \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430.\u00a0<\/p>\n<p>\u0414\u043e \u0441\u043d\u044f\u0442\u0438\u044f \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u0438 \u0430\u0432\u0442\u043e\u0430\u043d\u0430\u043b\u0438\u0437 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0440\u044b\u0432\u043e\u0432, \u043f\u044b\u0442\u0430\u044f\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430. \u041f\u043e\u0441\u043b\u0435 \u0441\u043d\u044f\u0442\u0438\u044f \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430 \u0438\u043c \u0443\u0434\u0430\u0451\u0442\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443. \u0417\u0430 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">select * from pg_stat_progress_vacuum \\gx -[ RECORD 1 ]--------+------------------ pid                  | 27131 datid                | 5 datname              | postgres relid                | 1249 phase                | vacuuming indexes heap_blks_total      | 516654 heap_blks_scanned    | 516654 heap_blks_vacuumed   | 0 index_vacuum_count   | 0 max_dead_tuple_bytes | 67108864 dead_tuple_bytes     | 12780544 num_dead_item_ids    | 29945377 indexes_total        | 2 indexes_processed    | 0 -[ RECORD 2 ]--------+------------------ pid                  | 27114 datid                | 5 datname              | postgres relid                | 1259 phase                | vacuuming heap heap_blks_total      | 99573 heap_blks_scanned    | 99573 heap_blks_vacuumed   | 82095 index_vacuum_count   | 1 max_dead_tuple_bytes | 67108864 dead_tuple_bytes     | 3081216 num_dead_item_ids    | 4280219 indexes_total        | 0 indexes_processed    | 0<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0446\u0435 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f:  <\/p>\n<pre><code class=\"bash\">heap_blks_vacuumed   | 181104<\/code><\/pre>\n<p>\u0421\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u043f\u0440\u0438 \u0432\u0430\u043a\u0443\u0443\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438:  <\/p>\n<pre><code class=\"bash\">select pid, relid::regclass, phase, heap_blks_vacuumed from pg_stat_progress_vacuum;   pid  |    relid     |        phase        | heap_blks_vacuumed -------+--------------+---------------------+--------------------  27185 | pg_attribute | cleaning up indexes |             510699<\/code><\/pre>\n<h2>\u041f\u043e\u0441\u043b\u0435 \u0441\u043d\u044f\u0442\u0438\u044f \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430<\/h2>\n<p>\u0412 \u0436\u0443\u0440\u043d\u0430\u043b\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u044b\u00a0\u0437\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434:<\/p>\n<pre><code class=\"bash\">12:16:35.631 MSK [27131] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_statistic\": index scans: 1  system usage: CPU: user: 0.10 s, system: 0.02 s, elapsed: 1.23 s 12:20:38.721 MSK [27114] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_depend\": index scans: 1  tuples: 12840612 removed, 1796 remain, 0 are dead but not yet removable, oldest xmin: 21822422  index \"pg_depend_depender_index\": pages: 88958 in total, 88941 newly deleted, 88941 currently deleted, 0 reusable  index \"pg_depend_reference_index\": pages: 52304 in total, 52284 newly deleted, 52284 currently deleted, 26614 reusable  buffer usage: 1249768 hits, 331656 misses, 331637 dirtied  WAL usage: 707844 records, 330198 full page images, 784190586 bytes  system usage: CPU: user: 17.68 s, system: 8.18 s, elapsed: 315.05 s 12:22:30.224 MSK [27126] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_type\": index scans: 1  tuples: 8560408 removed, 629 remain, 4 are dead but not yet removable, oldest xmin: 21822422  index \"pg_type_oid_index\": pages: 23475 in total, 23467 newly deleted, 23467 currently deleted, 5544 reusable  index \"pg_type_typname_nsp_index\": pages: 8188 in total, 8173 newly deleted, 8173 currently deleted, 0 reusable  buffer usage: 457668 hits, 430004 misses, 429933 dirtied  WAL usage: 692059 records, 429925 full page images, 319674174 bytes  system usage: CPU: user: 24.85 s, system: 12.94 s, elapsed: 414.71 s 12:22:50.901 MSK [27114] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_class\": index scans: 1  pages: 0 removed, 99573 remain, 99573 scanned (100.00% of total)  tuples: 843 removed, 422 remain, 0 are dead but not yet removable, oldest xmin: 21822427  index scan needed: 99566 pages from table (99.99% of total) had 4280219 dead item identifiers removed  index \"pg_class_oid_index\": pages: 11739 in total, 11731 newly deleted, 11731 currently deleted, 0 reusable  index \"pg_class_relname_nsp_index\": pages: 4095 in total, 4086 newly deleted, 4086 currently deleted, 0 reusable  index \"pg_class_tblspc_relfilenode_index\": pages: 11738 in total, 11731 newly deleted, 11731 currently deleted, 0 reusable  buffer usage: 319841 hits, 226761 misses, 127214 dirtied  WAL usage: 281670 records, 127216 full page images, 230305466 bytes  system usage: CPU: user: 9.48 s, system: 3.44 s, elapsed: 132.17 s 12:27:09.884 MSK [27131] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_attribute\": index scans: 1  pages: 5955 removed, 510699 remain, 516600 scanned (99.99% of total)  tuples missed: 16066 dead from 277 pages not removed due to cleanup lock contention  index scan needed: 516323 pages from table (99.94% of total) had 29945377 dead item identifiers removed  index \"pg_attribute_relid_attnam_index\": pages: 122212 in total, 121547 newly deleted, 121547 currently deleted, 0 reusable  index \"pg_attribute_relid_attnum_index\": pages: 81827 in total, 81328 newly deleted, 81328 currently deleted, 0 reusable  buffer usage: 2461858 hits, 1040521 misses, 935880 dirtied  WAL usage: 1856568 records, 935889 full page images, 1763589809 bytes  system usage: CPU: user: 51.65 s, system: 22.52 s, elapsed: 634.24 s 12:27:44.400 MSK [27185] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_attribute\": index scans: 0  tuples: 6240 removed, 26 remain, 0 are dead but not yet removable, oldest xmin: 21822428  index scan bypassed: 280 pages from table (0.05% of total) have 16100 dead item identifiers  index \"pg_attribute_relid_attnam_index\": pages: 122212 in total, 0 newly deleted, 121547 currently deleted, 121547 reusable  index \"pg_attribute_relid_attnum_index\": pages: 81827 in total, 0 newly deleted, 81328 currently deleted, 81328 reusable  buffer usage: 219551 hits, 189542 misses, 166 dirtied  WAL usage: 170 records, 163 full page images, 498360 bytes  system usage: CPU: user: 1.75 s, system: 1.11 s, elapsed: 13.07 s 12:27:46.339 MSK [27185] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_attribute\"  avg read rate: 121.051 MB\/s, avg write rate: 0.040 MB\/s  buffer usage: 949 hits, 30044 misses, 10 dirtied  system usage: CPU: user: 0.28 s, system: 0.16 s, elapsed: 1.93 s<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u0430\u043a\u0443\u0443\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f:  <\/p>\n<pre><code class=\"bash\">postgres=# explain (analyze, buffers, timing off) select 'pg_attribute', pg_total_relation_size('pg_attribute'), count(*) from pg_attribute;                  QUERY PLAN ----------------------------------------------------------------  Aggregate  (cost=327460.66..327460.67 rows=1 width=48) (actual rows=1 loops=1)    Buffers: shared hit=470    -&gt;  Index Only Scan using pg_attribute_relid_attnum_index on pg_attribute  (cost=0.40..327455.72 rows=1975 width=0) (actual rows=3153 loops=1)          Heap Fetches: 0          Buffers: shared hit=470  Planning Time: 0.068 ms  Execution Time: 1.277 ms (7 rows) Time: 1.655 ms<\/code><\/pre>\n<p>\u0421\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0435 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u0430. \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u0441\u043c\u044b\u0441\u043b\u0430 \u0432 \u0438\u0445 \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u043d\u0435\u0442. \u0411\u043b\u043e\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u0435 \u0432 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 (\u00ab\u0434\u0435\u0440\u0435\u0432\u043e\u00bb), \u043c\u043e\u0433\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443.  <\/p>\n<h2>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b\u00a0\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438\u00a0enable_temp_memory_catalog\u00a0\u0438\u00a0enable_delayed_temp_file \u0432\u00a0\u0421\u0423\u0411\u0414\u00a0Tantor Postgres<\/h2>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 enable_temp_memory_catalog, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u0421\u0423\u0411\u0414 Tantor Postgres, \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043b\u044e\u0431\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 17 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432 \u0440\u0435\u0434\u0430\u043a\u0446\u0438\u044f\u0445 Special Edition, Special Edition 1C, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0424\u0421\u0422\u042d\u041a \u0420\u043e\u0441\u0441\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0440\u0435\u0434\u0430\u043a\u0446\u0438\u0438 \u0421\u0423\u0411\u0414 Tantor Certified 16.8 \u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 1. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0443\u0440\u043e\u0432\u043d\u044f\u0445, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0435\u0441\u0441\u0438\u0438. \u0412\u043a\u043b\u044e\u0447\u0438\u043c \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">postgres=# alter system set enable_temp_memory_catalog = on; ALTER SYSTEM postgres=# select pg_reload_conf();  pg_reload_conf ----------------  t (1 row)<\/code><\/pre>\n<p>\u0411\u0443\u0434\u0435\u043c \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445:  <\/p>\n<pre><code class=\"bash\">postgres=# begin; create table xt (n int); BEGIN CREATE TABLE<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0442\u0435\u0441\u0442:  <\/p>\n<pre><code class=\"bash\">postgres@tantor:~$ pgbench -n -T 10000 -c 16 -P 60 -f workl1c_100.sql pgbench (17.2) progress: 60.0 s, 41.9 tps, lat 379.749 ms stddev 35.921, 0 failed progress: 120.0 s, 41.9 tps, lat 381.668 ms stddev 41.316, 0 failed progress: 180.0 s, 42.1 tps, lat 380.539 ms stddev 37.818, 0 failed progress: 240.0 s, 41.8 tps, lat 383.191 ms stddev 39.267, 0 failed<\/code><\/pre>\n<p>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0422PS \u043f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0438 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0432\u044b\u0448\u0435 (\u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 TPS=23) \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446, \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044e\u0449\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430. \u0420\u0430\u0437\u043c\u0435\u0440\u044b \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f, \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043d\u0438\u0445 \u043d\u0435 \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f.<\/p>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u0430 \u043d\u0435 \u0432 \u0431\u043b\u043e\u043a\u0430\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a\u00a0<code>work_mem<\/code>\u00a0\u0438\u00a0<code>maintenance_work_mem<\/code>. \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432\u044b\u0448\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u0447\u0442\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0446\u0438\u044e \u0437\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0434\u043d\u0430\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0430\u043c\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f, \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<h3>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u00a0enable_delayed_temp_file<\/h3>\n<p>\u0421\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438\u00a0<code>enable_delayed_temp_file<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c\u00a0<code>enable_temp_memory_catalog<\/code>\u00a0\u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 \u0421\u0423\u0411\u0414 Tantor Postgres \u0432\u0435\u0440\u0441\u0438\u0438 17.5 :<\/p>\n<pre><code class=\"bash\">postgres@tantor:~$ psql -c \"alter system set enable_delayed_temp_file = on;\" ALTER SYSTEM postgres@tantor:~$ psql -c \"select pg_reload_conf();\"  pg_reload_conf ----------------  t (1 row)  postgres@tantor:~$ pgbench -n -T 10000 -c 16 -P 5 -f workl1c_100.sql pgbench (17.2) progress: 5.0 s, 47.2 tps, lat 324.453 ms stddev 41.019, 0 failed progress: 10.0 s, 49.0 tps, lat 324.568 ms stddev 34.198, 0 failed progress: 15.0 s, 49.2 tps, lat 324.529 ms stddev 41.999, 0 failed progress: 20.0 s, 50.0 tps, lat 321.942 ms stddev 35.568, 0 failed progress: 25.0 s, 48.4 tps, lat 328.826 ms stddev 42.060, 0 failed<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 enable_delayed_temp_file TPS \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 ~42 \u0434\u043e ~49.  <\/p>\n<h2>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u00a0\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438\u00a0enable_temp_memory_catalog<\/h2>\n<p>\u0412 \u0441\u0431\u043e\u0440\u043a\u0435 PostgreSQL 16 \u043e\u0442 1\u0421 \u0418\u0422\u0421 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u00a0\u00a0<code>enable_temp_memory_catalog<\/code>, \u0440\u0435\u0448\u0430\u044e\u0449\u0438\u0439 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u2014 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446. \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0439 \u043e\u043f\u0446\u0438\u0438 \u0432 \u0421\u0423\u0411\u0414 Tantor Postgres 17 \u0431\u044b\u043b\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u0442\u0430\u043a\u0438\u043c \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 \u0441\u0431\u043e\u0440\u043a\u0435 1\u0421 \u0418\u0422\u0421, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u00a0<code>enable_delayed_temp_file\u00a0<\/code>\u0432 \u0441\u0431\u043e\u0440\u043a\u0435 \u043e\u0442 1\u0421 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<p>\u0420\u0430\u0437\u043c\u0435\u0440 \u043f\u0430\u0442\u0447\u0430 \u043e\u0442 \u00ab\u0422\u0430\u043d\u0442\u043e\u0440 \u041b\u0430\u0431\u0441\u00bb, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b enable_temp_memory_catalog \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 217\u041a\u0431 (7377 \u0441\u0442\u0440\u043e\u043a). \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0441\u0435\u043d\u044b \u0432 30 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0432 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c 30 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0414\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0438\u043f\u0430 Red-Black tree, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446.\u00a0\u041e\u0434\u043d\u0430\u043a\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e (\u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0438 \u0441\u043e\u0442\u043d\u0438 \u0442\u044b\u0441\u044f\u0447) \u0447\u0438\u0441\u043b\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u043e.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bdd\/a68\/adf\/bdda68adfe5d5384716e098b6f3afa31.png\" alt=\"\u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0438\u043f\u0430 Red-Black tree  \" title=\"\u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0438\u043f\u0430 Red-Black tree  \" width=\"845\" height=\"515\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/bdd\/a68\/adf\/bdda68adfe5d5384716e098b6f3afa31.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bdd\/a68\/adf\/bdda68adfe5d5384716e098b6f3afa31.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0438\u043f\u0430 Red-Black tree<\/em>  <\/figcaption><\/div>\n<\/figure>\n<pre><code class=\"python\">----------------------  Core Operations and Hooks:  inmem_init(): Initializes the in-memory storage engine, creating shared memory data structures and registering callbacks.  inmem_insert(), inmem_delete(), inmem_update(), inmem_inplace_update(): Hooks that intercept heap operations on temporary tables and redirect them to the in-memory storage engine.   inmem_index_insert(), inmem_index_getnext_tid_merge(), inmem_index_getbitmap(): Hooks that intercept index operations and handle them using the in-memory indexes.   inmem_beginscan(), inmem_getnext(), inmem_hot_search_buffer(): Functions that support heap scans, retrieving data from the in-memory storage.   inmem_index_beginscan(), inmem_index_endscan(), inmem_index_rescan(): Functions that manage index scans on in-memory indexes.   inmem_subxact_cb(), inmem_xcact_cb(): Callbacks that handle transaction and subtransaction events, managing the visibility of changes.   find_relation_entry(): get entry for in-memory relation, if it handled.   GetRelationItemIdxByOidInternal(), GetSnapshotRelationIdxByOid(): get idx in arrays of relation.   tuples_handler_is_empty(): check, that relation have no tuples.   IsInmemHandledRelationId(), IsInmemHandledIndexId(): determine whether to apply in-memory logic.   GetLocalMemoryContext(), GetLocalTransactionMemoryContext(): local contexts for data storing.   generic_is_inmem_tuple(), pg_class_is_inmem_tuple(): check if tuple is in-memory.   inmem_clean_catalog_on_relation_delete(): delete all data about deleting relation from indexes.   delete_pg_depend_entries(), delete_pg_class_entries(), delete_pg_type_entries(): deleting entries from pg_depend, pg_class, pg_type catalogs.  ---------------------<\/code><\/pre>\n<p>\u0411\u0443\u0444\u0435\u0440\u043d\u044b\u0439 \u043a\u044d\u0448 \u043d\u0435 \u0437\u0430\u0441\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u043e\u043a\u0430\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430:  <\/p>\n<pre><code class=\"bash\">postgres=# select * from pg_buffercache_usage_counts();  usage_count | buffers | dirty | pinned -------------+---------+-------+--------            0 |   15644 |     0 |      0            1 |     175 |     6 |      0            2 |     135 |     0 |      0            3 |      73 |     0 |      0            4 |      56 |     1 |      0            5 |     301 |    25 |      0 (6 rows)<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e:<\/p>\n<pre><code class=\"bash\">postgres=# explain (analyze, buffers, timing off) select 'pg_attribute', pg_total_relation_size('pg_attribute'), count(*) from pg_attribute;      -&gt;  Seq Scan on pg_attribute  (cost=0.00..89.37 rows=3237 width=0) (actual rows=3237 loops=1)          Buffers: shared hit=57  Planning Time: 0.059 ms  Execution Time: 0.672 ms  Time: 1.446 ms<\/code><\/pre>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h2>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 PostgreSQL \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u2014 \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443, \u0432 \u0441\u0435\u0441\u0441\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u044e \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043d\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u0430.\u00a0<\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 enable_temp_memory_catalog, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u0421\u0423\u0411\u0414 Tantor Postgres 17.5, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043d\u0438\u043c\u0438,\u00a0\u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430.\u00a0\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 enable_delayed_temp_file \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446, \u043f\u043e\u043a\u0430 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/930038\/\"> https:\/\/habr.com\/ru\/articles\/930038\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 PostgreSQL \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043e 13 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0442\u0441\u044f <code>pg_attribute<\/code>,\u00a0<code>pg_class<\/code>, <code>pg_depend<\/code>\u00a0\u0438 <code>pg_type<\/code>. \u041c\u0430\u0441\u0441\u043e\u0432\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432 1C:ERP. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0432 \u0421\u0423\u0411\u0414 Tantor Postgres. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 17.5, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f. \u041d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438\u00a0<code>enable_temp_memory_catalog<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0443\u0440\u043e\u0432\u043d\u044f\u0445, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0435\u0441\u0441\u0438\u0438, \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430.<\/p>\n<h2>\u0420\u0430\u0437\u0434\u0443\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0432 PostgreSQL<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439 \u0432 PostgreSQL \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430. \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0438 \u043d\u0435\u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435, \u043c\u043e\u0433\u0443\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u044b. \u0412 \u043e\u0431\u0449\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044e\u0442 \u0434\u043e 13 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430. \u0427\u0438\u0441\u043b\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0441\u0442\u0440\u043e\u043a \u0432 \u044d\u0442\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043f\u0440\u043e\u0441<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>select &#8216;pg_class&#8217; table, pg_total_relation_size(&#8216;pg_class&#8217;) size, count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_class union all<\/strong><\/p>\n<p><strong>select &#8216;pg_attribute&#8217;, pg_total_relation_size(&#8216;pg_attribute&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_attribute union all<\/strong><\/p>\n<p><strong>select &#8216;pg_type&#8217;, pg_total_relation_size(&#8216;pg_type&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_type union all<\/strong><\/p>\n<p><strong>select &#8216;pg_depend&#8217;, pg_total_relation_size(&#8216;pg_depend&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_depend union all<\/strong><\/p>\n<p><strong>select &#8216;pg_inherits&#8217;, pg_total_relation_size(&#8216;pg_inherits&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_inherits union all<\/strong><\/p>\n<p><strong>select &#8216;pg_statistic&#8217;, pg_total_relation_size(&#8216;pg_statistic&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_statistic union all<\/strong><\/p>\n<p><strong>select &#8216;pg_attrdef&#8217;, pg_total_relation_size(&#8216;pg_attrdef&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_attrdef union all<\/strong><\/p>\n<p><strong>select &#8216;pg_collation&#8217;, pg_total_relation_size(&#8216;pg_collation&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_collation union all<\/strong><\/p>\n<p><strong>select &#8216;pg_constraint&#8217;, pg_total_relation_size(&#8216;pg_constraint&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_constraint union all<\/strong><\/p>\n<p><strong>select &#8216;pg_description&#8217;, pg_total_relation_size(&#8216;pg_description&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_description union all<\/strong><\/p>\n<p><strong>select &#8216;pg_index&#8217;, pg_total_relation_size(&#8216;pg_index&#8217;), count(*) from<\/strong><\/p>\n<p><strong>\u00a0pg_index union all<\/strong><\/p>\n<p><strong>select &#8216;pg_namespace&#8217;, pg_total_relation_size(&#8216;pg_namespace&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_namespace union all<\/strong><\/p>\n<p><strong>select &#8216;pg_sequence&#8217;, pg_total_relation_size(&#8216;pg_sequence&#8217;), count(*)<\/strong><\/p>\n<p><strong>\u00a0from pg_sequence;<\/strong><\/p>\n<\/div>\n<\/details>\n<p><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/strong><\/p>\n<pre><code class=\"bash\">\u00a0\u00a0\u00a0\u00a0 table\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 size\u00a0\u00a0\u00a0 | count ----------------+------------+-------\u00a0 pg_sequence\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8192 |\u00a0\u00a0\u00a0\u00a0 0\u00a0 pg_attrdef\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 24576 |\u00a0\u00a0\u00a0\u00a0 0\u00a0 pg_inherits\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 16384 |\u00a0\u00a0\u00a0\u00a0 0\u00a0 pg_namespace\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 57344 |\u00a0\u00a0 102\u00a0 pg_constraint\u00a0 |\u00a0\u00a0\u00a0\u00a0 114688 |\u00a0\u00a0 114\u00a0 pg_index\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 65536 |\u00a0\u00a0 168\u00a0 pg_collation\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 229376 |\u00a0\u00a0 822\u00a0 pg_description |\u00a0\u00a0\u00a0\u00a0 565248 |\u00a0 5233\u00a0 pg_statistic\u00a0\u00a0 |\u00a0\u00a0\u00a0 2187264 |\u00a0\u00a0 416\u00a0 pg_class\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0 542957568 |\u00a0\u00a0 428\u00a0 pg_attribute\u00a0\u00a0 | 3064348672 |\u00a0 3195\u00a0 pg_depend\u00a0\u00a0\u00a0\u00a0\u00a0 | 1002225664 |\u00a0 1808\u00a0 pg_type\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | 1000480768 |\u00a0\u00a0 637 (13 rows)<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0442\u0435\u0441\u0442 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u043e\u043a \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0440\u0443\u0433\u0438\u0445. \u0414\u043b\u044f \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0437\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0431\u0443\u0444\u0435\u0440\u043d\u043e\u0433\u043e \u043a\u044d\u0448\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435:<\/p>\n<pre><code>postgres=#\u00a0create extension pg_buffercache; CREATE EXTENSION<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0440\u043e\u043a \u0440\u0430\u0437\u043c\u0435\u0440 \u044d\u0442\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446.<\/p>\n<pre><code class=\"bash\">postgres@tantor:~$ cat gen2.pydef main():\u00a0\u00a0\u00a0  for count in [100]:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  with open(f'workl1c_{count}.sql', 'w') as f:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  for i in range(1, count):\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  f.write(f\"\"\"create temporary table ttt{i} (c int); drop table ttt{i}; \"\"\") if __name__ == \"__main__\": main()<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u0442\u0435\u0441\u0442\u0430 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c workl1c_100.sql:<\/p>\n<pre><code class=\"bash\">postgres@tantor:~$ python3 gen2.py<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043d\u0435 \u043e\u0447\u0438\u0449\u0430\u043b\u0438\u0441\u044c, \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442 \u0431\u0430\u0437\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0435\u0441\u0441\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432 \u043d\u0435\u0439 \u043b\u044e\u0431\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">postgres=# begin; create temporary table xt (n int); BEGIN; CREATE TABLE<\/code><\/pre>\n<p>\u0410\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c, \u043f\u0440\u0438 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0438 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0442\u0440\u043e\u043a. \u0414\u043b\u044f \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0437\u0430 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u043e\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440: <\/p>\n<pre><code class=\"bash\">postgres=# alter system set log_autovacuum_min_duration = '1s'; select pg_reload_conf();  pg_reload_conf ----------------  t (1 row) ALTER SYSTEM<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043a\u0443\u0443\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u0442 \u043e\u0434\u043d\u0443 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043b\u043e\u0433\u0435.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"bash\">postgres@tantor:~$ cat $PGDATA\/postgresql.auto.conf # Do not edit this file manually! # It will be overwritten by the ALTER SYSTEM command. max_connections = '1000' shared_preload_libraries = 'pg_stat_statements' logging_collector = 'on' log_filename = 'postgresql-%F.log' log_autovacuum_min_duration = '1s'<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 pgbench:<\/p>\n<pre><code>postgres@tantor:~$ pgbench -n -T 10000 -c 16 -P 60 -f workl1c_100.sql\\ progress: 60.0 s, 19.8 tps, lat 798.487 ms stddev 97.788, 0 failed progress: 120.0 s, 16.0 tps, lat 1000.391 ms stddev 100.195, 0 failed ... progress: 2340.0 s, 2.2 tps, lat 7131.160 ms stddev 1289.401, 0 failed progress: 2400.0 s, 2.2 tps, lat 7343.940 ms stddev 1204.763, 0 failed<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435\u00a0tps \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0444\u0435\u0440\u043d\u043e\u0433\u043e \u043a\u044d\u0448\u0430. \u041f\u043e \u043c\u0435\u0440\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0438\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u0432\u044b\u0442\u0435\u0441\u043d\u044f\u0442\u044c \u0438\u0437 \u043a\u044d\u0448\u0430 \u0431\u043b\u043e\u043a\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0439 \u043a\u044d\u0448 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u043c:  <\/p>\n<pre><code class=\"bash\">postgres=# select * from pg_buffercache_usage_counts();  usage_count | buffers | dirty | pinned -------------+---------+-------+--------            0 |     776 |    71 |      0            1 |     833 |    85 |      1            2 |    1134 |   102 |      0            3 |     801 |    26 |      0            4 |    2758 |    28 |      0            5 |   10082 |   139 |      1 (6 rows)<\/code><\/pre>\n<p>\u0420\u0430\u0437\u043c\u0435\u0440\u044b \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0438\u0441\u044c: <\/p>\n<pre><code class=\"bash\">     table      |   size    | count ----------------+-----------+-------  pg_class       | 161521664 |   431  pg_type        | 293175296 |   637  pg_depend      | 298180608 |  1836  pg_attribute   | 899604480 |  3251 (13 rows)<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0435\u0441\u0442, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0437\u0430\u043d\u043e\u0432\u043e, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f tps \u0432\u0435\u0440\u043d\u0443\u0442\u0441\u044f \u043a \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0442\u0435\u0441\u0442\u0430 bgwriter \u0443\u0441\u043f\u0435\u0432\u0430\u0435\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u0431\u0443\u0444\u0435\u0440\u044b (\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0440\u0430\u0437\u043c\u044b\u0448\u043b\u044f\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u0438 \u044d\u0442\u043e \u0442\u0430\u043a):  <\/p>\n<pre><code class=\"bash\">postgres=# select * from pg_buffercache_usage_counts();  usage_count | buffers | dirty | pinned -------------+---------+-------+--------            0 |   15946 |     0 |      0            1 |     242 |    81 |      0            2 |       9 |     0 |      0            3 |       9 |     0 |      0            4 |     174 |    25 |      0            5 |       4 |     2 |      0 (6 rows)<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043d\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442\u0441\u044f, \u0430 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0434\u0430\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440, \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0436\u043d\u0438\u043c. \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442\u0441\u044f:  <\/p>\n<pre><code class=\"bash\">progress: 60.0 s, 18.9 tps, lat 841.028 ms stddev 95.998, 0 failed progress: 120.0 s, 15.4 tps, lat 1038.162 ms stddev 107.813, 0 failed progress: 180.0 s, 13.1 tps, lat 1218.092 ms stddev 119.285, 0 failed progress: 240.0 s, 11.7 tps, lat 1370.945 ms stddev 97.170, 0 failed ... progress: 7380.0 s, 1.0 tps, lat 15925.498 ms stddev 2271.770, 0 failed progress: 7440.0 s, 1.0 tps, lat 16131.646 ms stddev 2646.911, 0 failed progress: 7500.0 s, 0.9 tps, lat 16450.132 ms stddev 3068.155, 0 failed<\/code><\/pre>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0435 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u0430 \u0438 \u0430\u0432\u0442\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441\u043f\u0443\u0441\u0442\u044f 6000 \u0441\u0435\u043a\u0443\u043d\u0434:  <\/p>\n<pre><code class=\"bash\">postgres@tantor:~$ cat $PGDATA\/log\/postgresql*  10:06:58.014 MSK [24548] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_class\"  elapsed: 2.59 s  10:07:27.693 MSK [24551] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_attribute\": index scans: 0  tuples: 0 removed, 19759720 remain, 19759694 are dead but not yet removable, oldest xmin: 13261300 elapsed: 35.63 s  10:07:29.844 MSK [24551] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_attribute\" elapsed: 2.15 s  10:07:40.733 MSK [24551] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_depend\": index scans: 0  removable cutoff: 13261300, which was 5661621 XIDs old when operation ended elapsed: 10.87 s  10:07:43.996 MSK [24551] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_depend\" elapsed: 3.26 s  10:07:49.832 MSK [24554] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_type\": index scans: 0  tuples: 0 removed, 5659547 remain, 5658922 are dead but not yet removable, oldest xmin: 13261300 elapsed: 17.41 s  10:07:52.590 MSK [24551] LOG:  automatic vacuum of table \"postgres.pg_catalog.pg_class\": index scans: 0 elapsed: 8.57 s  10:07:52.891 MSK [24554] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_type\" elapsed: 3.05 s  10:07:55.511 MSK [24551] LOG:  automatic analyze of table \"postgres.pg_catalog.pg_class\" elapsed: 2.92 s<\/code><\/pre>\n<p>\u041c\u044b \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u0437\u0434\u0435\u0441\u044c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043b\u043e\u0433\u0430. \u041f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e\u00a0elapsed\u00a0\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u0440\u0430\u0442\u0438\u0442 \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u2014\u00a0pg_attribute,\u00a0pg_type,\u00a0pg_depend. \u0415\u0441\u043b\u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u0442\u0440\u0430\u0442\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0432\u043f\u0443\u0441\u0442\u0443\u044e, \u0440\u0430\u0441\u0445\u043e\u0434\u0443\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u044b.<\/p>\n<p>\u0426\u0438\u043a\u043b \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u0430 \u0438 \u0430\u0432\u0442\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u043b\u0438\u043b\u0441\u044f \u0431\u043e\u043b\u0435\u0435 70 \u0441\u0435\u043a\u0443\u043d\u0434, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043d\u0435 \u0431\u044b\u043b\u043e \u2014 \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c \u043d\u0435 \u043c\u043e\u0433 \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u0437-\u0437\u0430 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430. \u0426\u0438\u043a\u043b\u044b \u0430\u0432\u0442\u043e\u0432\u0430\u043a\u0443\u0443\u043c\u0430 \u0438 \u0430\u0432\u0442\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u043c\u0435\u0436\u0434\u0443 \u0446\u0438\u043a\u043b\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435\u0432\u0435\u043b\u0438\u043a\u0430 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c\u00a0autovacuum_naptime = 1min.<\/p>\n<p>\u041d\u0430\u0431\u043e\u0440 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<pre><code class=\"bash\">autovacuum_vacuum_cost_delay          | 2ms autovacuum_vacuum_cost_limit          | -1 vacuum_cost_delay                     | 0 vacuum_cost_limit                  <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-473573","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/473573","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=473573"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/473573\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=473573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=473573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=473573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}