{"id":328119,"date":"2022-01-17T15:00:07","date_gmt":"2022-01-17T15:00:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=328119"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=328119","title":{"rendered":"<span>\u0420\u0435\u0432\u0435\u0440\u0441-\u0438\u043d\u0436\u0438\u043d\u0438\u0440\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0411\u0414 PostgreSQL \u043f\u043e \u043f\u043b\u0430\u043d\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u043d\u0435\u0439<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0431\u0430\u0437\u0430\u043c PostgreSQL \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f &#171;\u043c\u0435\u0445\u0430\u043d\u0438\u0447\u0435\u0441\u043a\u0438&#187;, <strong>\u0441\u043b\u0435\u0434\u0443\u044f \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u043c\u0430\u0440\u043a\u0435\u0440\u0430\u043c<\/strong> \u0432 \u043f\u043b\u0430\u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0443\u0442, <a href=\"https:\/\/habr.com\/ru\/post\/492694\/\">\u0447\u0442\u043e \u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c<\/a>. \u041d\u043e &#171;\u0433\u043b\u0443\u0431\u0438\u043d\u043d\u044b\u0435&#187; \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0432\u0440\u043e\u0434\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 <a href=\"https:\/\/habr.com\/ru\/post\/527700\/\">\u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u043e DBA-\u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432<\/a>, \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 <strong>\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0432\u044f\u0437\u0435\u0439<\/strong>.<\/p>\n<p>\u0418 \u0445\u043e\u0440\u043e\u0448\u043e, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0443\u0436\u0435 \u0433\u0434\u0435-\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0438 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430. \u041d\u043e \u043f\u043b\u043e\u0445\u043e, \u043a\u043e\u0433\u0434\u0430 \u0442\u0430\u043a\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043d\u0438\u0447\u0442\u043e\u0436\u043d\u043e \u043c\u0430\u043b\u0430, \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e \u0432\u0435\u043b\u0438\u043a\u0430, \u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430&#8230;<\/p>\n<p>\u0410 \u0432\u0435\u0434\u044c \u043e\u043d\u0430 \u0443\u0436\u0435 \u0438 \u0442\u0430\u043a \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f &#171;\u043f\u043e\u0434 \u043d\u043e\u0433\u0430\u043c\u0438&#187; \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 &#8212; \u043d\u0430\u0434\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u0448\u044c <strong>\u0443\u0434\u043e\u0431\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c <\/strong>\u0435\u0435!<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" height=\"250\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4b4\/6ab\/27e\/4b46ab27e7413c1d3881bfdd3de262fd.png\" data-width=\"274\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code class=\"sql\">EXPLAIN (ANALYZE, COSTS OFF) SELECT * FROM pg_stat_user_tables WHERE schemaname = 'public';<\/code><\/pre>\n<pre><code>GroupAggregate (actual time=15.756..17.407 rows=173 loops=1)   Group Key: c.oid, n.nspname, c.relname   ->  Sort (actual time=4.490..4.771 rows=2806 loops=1)         Sort Key: c.oid, c.relname         Sort Method: quicksort  Memory: 842kB         ->  Nested Loop Left Join (actual time=0.537..3.538 rows=2806 loops=1)               ->  Nested Loop (actual time=0.526..1.228 rows=173 loops=1)                     Join Filter: (c.relnamespace = n.oid)                     Rows Removed by Join Filter: 201                     ->  Index Scan using pg_namespace_nspname_index on pg_namespace n (actual time=0.017..0.018 rows=1 loops=1)                           Index Cond: (nspname = 'public'::name)                           Filter: (nspname !~ '^pg_toast'::text)                     ->  Seq Scan on pg_class c (actual time=0.009..1.168 rows=374 loops=1)                           Filter: (relkind = ANY ('{r,t,m}'::\"char\"[]))                           Rows Removed by Filter: 3187               ->  Index Scan using pg_index_indrelid_index on pg_index i (actual time=0.002..0.010 rows=16 loops=173)                     Index Cond: (c.oid = indrelid) Planning time: 2.398 ms Execution time: 17.660 ms<\/code><\/pre>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043d\u0430\u0448\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043b\u0430\u043d\u043e\u0432 <a href=\"https:\/\/explain.tensor.ru\/archive\/explain\/c1193684f3b43853ca8ebb676b000d0d:0:2022-01-17\">explain.tensor.ru<\/a>, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" height=\"202\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9e1\/2da\/846\/9e12da846dc7fd10d35236a8304864f5.png\" data-width=\"646\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u041c\u0430\u0440\u043a\u0435\u0440\u044b-\u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438<\/strong> \u0441\u0440\u0430\u0437\u0443 \u0430\u043a\u0446\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0442 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u0435\u0445 \u0443\u0437\u043b\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041d\u043e \u043d\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435 \u043e\u043d\u0438, \u0430 \u0442\u0435 \u0442\u0440\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u043f\u043b\u0430\u043d\u0435, \u0438 \u0438\u0445 \u043f\u043e\u043b\u044f:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" height=\"399\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/27c\/55d\/ff0\/27c55dff02ab23a124912161cd243fed.png\" data-width=\"857\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e:<\/p>\n<ul>\n<li>\n<p>\u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044e <code>pg_stat_user_tables<\/code> \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0442\u0440\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b: <code>pg_namespace<\/code> (\u0430\u043b\u0438\u0430\u0441 <code>n<\/code>), <code>pg_class<\/code> (\u0430\u043b\u0438\u0430\u0441 <code>c<\/code>) \u0438 <code>pg_index<\/code> (\u0430\u043b\u0438\u0430\u0441 <code>i<\/code>)<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0438 \u0432 \u043d\u0438\u0445 \u043f\u043e\u043b\u0435\u0439 <code>c.oid, c.relname, c.relnamespace, c.relkind, n.oid, n.nspname, i.indrelid<\/code><\/p>\n<\/li>\n<li>\n<p>\u0442\u0430\u043a\u0436\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0437 \u043d\u0438\u0445, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b \u043e\u0431 \u0438\u0445 \u0442\u0438\u043f\u0435:<\/p>\n<ul>\n<li>\n<p><code>n.nspname = 'public'::name => nspname::name<\/code><\/p>\n<\/li>\n<li>\n<p><code>c.relkind = ANY ('{r,t,m}'::\"char\"[]) => relkind::\"char\"<\/code><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u0432\u044f\u0437\u0438 \u044d\u0442\u0438\u0445 \u043f\u043e\u043b\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439:<\/p>\n<ul>\n<li>\n<p><code>c.relnamespace = n.oid<\/code><\/p>\n<\/li>\n<li>\n<p><code>c.oid = i.indrelid<\/code><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u044c <strong>\u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 &#171;\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430&#187;<\/strong> \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e &#8212; \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u0438\u0445 \u043f\u043e\u043b\u044f \u0438 \u0441\u0432\u044f\u0437\u0438:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" alt=\"\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0432\u044f\u0437\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u0430\u0437\u044b\" title=\"\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0432\u044f\u0437\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u0430\u0437\u044b\" height=\"250\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f8d\/88e\/9fd\/f8d88e9fd624cb62d946c1f706609801.png\" data-width=\"274\"\/><figcaption>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0432\u044f\u0437\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u0430\u0437\u044b<\/figcaption><\/figure>\n<p>\u0425\u043e\u0442\u0438\u043c \u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u0435\u0439? \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>VERBOSE<\/code>:<\/p>\n<pre><code class=\"sql\">EXPLAIN (ANALYZE, VERBOSE, COSTS OFF) SELECT * FROM pg_stat_user_tables WHERE schemaname = 'public';<\/code><\/pre>\n<pre><code>GroupAggregate (actual time=26.777..29.790 rows=173 loops=1)   Output: c.oid, n.nspname, c.relname, pg_stat_get_numscans(c.oid), pg_stat_get_tuples_returned(c.oid), (sum(pg_stat_get_numscans(i.indexrelid)))::bigint, ((sum(pg_stat_get_tuples_fetched(i.indexrelid)))::bigint + pg_stat_get_tuples_fetched(c.oid)), pg_stat_get_tuples_inserted(c.oid), pg_stat_get_tuples_updated(c.oid), pg_stat_get_tuples_deleted(c.oid), pg_stat_get_tuples_hot_updated(c.oid), pg_stat_get_live_tuples(c.oid), pg_stat_get_dead_tuples(c.oid), pg_stat_get_mod_since_analyze(c.oid), pg_stat_get_last_vacuum_time(c.oid), pg_stat_get_last_autovacuum_time(c.oid), pg_stat_get_last_analyze_time(c.oid), pg_stat_get_last_autoanalyze_time(c.oid), pg_stat_get_vacuum_count(c.oid), pg_stat_get_autovacuum_count(c.oid), pg_stat_get_analyze_count(c.oid), pg_stat_get_autoanalyze_count(c.oid)   Group Key: c.oid, n.nspname, c.relname   ->  Sort (actual time=13.829..14.284 rows=2806 loops=1)         Output: c.oid, n.nspname, c.relname, i.indexrelid         Sort Key: c.oid, c.relname         Sort Method: quicksort  Memory: 842kB         ->  Nested Loop Left Join (actual time=0.720..11.421 rows=2806 loops=1)               Output: c.oid, n.nspname, c.relname, i.indexrelid               ->  Hash Join (actual time=0.660..1.490 rows=173 loops=1)                     Output: c.oid, c.relname, n.nspname                     Inner Unique: true                     Hash Cond: (c.relnamespace = n.oid)                     ->  Seq Scan on pg_catalog.pg_class c (actual time=0.015..1.376 rows=374 loops=1)                           Output: c.oid, c.relname, c.relnamespace                           Filter: (c.relkind = ANY ('{r,t,m}'::\"char\"[]))                           Rows Removed by Filter: 3187                     ->  Hash (actual time=0.024..0.024 rows=1 loops=1)                           Output: n.nspname, n.oid                           Buckets: 1024  Batches: 1  Memory Usage: 9kB                           ->  Index Scan using pg_namespace_nspname_index on pg_catalog.pg_namespace n (actual time=0.020..0.021 rows=1 loops=1)                                 Output: n.nspname, n.oid                                 Index Cond: (n.nspname = 'public'::name)                                 Filter: (n.nspname !~ '^pg_toast'::text)               ->  Index Scan using pg_index_indrelid_index on pg_catalog.pg_index i (actual time=0.026..0.054 rows=16 loops=173)                     Output: i.indexrelid, i.indrelid, i.indnatts, i.indisunique, i.indisprimary, i.indisexclusion, i.indimmediate, i.indisclustered, i.indisvalid, i.indcheckxmin, i.indisready, i.indislive, i.indisreplident, i.indkey, i.indcollation, i.indclass, i.indoption, i.indexprs, i.indpred                     Index Cond: (c.oid = i.indrelid) Planning time: 3.151 ms Execution time: 30.219 ms<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0437\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u0432\u044f\u0437\u0435\u0439 \u0432 \u0431\u0430\u0437\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0438\u0437 \u0441\u0430\u043c\u043e\u0439 \u0441\u0445\u0435\u043c\u044b:<\/p>\n<pre><code class=\"sql\">EXPLAIN (ANALYZE, COSTS OFF) SELECT * FROM pg_class WHERE relnamespace = (   SELECT oid FROM pg_namespace WHERE nspname = 'public' );<\/code><\/pre>\n<pre><code>Seq Scan on pg_class (actual time=0.020..1.002 rows=2992 loops=1)   Filter: (relnamespace = $0)   Rows Removed by Filter: 569   InitPlan 1 (returns $0)     ->  Index Scan using pg_namespace_nspname_index on pg_namespace (actual time=0.010..0.011 rows=1 loops=1)           Index Cond: (nspname = 'public'::name) Planning time: 0.110 ms Execution time: 1.185 ms<\/code><\/pre>\n<p>\u0418 \u0434\u0430, \u0441\u0432\u044f\u0437\u044c \u0441\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c <code>InitPlan<\/code> \u043c\u044b \u0442\u043e\u0436\u0435 \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u0440\u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" alt=\"\u041e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435 InitPlan \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0431\u0430\u0437\u044b\" title=\"\u041e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435 InitPlan \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0431\u0430\u0437\u044b\" height=\"200\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d13\/e6f\/a24\/d13e6fa245835a41d05b279002ec2abc.png\" data-width=\"303\"\/><figcaption>\u041e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435 InitPlan \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0431\u0430\u0437\u044b<\/figcaption><\/figure>\n<blockquote>\n<p>\u041f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u043f\u043b\u0430\u043d\u0430 \u0441 \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c\u0438 \u0441\u0442\u0430\u043b\u043e \u0435\u0449\u0435 \u043f\u0440\u043e\u0449\u0435 &#8212; \u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0435 &#171;\u0437\u0435\u0440\u043a\u0430\u043b\u043e&#187; <a href=\"https:\/\/explain-postgresql.com\/\">explain-postgresql.com<\/a>.<\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/tensor\/blog\/646043\/\"> https:\/\/habr.com\/ru\/company\/tensor\/blog\/646043\/<\/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_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0431\u0430\u0437\u0430\u043c PostgreSQL \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f &#171;\u043c\u0435\u0445\u0430\u043d\u0438\u0447\u0435\u0441\u043a\u0438&#187;, <strong>\u0441\u043b\u0435\u0434\u0443\u044f \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u043c\u0430\u0440\u043a\u0435\u0440\u0430\u043c<\/strong> \u0432 \u043f\u043b\u0430\u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0443\u0442, <a href=\"https:\/\/habr.com\/ru\/post\/492694\/\">\u0447\u0442\u043e \u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c<\/a>. \u041d\u043e &#171;\u0433\u043b\u0443\u0431\u0438\u043d\u043d\u044b\u0435&#187; \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0432\u0440\u043e\u0434\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 <a href=\"https:\/\/habr.com\/ru\/post\/527700\/\">\u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u043e DBA-\u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432<\/a>, \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 <strong>\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0432\u044f\u0437\u0435\u0439<\/strong>.<\/p>\n<p>\u0418 \u0445\u043e\u0440\u043e\u0448\u043e, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0443\u0436\u0435 \u0433\u0434\u0435-\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0438 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430. \u041d\u043e \u043f\u043b\u043e\u0445\u043e, \u043a\u043e\u0433\u0434\u0430 \u0442\u0430\u043a\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043d\u0438\u0447\u0442\u043e\u0436\u043d\u043e \u043c\u0430\u043b\u0430, \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e \u0432\u0435\u043b\u0438\u043a\u0430, \u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430&#8230;<\/p>\n<p>\u0410 \u0432\u0435\u0434\u044c \u043e\u043d\u0430 \u0443\u0436\u0435 \u0438 \u0442\u0430\u043a \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f &#171;\u043f\u043e\u0434 \u043d\u043e\u0433\u0430\u043c\u0438&#187; \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u043b\u0430\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 &#8212; \u043d\u0430\u0434\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u0448\u044c <strong>\u0443\u0434\u043e\u0431\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c <\/strong>\u0435\u0435!<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code class=\"sql\">EXPLAIN (ANALYZE, COSTS OFF) SELECT * FROM pg_stat_user_tables WHERE schemaname = 'public';<\/code><\/pre>\n<pre><code>GroupAggregate (actual time=15.756..17.407 rows=173 loops=1)   Group Key: c.oid, n.nspname, c.relname   ->  Sort (actual time=4.490..4.771 rows=2806 loops=1)         Sort Key: c.oid, c.relname         Sort Method: quicksort  Memory: 842kB         ->  Nested Loop Left Join (actual time=0.537..3.538 rows=2806 loops=1)               ->  Nested Loop (actual time=0.526..1.228 rows=173 loops=1)                     Join Filter: (c.relnamespace = n.oid)                     Rows Removed by Join Filter: 201                     ->  Index Scan using pg_namespace_nspname_index on pg_namespace n (actual time=0.017..0.018 rows=1 loops=1)                           Index Cond: (nspname = 'public'::name)                           Filter: (nspname !~ '^pg_toast'::text)                     ->  Seq Scan on pg_class c (actual time=0.009..1.168 rows=374 loops=1)                           Filter: (relkind = ANY ('{r,t,m}'::\"char\"[]))                           Rows Removed by Filter: 3187               ->  Index Scan using pg_index_indrelid_index on pg_index i (actual time=0.002..0.010 rows=16 loops=173)                     Index Cond: (c.oid = indrelid) Planning time: 2.398 ms Execution time: 17.660 ms<\/code><\/pre>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043d\u0430\u0448\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043b\u0430\u043d\u043e\u0432 <a href=\"https:\/\/explain.tensor.ru\/archive\/explain\/c1193684f3b43853ca8ebb676b000d0d:0:2022-01-17\">explain.tensor.ru<\/a>, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p><strong>\u041c\u0430\u0440\u043a\u0435\u0440\u044b-\u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438<\/strong> \u0441\u0440\u0430\u0437\u0443 \u0430\u043a\u0446\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0442 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u0435\u0445 \u0443\u0437\u043b\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041d\u043e \u043d\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435 \u043e\u043d\u0438, \u0430 \u0442\u0435 \u0442\u0440\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u043f\u043b\u0430\u043d\u0435, \u0438 \u0438\u0445 \u043f\u043e\u043b\u044f:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e:<\/p>\n<ul>\n<li>\n<p>\u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044e <code>pg_stat_user_tables<\/code> \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0442\u0440\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b: <code>pg_namespace<\/code> (\u0430\u043b\u0438\u0430\u0441 <code>n<\/code>), <code>pg_class<\/code> (\u0430\u043b\u0438\u0430\u0441 <code>c<\/code>) \u0438 <code>pg_index<\/code> (\u0430\u043b\u0438\u0430\u0441 <code>i<\/code>)<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0438 \u0432 \u043d\u0438\u0445 \u043f\u043e\u043b\u0435\u0439 <code>c.oid, c.relname, c.relnamespace, c.relkind, n.oid, n.nspname, i.indrelid<\/code><\/p>\n<\/li>\n<li>\n<p>\u0442\u0430\u043a\u0436\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0437 \u043d\u0438\u0445, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b \u043e\u0431 \u0438\u0445 \u0442\u0438\u043f\u0435:<\/p>\n<ul>\n<li>\n<p><code>n.nspname = 'public'::name => nspname::name<\/code><\/p>\n<\/li>\n<li>\n<p><code>c.relkind = ANY ('{r,t,m}'::\"char\"[]) => relkind::\"char\"<\/code><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u0432\u044f\u0437\u0438 \u044d\u0442\u0438\u0445 \u043f\u043e\u043b\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439:<\/p>\n<ul>\n<li>\n<p><code>c.relnamespace = n.oid<\/code><\/p>\n<\/li>\n<li>\n<p><code>c.oid = i.indrelid<\/code><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u044c <strong>\u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 &#171;\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430&#187;<\/strong> \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e &#8212; \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u0438\u0445 \u043f\u043e\u043b\u044f \u0438 \u0441\u0432\u044f\u0437\u0438:<\/p>\n<figure class=\"\"><figcaption>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0432\u044f\u0437\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u0430\u0437\u044b<\/figcaption><\/figure>\n<p>\u0425\u043e\u0442\u0438\u043c \u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u0435\u0439? \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>VERBOSE<\/code>:<\/p>\n<pre><code class=\"sql\">EXPLAIN (ANALYZE, VERBOSE, COSTS OFF) SELECT * FROM pg_stat_user_tables WHERE schemaname = 'public';<\/code><\/pre>\n<pre><code>GroupAggregate (actual time=26.777..29.790 rows=173 loops=1)   Output: c.oid, n.nspname, c.relname, pg_stat_get_numscans(c.oid), pg_stat_get_tuples_returned(c.oid), (sum(pg_stat_get_numscans(i.indexrelid)))::bigint, ((sum(pg_stat_get_tuples_fetched(i.indexrelid)))::bigint + pg_stat_get_tuples_fetched(c.oid)), pg_stat_get_tuples_inserted(c.oid), pg_stat_get_tuples_updated(c.oid), pg_stat_get_tuples_deleted(c.oid), pg_stat_get_tuples_hot_updated(c.oid), pg_stat_get_live_tuples(c.oid), pg_stat_get_dead_tuples(c.oid), pg_stat_get_mod_since_analyze(c.oid), pg_stat_get_last_vacuum_time(c.oid), pg_stat_get_last_autovacuum_time(c.oid), pg_stat_get_last_analyze_time(c.oid), pg_stat_get_last_autoanalyze_time(c.oid), pg_stat_get_vacuum_count(c.oid), pg_stat_get_autovacuum_count(c.oid), pg_stat_get_analyze_count(c.oid), pg_stat_get_autoanalyze_count(c.oid)   Group Key: c.oid, n.nspname, c.relname   ->  Sort (actual time=13.829..14.284 rows=2806 loops=1)         Output: c.oid, n.nspname, c.relname, i.indexrelid         Sort Key: c.oid, c.relname         Sort Method: quicksort  Memory: 842kB         ->  Nested Loop Left Join (actual time=0.720..11.421 rows=2806 loops=1)               Output: c.oid, n.nspname, c.relname, i.indexrelid               ->  Hash Join (actual time=0.660..1.490 rows=173 loops=1)                     Output: c.oid, c.relname, n.nspname                     Inner Unique: true                     Hash Cond: (c.relnamespace = n.oid)                     ->  Seq Scan on pg_catalog.pg_class c (actual time=0.015..1.376 rows=374 loops=1)                           Output: c.oid, c.relname, c.relnamespace                           Filter: (c.relkind = ANY ('{r,t,m}'::\"char\"[]))                           Rows Removed by Filter: 3187                     ->  Hash (actual time=0.024..0.024 rows=1 loops=1)                           Output: n.nspname, n.oid                           Buckets: 1024  Batches: 1  Memory Usage: 9kB                           ->  Index Scan using pg_namespace_nspname_index on pg_catalog.pg_namespace n (actual time=0.020..0.021 rows=1 loops=1)                                 Output: n.nspname, n.oid                                 Index Cond: (n.nspname = 'public'::name)                                 Filter: (n.nspname !~ '^pg_toast'::text)               ->  Index Scan using pg_index_indrelid_index on pg_catalog.pg_index i (actual time=0.026..0.054 rows=16 loops=173)                     Output: i.indexrelid, i.indrelid, i.indnatts, i.indisunique, i.indisprimary, i.indisexclusion, i.indimmediate, i.indisclustered, i.indisvalid, i.indcheckxmin, i.indisready, i.indislive, i.indisreplident, i.indkey, i.indcollation, i.indclass, i.indoption, i.indexprs, i.indpred                     Index Cond: (c.oid = i.indrelid) Planning time: 3.151 ms Execution time: 30.219 ms<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0437\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u0432\u044f\u0437\u0435\u0439 \u0432 \u0431\u0430\u0437\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0438\u0437 \u0441\u0430\u043c\u043e\u0439 \u0441\u0445\u0435\u043c\u044b:<\/p>\n<pre><code class=\"sql\">EXPLAIN (ANALYZE, COSTS OFF) SELECT * FROM pg_class WHERE relnamespace = (   SELECT oid FROM pg_namespace WHERE nspname = 'public' );<\/code><\/pre>\n<pre><code>Seq Scan on pg_class (actual time=0.020..1.002 rows=2992 loops=1)   Filter: (relnamespace = $0)   Rows Removed by Filter: 569   InitPlan 1 (returns $0)     ->  Index Scan using pg_namespace_nspname_index on pg_namespace (actual time=0.010..0.011 rows=1 loops=1)           Index Cond: (nspname = 'public'::name) Planning time: 0.110 ms Execution time: 1.185 ms<\/code><\/pre>\n<p>\u0418 \u0434\u0430, \u0441\u0432\u044f\u0437\u044c \u0441\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c <code>InitPlan<\/code> \u043c\u044b \u0442\u043e\u0436\u0435 \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u0440\u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b:<\/p>\n<figure class=\"\"><figcaption>\u041e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435 InitPlan \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0431\u0430\u0437\u044b<\/figcaption><\/figure>\n<blockquote>\n<p>\u041f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u043f\u043b\u0430\u043d\u0430 \u0441 \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c\u0438 \u0441\u0442\u0430\u043b\u043e \u0435\u0449\u0435 \u043f\u0440\u043e\u0449\u0435 &#8212; \u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0435 &#171;\u0437\u0435\u0440\u043a\u0430\u043b\u043e&#187; <a href=\"https:\/\/explain-postgresql.com\/\">explain-postgresql.com<\/a>.<\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/tensor\/blog\/646043\/\"> https:\/\/habr.com\/ru\/company\/tensor\/blog\/646043\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-328119","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/328119","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=328119"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/328119\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=328119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=328119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=328119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}