{"id":396009,"date":"2024-06-29T12:34:23","date_gmt":"2024-06-29T12:34:23","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=396009"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=396009","title":{"rendered":"<span>GreenPlum: \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446 AO\/CO<\/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>\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u2014 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0438\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432 <code>UNIQUE \/ PRIMARY KEY<\/code>. \u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u2014 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442. \u0425\u043e\u0442\u044f \u0442\u0430\u043a\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 heap-\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445, \u043e\u043d\u0438 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0432 append optimized \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 (AO\/CO).\u00a0<\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u043a\u0430\u043a \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u043c, \u043a\u0430\u043a \u043e\u043d\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f.\u00a0<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/291\/640\/27e\/29164027e02e8e13c32647853e14ab07.png\" width=\"1560\" height=\"1166\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/291\/640\/27e\/29164027e02e8e13c32647853e14ab07.png\"\/><\/figure>\n<h3>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/h3>\n<pre><code>-- Adding unique constraints while creating a table CREATE TABLE foo(i int UNIQUE) USING ao_row; CREATE TABLE bar(i int PRIMARY KEY) USING ao_column; CREATE TABLE foo2(i int, CONSTRAINT iuniq UNIQUE(i)); CREATE TABLE bar2(i int, CONSTRAINT ipk PRIMARY KEY(i));  -- Adding unique constraints post-table creation CREATE TABLE baz(i int) with (appendonly=true); CREATE UNIQUE INDEX on baz(i);  CREATE TABLE foobar(i int) USING ao_row; ALTER TABLE foobar ADD CONSTRAINT UNIQUE (i); OR ALTER TABLE foobar ADD PRIMARY KEY (i);  -- We will now be able to transform a heap table with -- unique index -> AO\/CO table with unique index CREATE TABLE foobaz(i int unique) using heap; ALTER TABLE foobaz set access method ao_row; <\/code><\/pre>\n<h3>\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0443\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0435, \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442. <code>ShareLock<\/code> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0430\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c B-Tree \u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u043c\u0435\u0440\u0442\u0432\u044b\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u043d\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u0443\u044e\u0442\u0441\u044f). \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438. \u041a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438: \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043a\u043b\u044e\u0447\u0438, \u0432\u044b\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435.<\/p>\n<pre><code>CREATE TABLE foo(i int) USING ao_row; INSERT INTO foo VALUES(1); INSERT INTO foo VALUES(1);  CREATE UNIQUE INDEX on foo(i); ERROR:  could not create unique index \"foo_i_idx\" DETAIL:  Key (i)=(1) is duplicated.<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/206\/691\/0ad\/2066910ad2a7f753101dcc8cbcc832e9.jpg\" alt=\"\" title=\"\" width=\"780\" height=\"100\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/206\/691\/0ad\/2066910ad2a7f753101dcc8cbcc832e9.jpg\" data-blurred=\"true\"\/><\/figure>\n<p><a href=\"https:\/\/slurm.io\/green-plum?utm_source=habr&amp;utm_medium=promo&amp;utm_campaign=green-plum&amp;utm_content=promo_07-04-2023&amp;utm_term=gornushkina\"><u>\u00abDWH\u00a0\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435\u00a0GreenPlum\u00bb<\/u><\/a><\/p>\n<h3>\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432 \u043f\u0440\u0438 \u043f\u0440\u0438\u0451\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<h4>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438<\/h4>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0434\u043b\u044f \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<pre><code>CREATE TABLE foo(i int UNIQUE) USING ao_row; -- reveals unique index created on foo \\d+ foo                                     Table \"public.foo\"  Column |  Type   | Collation | Nullable | Default | Storage | Stats target | Description  --------+---------+-----------+----------+---------+---------+--------------+-------------  i      | integer |           |          |         | plain   |              |  Compression Type: None Compression Level: 0 Block Size: 32768 Checksum: t Indexes:     \"foo_i_key\" UNIQUE CONSTRAINT, btree (i) Distributed by: (i) Access method: ao_row<\/code><\/pre>\n<pre><code>-- Case 0: no conflict as key doesn't exist in the table -- succeeds INSERT INTO foo VALUES(0);<\/code><\/pre>\n<pre><code>-- Case 1: conflict against committed tuple INSERT INTO foo VALUES(1); -- raises conflict INSERT INTO foo VALUES(1); ERROR:  duplicate key value violates unique constraint \"foo_i_key\"  (seg1 ...) DETAIL:  Key (i)=(1) already exists.<\/code><\/pre>\n<pre><code>-- Case 2: conflict against aborted tuple BEGIN; INSERT INTO foo VALUES(2); ABORT;  -- should succeed INSERT INTO foo VALUES(2);<\/code><\/pre>\n<pre><code>-- Case 3: conflict against row inserted by in-progress transaction  -- Session 1: BEGIN; INSERT INTO foo VALUES(3);  -- Session 2: -- will block until transaction in session 1 commits\/aborts INSERT INTO foo VALUES(3);  -- Session 1: COMMIT;  -- Session 2: -- Conflict raised. ERROR:  duplicate key value violates unique constraint \"foo_i_key\"  (seg0 ...) DETAIL:  Key (i)=(3) already exists. <\/code><\/pre>\n<pre><code>-- Case 4: Conflict against a deleted tuple DELETE FROM foo WHERE i = 1; -- should succeed INSERT INTO foo VALUES(1);<\/code><\/pre>\n<h4>\u041e\u0431\u0449\u0438\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c<\/h4>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0430, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 INSERT \u0438\u043b\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 INSERT, \u043e\u043d \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0415\u0441\u043b\u0438 \u0442\u0435\u0441\u0442 \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0439\u0434\u0451\u043d \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u043e. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 ERROR, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438 \u043a\u043e\u0440\u0442\u0435\u0436 \u0441\u0442\u0430\u043d\u0435\u0442 \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u044b\u043c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f MVCC.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u2014 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0443 \u043d\u0430\u0441 \u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0434\u043b\u044f \u043a\u043b\u044e\u0447\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0430. \u0415\u0441\u043b\u0438 \u043a\u043e\u0440\u0442\u0435\u0436 \u0441 \u0442\u0430\u043a\u0438\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0441\u044f (\u043a\u0435\u0439\u0441 0), \u0442\u043e \u0448\u0430\u043d\u0441\u043e\u0432 \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430 \u043d\u0435\u0442. \u0415\u0441\u043b\u0438 \u043c\u044b \u043d\u0430\u0439\u0434\u0451\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u2014 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0435\u0439\u0441 2, 3 \u0438\u043b\u0438 4 (\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432\u044b\u0448\u0435). \u0412 \u044d\u0442\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u044b\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e vacuum-time. \u0412\u0442\u043e\u0440\u043e\u0439 \u0448\u0430\u0433 \u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u0430. \u0415\u0441\u043b\u0438 \u043d\u0430\u0439\u0434\u0451\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c TID (\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043e\u0440\u0442\u0435\u0436\u0430) \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e tid. \u0415\u0441\u043b\u0438 \u043a\u043e\u0440\u0442\u0435\u0436 \u0432\u0438\u0434\u0435\u043d, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 (\u043a\u0435\u0439\u0441 3) \u0438\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 (\u043a\u0435\u0439\u0441 1). \u0415\u0441\u043b\u0438 \u043a\u043e\u0440\u0442\u0435\u0436 \u043d\u0435 \u0432\u0438\u0434\u0435\u043d (\u043a\u0435\u0439\u0441\u044b 2 \u0438 4), \u0442\u043e \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430 \u043d\u0435\u0442.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u00ab\u0433\u0440\u044f\u0437\u043d\u044b\u0439\u00bb \u0441\u043d\u0430\u043f\u0448\u043e\u0442, \u0447\u0442\u043e\u0431\u044b \u00ab\u0443\u0432\u0438\u0434\u0435\u0442\u044c\u00bb \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u0430, \u0435\u0441\u0442\u044c \u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p>\u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0441\u043e\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439 (\u043a\u0435\u0439\u0441 1);<\/p>\n<\/li>\n<li>\n<p>\u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439 (\u043a\u0435\u0439\u0441 2);<\/p>\n<\/li>\n<li>\n<p>\u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439 (\u043a\u0435\u0439\u0441 3)<\/p>\n<\/li>\n<li>\n<p>\u0443\u0434\u0430\u043b\u0435\u043d\u044b \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (\u043a\u0435\u0439\u0441 4)<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u0435\u0439\u0441\u044b, \u043d\u043e \u043e\u043d\u0438 \u043b\u0438\u0431\u043e \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c AO\/CO, \u043b\u0438\u0431\u043e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b \u0434\u043b\u044f \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f.\u00a0<\/p>\n<h4>Heap tables<\/h4>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 \u0432 heap-\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u043f\u0440\u043e\u0441\u0442\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u0440\u0442\u0435\u0436\u0435 (xmin \u0438 xmax). \u0412\u0441\u0451, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e \u00ab\u0432\u044b\u0431\u0440\u0430\u0442\u044c\u00bb \u043a\u043e\u0440\u0442\u0435\u0436 \u043f\u043e \u0435\u0433\u043e tid \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c xmin\/xmax \u0441\u043e \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u043e\u043c.<\/p>\n<pre><code>-- Setup CREATE EXTENSION pageinspect;<\/code><\/pre>\n<pre><code>-- Case 1: conflict against committed tuple CREATE TABLE foo(i int UNIQUE) USING heap DISTRIBUTED REPLICATED; INSERT INTO foo VALUES(1);  -- In utility mode on seg0, run inspection functions:  SELECT * FROM bt_page_items('foo_i_key', 1);  itemoffset | ctid  | itemlen | nulls | vars |          data            ------------+-------+---------+-------+------+-------------------------           1 | (0,1) |      16 | f     | f    | 01 00 00 00 00 00 00 00 (1 row)  -- Since we have a live index entry for i = 1 pointing to tid `(0,1)` -- any insert for key i = 1 will have to determine tuple visibility.  SELECT     ctid, i,     txid_status(xmin::text::bigint) AS inserting_xid_status,     txid_status(xmax::text::bigint) AS deleting_xid_status FROM foo;  ctid  | i | inserting_xid_status | deleting_xid_status  -------+---+----------------------+---------------------  (0,1) | 1 | committed            |  (1 row)  -- Since the tuple has its xmin committed, it is visible and the following -- will raise a conflict. INSERT INTO foo VALUES(1); ERROR:  duplicate key value violates unique constraint \"foo_i_key\"  (seg1 ...) DETAIL:  Key (i)=(1) already exists.<\/code><\/pre>\n<pre><code>-- Case 2: conflict against aborted tuple CREATE TABLE foo(i int UNIQUE) USING heap DISTRIBUTED REPLICATED; BEGIN; INSERT INTO foo VALUES(2); ABORT;  -- In utility mode on seg0, run inspection functions:  SELECT * FROM bt_page_items('foo_i_key', 1);  itemoffset | ctid  | itemlen | nulls | vars |          data            ------------+-------+---------+-------+------+-------------------------           1 | (0,1) |      16 | f     | f    | 02 00 00 00 00 00 00 00 (1 row)  -- Since we have a live index entry for i = 1 pointing to tid `(0,2)` -- any insert for key i = 1 will have to determine tuple visibility.  SET gp_select_invisible TO ON; SELECT     ctid, i,     txid_status(xmin::text::bigint) AS inserting_xid_status,     txid_status(xmax::text::bigint) AS deleting_xid_status FROM foo;  ctid  | i | inserting_xid_status | deleting_xid_status  -------+---+----------------------+---------------------  (0,1) | 2 | aborted              |  (1 row)  -- Since the tuple has its xmin aborted, it is invisible and the following -- will succeed. INSERT INTO foo VALUES(2);<\/code><\/pre>\n<pre><code>-- Case 3: conflict against row inserted by in-progress transaction CREATE TABLE foo(i int UNIQUE) USING heap DISTRIBUTED REPLICATED;  -- Session 1: BEGIN; INSERT INTO foo VALUES(3);  -- Session 3: (for snooping) - in utility mode on segment 0  SELECT * FROM bt_page_items('foo_i_key', 1);  itemoffset | ctid  | itemlen | nulls | vars |          data            ------------+-------+---------+-------+------+-------------------------           1 | (0,1) |      16 | f     | f    | 03 00 00 00 00 00 00 00 (1 row)  -- Since we have a live index entry for i = 3 pointing to tid `(0,1)` -- any insert for key i = 3 will have to determine tuple visibility.  SELECT     ctid, i,     txid_status(xmin::text::bigint) AS inserting_xid_status,     txid_status(xmax::text::bigint) AS deleting_xid_status FROM foo; SET  ctid  | i | inserting_xid_status | deleting_xid_status  -------+---+----------------------+---------------------  (0,1) | 3 | in progress          |  (1 row)  -- Session 2: -- Since the tuple has its xmin in-progress, meaning its inserting -- transaction is still running, the backend will go into an xwait -- state to wait for the inserting transaction to complete. INSERT INTO foo VALUES(3); -- will block  -- Session 1: COMMIT;  -- Session 2: -- Since Session 1 committed, Session 2 will wake up and retry the -- insert and will raise a conflict. ERROR:  duplicate key value violates unique constraint \"foo_i_key\"  (seg0 ...) DETAIL:  Key (i)=(3) already exists.<\/code><\/pre>\n<pre><code>-- Case 4: Conflict against a deleted tuple CREATE TABLE foo(i int UNIQUE) USING heap DISTRIBUTED REPLICATED; INSERT INTO foo VALUES(1); DELETE FROM foo WHERE i = 1;  -- In utility mode on seg0, run inspection functions:  SELECT * FROM bt_page_items('foo_i_key', 1);  itemoffset | ctid  | itemlen | nulls | vars |          data            ------------+-------+---------+-------+------+-------------------------           1 | (0,1) |      16 | f     | f    | 01 00 00 00 00 00 00 00 (1 row)  -- Since we have a live index entry for i = 1 pointing to tid `(0,1)` -- any insert for key i = 1 will have to determine tuple visibility.  SELECT     ctid, i,     txid_status(xmin::text::bigint) AS inserting_xid_status,     txid_status(xmax::text::bigint) AS deleting_xid_status FROM foo; SET  ctid  | i | inserting_xid_status | deleting_xid_status  -------+---+----------------------+---------------------  (0,1) | 1 | committed            | committed (1 row)  -- Since the tuple has its xmax committed, it is deleted and invisible, -- and thus the following will succeed. INSERT INTO foo VALUES(1);<\/code><\/pre>\n<h3>AO\/CO-\u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>\u041a\u043e\u0440\u0442\u0435\u0436\u0438 AO\/CO \u043d\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u044e\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u0445\u0440\u0430\u043d\u044f\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f \u043f\u043e\u043b\u044f xmin\/xmax, \u0447\u0442\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u044f\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0438\u0445 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u044f\u0437\u0438 (\u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0431\u043b\u043e\u043a\u043e\u0432 \u0438 \u043a\u0430\u0440\u0442\u0443 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f heap-\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438.<\/p>\n<h4>Block directory<\/h4>\n<p>\u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 AO\/CO \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438. TID \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043d\u043e\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0438 \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u0430. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0431\u043b\u043e\u043a\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e \u043a\u043e\u0440\u0442\u0435\u0436. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043a\u043e\u0440\u0442\u0435\u0436, \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0432 \u0431\u043b\u043e\u043a.<\/p>\n<p>\u041e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445. xmin \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u0430 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d xmin \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u0440\u0442\u0435\u0436\u0430 (\u0434\u043b\u044f \u043a\u0435\u0439\u0441\u043e\u0432 1,2,3), \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0432 \u043d\u0430 \u043f\u043e\u043b\u044f xmin \u0438 xmax \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432. \u041f\u043e \u0441\u0443\u0442\u0438, \u043d\u0430\u043c \u0434\u0430\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0440\u0442\u0435\u0436 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0434\u0438\u0441\u043a\u0430 \u2014 \u0435\u0441\u043b\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0431\u043b\u043e\u043a\u043e\u0432 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043d\u0430\u043c, \u0447\u0442\u043e \u0432 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e varblock \u0438\u043b\u0438 segfile \u0435\u0441\u0442\u044c \u043a\u043e\u0440\u0442\u0435\u0436, \u043d\u0430\u043c \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.\u00a0<\/p>\n<pre><code>-- Case 1: conflict against committed tuple CREATE TABLE foo(i int UNIQUE) USING ao_row DISTRIBUTED REPLICATED; INSERT INTO foo VALUES(1);  -- In utility mode on seg0, run inspection functions:  SELECT * FROM bt_page_items('foo_i_key', 1);  itemoffset | ctid  | itemlen | nulls | vars |          data            ------------+-------+---------+-------+------+-------------------------           1 | (0,2) |      16 | f     | f    | 01 00 00 00 00 00 00 00 (1 row)   -- Since we have a live index entry for i = 1 pointing to tid `(0,2)` -- any insert for key i = 1 will have to determine tuple visibility.  -- First obtain the name of the block directory relation SELECT oid::regclass FROM pg_class WHERE oid =     (SELECT blkdirrelid FROM pg_appendonly WHERE relid = 'foo'::regclass);              oid              -----------------------------  pg_aoseg.pg_aoblkdir_442697 (1 row)  -- Then inspect the transaction status of the block directory row that -- covers the data row. SELECT     ctid, segno, first_row_no,      txid_status(xmin::text::bigint) AS inserting_xid_status,     txid_status(xmax::text::bigint) AS deleting_xid_status FROM pg_aoseg.pg_aoblkdir_442697;  ctid  | segno | first_row_no | inserting_xid_status | deleting_xid_status  -------+-------+--------------+----------------------+---------------------  (0,2) |     0 |            1 | committed            |  (1 row)  -- Since the block directory row has its xmin committed, it is visible and -- by extension so is the data tuple. So, this will raise a conflict. INSERT INTO foo VALUES(1); ERROR:  duplicate key value violates unique constraint \"foo_i_key\"  (seg1 ...) DETAIL:  Key (i)=(1) already exists.<\/code><\/pre>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043a\u0435\u0439\u0441\u043e\u0432 2 \u0438 3 \u043a\u043e\u0440\u0442\u0435\u0436 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441\u044b \u00ab\u043f\u0440\u0435\u0440\u0432\u0430\u043d\u043e\u00bb \u0438 \u00ab\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435\u00bb \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0418 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 heap-\u043a\u043e\u0440\u0442\u0435\u0436\u0430\u043c.<\/p>\n<h4>Block directory internals<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u044e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c, \u043a\u0430\u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441\u0442\u0440\u043e\u043a\u0438 \u0431\u043b\u043e\u0447\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/33c\/c79\/a24\/33cc79a247121dc0a0e64bd4e594cd74.png\" width=\"936\" height=\"380\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/33c\/c79\/a24\/33cc79a247121dc0a0e64bd4e594cd74.png\"\/><\/figure>\n<p>\u041a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435, \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432. \u0418\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <code>first_row_no<\/code> \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0441\u0442\u0440\u043e\u043a, \u043e\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432, \u0432 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435 \u0444\u0430\u0439\u043b\u0430 <code>segno<\/code>. \u0415\u0441\u043b\u0438 \u043c\u044b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0432 \u043d\u0435\u0439 \u0435\u0441\u0442\u044c \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446: <code>minipage<\/code>. \u041c\u0438\u043d\u0438-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0445\u0440\u0430\u043d\u0438\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 161 \u0437\u0430\u043f\u0438\u0441\u044c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432. \u041a\u0430\u0436\u0434\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043d\u0430\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d\u0430 \u043e\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442, \u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u044e \u2014 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432 \u0437\u0430\u0434\u043e\u043b\u0433\u043e \u0434\u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0431\u044b\u0447\u043d\u043e \u043e\u043d\u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b:<\/p>\n<ul>\n<li>\n<p>\u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 (\u043d\u0435 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438!)<\/p>\n<\/li>\n<li>\n<p>\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 (\u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432 \u043c\u043e\u0433\u0443\u0442 \u043e\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439, \u0430 varblocks \u2014 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a).\u00a0<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u0430\u043a, \u0435\u0441\u0442\u044c \u043e\u043a\u043d\u0430, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0430 \u0438\u0445 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432 \u2014 \u043d\u0435\u0442. \u0427\u0442\u043e \u0431\u044b \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u0435\u0441\u043b\u0438 \u0432 \u044d\u0442\u043e\u043c \u043e\u043a\u043d\u0435 \u0431\u044b\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430? \u041e\u043d \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0431\u044b \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432 \u0434\u043b\u044f \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u0438 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b \u0431\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e (<em>\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0431\u044b\u043b\u043e \u0431\u044b \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \/ \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u0438<\/em>).\u00a0<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 <strong>\u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c placeholder entry<\/strong> (\u0432\u0432\u043e\u0434\u0430 \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440\u0430).<\/p>\n<h4>Placeholder block directory entries<\/h4>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0437\u0430\u043f\u0438\u0441\u044c-\u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u0430 <code>segno<\/code>. \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u044d\u0442\u0443 \u0437\u0430\u043f\u0438\u0441\u044c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/02f\/b33\/8bb\/02fb338bba76277bfa0e68adf42c64e5.png\" width=\"936\" height=\"380\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/02f\/b33\/8bb\/02fb338bba76277bfa0e68adf42c64e5.png\"\/><\/figure>\n<p>\u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e <code>segno<\/code> \u0432\u0441\u0435 \u0431\u0443\u0434\u0443\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c <code>segno<\/code> \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 \u0442\u0430\u043a\u0438\u0445 \u043e\u043a\u043d\u0430\u0445, \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043a\u0440\u044b\u0442\u044b \u044d\u0442\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043b\u044e\u0431\u044b\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u0432 \u0442\u0430\u043a\u0438\u0445 \u043e\u043a\u043d\u0430\u0445, \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443. \u0418 \u0437\u0430\u0442\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439. \u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u043a\u0430\u043a \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u044d\u0442\u0438\u0445 \u043e\u043a\u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aeb\/ebc\/849\/aebebc84987476a6227c1ad09ca79009.png\" width=\"936\" height=\"272\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aeb\/ebc\/849\/aebebc84987476a6227c1ad09ca79009.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/10d\/44f\/316\/10d44f3163006fad55587e7e2784d02f.png\" width=\"936\" height=\"442\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/10d\/44f\/316\/10d44f3163006fad55587e7e2784d02f.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/611\/307\/2a3\/6113072a322a49d503415b93f000aea9.png\" width=\"936\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/611\/307\/2a3\/6113072a322a49d503415b93f000aea9.png\"\/><\/figure>\n<h2>\u041a\u0430\u0440\u0442\u0430 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438<\/h2>\n<p>\u041c\u044b \u0435\u0449\u0451 \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e\u0431 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438. \u041a\u043e\u0433\u0434\u0430 \u043a\u043e\u0440\u0442\u0435\u0436 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b AO\/CO, \u043f\u043e\u0434\u043e\u0431\u043d\u043e heap-\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c, \u043e\u043d \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u0440\u0435\u0444\u0430\u0439\u043b\u0430. \u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e VACUUM. \u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0434\u043b\u044f \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e VACUUM. \u0421\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0440\u0442\u044b \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435, \u0441\u043e\u043e\u0431\u0449\u0430\u044e\u0449\u0438\u0435 \u043d\u0430\u043c, \u0447\u0442\u043e \u043a\u043e\u0440\u0442\u0435\u0436 \u0431\u044b\u043b \u0443\u0434\u0430\u043b\u0451\u043d. \u0417\u0430\u043f\u0438\u0441\u044c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f. \u041a\u0430\u043a \u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432, \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 visimap \u043e\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445. \u0418\u0442\u0430\u043a, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 visimap, \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0437\u043d\u0430\u0447\u0438\u0442, \u0441\u0442\u0440\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u0434\u0430\u043b\u0435\u043d\u0430 (<em>\u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u0443\u044e \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443<\/em>).<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432, \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442. \u0421\u0442\u0440\u043e\u043a\u0430 \u043c\u043e\u0433\u043b\u0430 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u0430. \u0418\u0442\u0430\u043a, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u043f\u043e visimap.<\/p>\n<pre><code>-- Case 4: Conflict against a deleted tuple CREATE TABLE foo(i int UNIQUE) USING ao_row DISTRIBUTED REPLICATED; INSERT INTO foo VALUES(1); DELETE FROM foo WHERE i = 1;  -- In utility mode on seg0, run inspection functions:  SELECT * FROM bt_page_items('foo_i_key', 1);  itemoffset | ctid  | itemlen | nulls | vars |          data            ------------+-------+---------+-------+------+-------------------------           1 | (0,1) |      16 | f     | f    | 01 00 00 00 00 00 00 00 (1 row)  -- Since we have a live index entry for i = 1 pointing to tid `(0,1)` -- any insert for key i = 1 will have to determine tuple visibility.  SELECT     ctid, *,     txid_status(xmin::text::bigint) AS inserting_xid_status,     txid_status(xmax::text::bigint) AS deleting_xid_status FROM pg_aoseg.pg_aovisimap_442709;  ctid  | segno | first_row_no |        visimap         | inserting_xid_status | deleting_xid_status  -------+-------+--------------+------------------------+----------------------+---------------------  (0,1) |     0 |            0 | \\x01000000000102000000 | committed            |  (1 row)  -- Since the visimap tuple has its xmin committed, it is visible and thus -- the data tuple it is covering is deleted. So the following succeeds. INSERT INTO foo VALUES(1);<\/code><\/pre>\n<h3>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u00ab\u043b\u0435\u043d\u0438\u0432\u044b\u043c \u0432\u0430\u043a\u0443\u0443\u043c\u043e\u043c\u00bb<\/h3>\n<p>Lazy VACUUM (<code>VACUUM<\/code> \u0431\u0435\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <code>FULL<\/code>) \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446 AO\/CO \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 heap-\u0442\u0430\u0431\u043b\u0438\u0446. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 heap-\u0442\u0430\u0431\u043b\u0438\u0446, \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 AO\/CO \u0443 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b \u0438\u0445 ctid. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0438\u0437 seg-\u0444\u0430\u0439\u043b\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 (\u00ab\u0432\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f\u00bb \u0432 \u043d\u043e\u0432\u044b\u0439 seg-\u0444\u0430\u0439\u043b). \u041c\u0451\u0440\u0442\u0432\u044b\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c segfile, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u00ab\u0441\u0436\u0430\u0442\u00bb.<\/p>\n<h4>\u041a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u044b \u0432 \u00ab\u0436\u0438\u0432\u044b\u0445\u00bb \u043a\u043e\u0440\u0442\u0435\u0436\u0430\u0445<\/h4>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u00ab\u043b\u0435\u043d\u0438\u0432\u044b\u0439\u00bb VACUUM \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0441\u043e \u0432\u0441\u0442\u0430\u0432\u043a\u0430\u043c\u0438, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u044b.<\/p>\n<p>\u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u043b\u0435\u043d\u0438\u0432\u044b\u0439 VACUUM \u043d\u0430 \u0442\u0440\u0438 \u0444\u0430\u0437\u044b:<\/p>\n<ul>\n<li>\n<p>\u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u2013 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0432\u0441\u0442\u0430\u0432\u043a\u0438 (<em>\u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u043e\u0432\u044b\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u043e\u0432\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0438, \u043a\u0430\u043a \u043f\u0440\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0432\u0441\u0442\u0430\u0432\u043a\u0435<\/em>);<\/p>\n<\/li>\n<li>\n<p>\u0432\u0441\u0442\u0430\u0432\u043a\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f, \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0451\u043d\u043d\u044b\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442 \u0441\u0432\u043e\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0442\u0430\u0440\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0438, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0451\u043d\u043d\u044b\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0438, \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0435\u0430\u043d\u0441\u0430 VACUUM \u0438\u0437\u043b\u0438\u0448\u043d\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u044f, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c\u044b\u0445 \u00ab\u0436\u0438\u0432\u044b\u0445\u00bb \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 \u043d\u0435\u0442 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u0435 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u0442\u0440\u0435\u0442\u0435\u0439 \u0444\u0430\u0437\u044b, \u0441\u0442\u0430\u0440\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 (\u043e\u043d\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043d\u0430\u0434 \u043d\u043e\u0432\u044b\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0438\u0437-\u0437\u0430 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0430 \u043a\u043e\u0434\u0430 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 B-Tree). \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u043d\u0443\u0436\u0435\u043d placeholder-\u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c. \u041f\u043e\u0441\u043b\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432.\u00a0<\/p>\n<h3>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h3>\n<h4>\u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>\u041d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c \u0432 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446:<\/p>\n<ul>\n<li>\n<p>heap-\u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u043d\u0435\u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>heap-\u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>AO \u0441 \u043d\u0435\u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>AO \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>AOCO \u0441 \u043d\u0435\u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>AOCO \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041a\u0435\u0439\u0441 0<\/strong>: \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u044f \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u043d\u0435 \u0431\u044b\u043b\u043e \u0440\u0430\u043d\u0435\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0432\u0448\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0430.<\/p>\n<p><strong>\u041a\u0435\u0439\u0441 2<\/strong>: \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0442 \u0441 \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438.<\/p>\n<p><strong>\u041a\u0435\u0439\u0441 4<\/strong>: \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0442 \u0441 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438.<\/p>\n<p>\u041c\u044b \u0445\u043e\u0442\u0438\u043c \u0443\u0437\u043d\u0430\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043f\u0440\u0438\u0451\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430\u0441 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u043a\u0435\u0439\u0441\u044b 1 \u0438 3, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e \u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044e xwait \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0445 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p><strong>\u041a\u0435\u0439\u0441 0<\/strong>: \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u044e\u0447\u0438 [1,100000000] \u0432 \u043f\u0443\u0441\u0442\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u043c, \u0441\u043b\u0443\u0436\u0430\u0449\u0438\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c.\u00a0<\/p>\n<p><strong>\u041a\u0435\u0439\u0441 2<\/strong>: \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u044e\u0447\u0438 [1,100000000] \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u043c, \u0441\u043b\u0443\u0436\u0430\u0449\u0438\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043a\u043b\u044e\u0447\u0438 [1,100000000], \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0438\u0437 \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438.\u00a0<\/p>\n<p><strong>\u041a\u0435\u0439\u0441 4<\/strong>: \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u044e\u0447\u0438 [1,100000000] \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u043c, \u0441\u043b\u0443\u0436\u0430\u0449\u0438\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043a\u043b\u044e\u0447\u0438 [1,100000000], \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/579\/ebc\/f7a\/579ebcf7a0e38bad4c65b39bb86e15fd.png\" width=\"936\" height=\"246\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/579\/ebc\/f7a\/579ebcf7a0e38bad4c65b39bb86e15fd.png\"\/><\/figure>\n<h3>\u0410\u043d\u0430\u043b\u0438\u0437<\/h3>\n<h4>\u041a\u0435\u0439\u0441 0 [\u043b\u0443\u0447\u0448\u0438\u0439 \u043a\u0435\u0439\u0441]<\/h4>\n<p>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0437\u0434\u0435\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a: \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442 (<em>\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u043d\u0438 \u043e\u0434\u043d\u043e\u0439, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u0445 \u043d\u0435\u0442<\/em>). \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u043b\u044e\u0447\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0442\u0430\u043a \u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u043d\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0430 \u0434\u0438\u0441\u043a\u0435. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u043e\u0431\u0449\u0435\u043c\u0443 \u0431\u0443\u0444\u0435\u0440\u0443. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043e\u0431\u0449\u0438\u0445 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u043c\u043e\u0433\u0443\u0442 \u0441\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0437\u0430\u043c\u0435\u0442\u043d\u044b\u043c\u0438.<\/p>\n<h4>\u041a\u0435\u0439\u0441 2 [\u0445\u0443\u0434\u0448\u0438\u0439 \u043a\u0435\u0439\u0441]<\/h4>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f. \u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0435\u043c 0, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043d\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 (\u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043d\u0435\u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432). \u041f\u043e\u0447\u0435\u043c\u0443? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0432 \u043a\u043e\u0434\u0435 btree \u0435\u0441\u0442\u044c \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u0438\u0437-\u0437\u0430 \u0440\u0430\u043d\u0435\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0432\u0448\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u2014 \u043c\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0434\u0442\u0438 \u043f\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u043c\u0443 \u043f\u0443\u0442\u0438 btree \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043b\u044e\u0447\u0438 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<p>\u0412\u0438\u0434\u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0435\u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 \u043f\u043e \u0432\u0441\u0435\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u043c\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u2014 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u0440\u0442\u0435\u0436\u0438. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043b\u044f heap \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 xmin \u0441\u043e\u0432\u043c\u0435\u0449\u0435\u043d \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0434\u043b\u044f AO\/CO \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a, \u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0431\u043b\u043e\u043a\u043e\u0432. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b AO\/CO \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 1,3 \u0440\u0430\u0437\u0430 \u0434\u043e\u0440\u043e\u0436\u0435, \u0447\u0435\u043c heap-\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438.<\/p>\n<p>\u0423 \u0442\u0430\u0431\u043b\u0438\u0446 AO \u0438 AOC \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430\u044f \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 \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u043f\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e 1 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443 \u0431\u043b\u043e\u043a\u043e\u0432.<\/p>\n<h4>\u041a\u0435\u0439\u0441 4 [\u0445\u0443\u0434\u0448\u0438\u0439 \u043a\u0435\u0439\u0441]<\/h4>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f. \u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0435\u043c 0, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043d\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043d\u0435\u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432.\u00a0<\/p>\n<p>\u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u0437\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0435\u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 \u043f\u043e \u0432\u0441\u0435\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c. \u041d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043c\u0435\u0436\u0434\u0443 \u043a\u0435\u0439\u0441\u043e\u043c 2 \u0438 \u043a\u0435\u0439\u0441\u043e\u043c 4 \u0434\u043b\u044f heap-\u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043a\u0435\u0439\u0441 2 \u2014 \u044d\u0442\u043e \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u0435\u0439\u0441 xmin, \u0430 \u043a\u0435\u0439\u0441 4 \u2013 \u0441\u043e\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u044b\u0439 \u043a\u0435\u0439\u0441 xmax.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446 AO\/CO \u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0445 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043a\u0435\u0439\u0441\u043e\u043c 2. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u043e\u0438\u0441\u043a\u0430\u043c\u0438 \u043f\u043e visimap \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0431\u044b\u043b \u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d \u043a\u043e\u0440\u0442\u0435\u0436 \u0438\u043b\u0438 \u043d\u0435\u0442. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b AO\/CO \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 2 \u0440\u0430\u0437\u0430 \u0434\u043e\u0440\u043e\u0436\u0435, \u0447\u0435\u043c heap-\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438.<\/p>\n<h3>\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440<\/h3>\n<p>\u0421\u043e\u043e\u0431\u0449\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440\u0443 \u043e\u0431 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430, \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0421 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u00ab\u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c\u00bb, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0440\u044f\u0434\u0443 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439:<\/p>\n<ul>\n<li>\n<p>\u200b\u200bndistinct = no_of_rows;<\/p>\n<\/li>\n<li>\n<p>\u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c MCV;<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0440\u0443\u043f\u043f = no_of_rows \u0434\u043b\u044f GROUP BY unique_index_column;<\/p>\n<\/li>\n<li>\n<p>\u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u0430\u044f \u0438\u0437\u0431\u0438\u0440\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>join elimination.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u043d\u0438 \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u043b\u044f heap \u0438 \u0433\u043e\u0442\u043e\u0432\u044b \u043a \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 AO\/CO, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b AM. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 join elimination:<\/p>\n<pre><code>CREATE TABLE customer(first_name text, address_id int unique) USING ao_row; CREATE TABLE address (address_id int unique, address text) USING ao_row;  EXPLAIN SELECT first_name FROM customer c LEFT JOIN address a ON c.address_id = a.address_id;                                      QUERY PLAN                                      -----------------------------------------------------------------------------------  Gather Motion 3:1  (slice1; segments: 3)  (cost=0.00..860.67 rows=49600 width=32)    ->  Seq Scan on customer c  (cost=0.00..199.33 rows=16533 width=32)  Optimizer: Postgres query optimizer (3 rows)<\/code><\/pre>\n<h3>\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f: \u043b\u0443\u0447\u0448\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438<\/h3>\n<ul>\n<li>\n<p>\u0421\u0442\u0440\u0435\u043c\u0438\u0442\u044c\u0441\u044f \u043a \u043a\u0435\u0439\u0441\u0443 0 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0451, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043a\u0435\u0439\u0441\u043e\u0432 2 \u0438 4. \u041a\u0435\u0439\u0441 1 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0439 VACUUM \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043d\u0430 \u043c\u0435\u0440\u0442\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u0430\u043a \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446 AO\/CO, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f heap-\u0442\u0430\u0431\u043b\u0438\u0446. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u0435\u0439\u0441\u044b 2 \u0438 4 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u0435\u0439\u0441 0.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u0442\u0430\u0431\u043b\u0438\u0446 AO\/CO \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e, \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0435\u0435\u0441\u044f \u0432 \u043e\u0447\u0438\u0441\u0442\u043a\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439. \u0420\u0430\u0437\u0434\u0443\u0442\u044b\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0433\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446 AO\/CO, \u0435\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u043d\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432\u0430\u043b\u0438 \u043f\u043e \u043a\u043b\u044e\u0447\u0443, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043a\u0435\u0439\u0441\u043e\u0432 2, 3 \u0438 4.<\/p>\n<\/li>\n<li>\n<p>xwaits \u0438\u0437-\u0437\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e:<\/p>\n<\/li>\n<\/ul>\n<pre><code>-- ps display (on the segment hosts): 1294654 \u2026 postgres:  7003, ... sdw1(33842) con25 seg1 cmd6 MPPEXEC INSERT waiting  -- all backends on all segments that are stuck on a xwait SELECT gp_execution_segment(), pid, sess_id, wait_event_type, wait_event, state, backend_xid, query FROM gp_dist_random('pg_stat_activity')     WHERE wait_event = 'transactionid' and wait_event_type = 'Lock';  -[ RECORD 1 ]--------+------------------------- gp_execution_segment | 1 pid                  | 3099493 sess_id              | 747 wait_event_type      | Lock wait_event           | transactionid state                | active backend_xid          | 17616 query                | insert into h values(1);   -- backend on coordinator running the query that is doing -- xwait on some segment(s) SELECT pid, sess_id, wait_event_type, wait_event, state, query FROM pg_stat_activity WHERE sess_id =      (SELECT sess_id FROM gp_dist_random('pg_stat_activity') WHERE          wait_event = 'transactionid' and wait_event_type = 'Lock');          -[ RECORD 1 ]---+------------------------- pid             | 3099446 sess_id         | 747 wait_event_type | IPC wait_event      | Dispatch\/Result state           | active query           | insert into h values(1);<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/206\/691\/0ad\/2066910ad2a7f753101dcc8cbcc832e9.jpg\" alt=\"\" title=\"\" width=\"780\" height=\"100\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/206\/691\/0ad\/2066910ad2a7f753101dcc8cbcc832e9.jpg\" data-blurred=\"true\"\/><\/figure>\n<p><a href=\"https:\/\/slurm.io\/green-plum?utm_source=habr&amp;utm_medium=promo&amp;utm_campaign=green-plum&amp;utm_content=promo_07-04-2023&amp;utm_term=gornushkina\"><u>\u00abDWH\u00a0\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435\u00a0GreenPlum\u00bb<\/u><\/a><\/p>\n<\/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\/727564\/\"> https:\/\/habr.com\/ru\/articles\/727564\/<\/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>\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u2014 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0438\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432 <code>UNIQUE \/ PRIMARY KEY<\/code>. \u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u2014 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442. \u0425\u043e\u0442\u044f \u0442\u0430\u043a\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 heap-\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445, \u043e\u043d\u0438 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0432 append optimized \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 (AO\/CO).\u00a0<\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u043a\u0430\u043a \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u043c, \u043a\u0430\u043a \u043e\u043d\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f.\u00a0<\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/h3>\n<pre><code>-- Adding unique constraints while creating a table CREATE TABLE foo(i int UNIQUE) USING ao_row; CREATE TABLE bar(i int PRIMARY KEY) USING ao_column; CREATE TABLE foo2(i int, CONSTRAINT iuniq UNIQUE(i)); CREATE TABLE bar2(i int, CONSTRAINT ipk PRIMARY KEY(i));  -- Adding unique constraints post-table creation CREATE TABLE baz(i int) with (appendonly=true); CREATE UNIQUE INDEX on baz(i);  CREATE TABLE foobar(i int) USING ao_row; ALTER TABLE foobar ADD CONSTRAINT UNIQUE (i); OR ALTER TABLE foobar ADD PRIMARY KEY (i);  -- We will now be able to transform a heap table with -- unique index -> AO\/CO table with unique index CREATE TABLE foobaz(i int unique) using heap; ALTER TABLE foobaz set access method ao_row; <\/code><\/pre>\n<h3>\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0443\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0435, \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442. <code>ShareLock<\/code> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0430\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c B-Tree \u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u043c\u0435\u0440\u0442\u0432\u044b\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u043d\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u0443\u044e\u0442\u0441\u044f). \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438. \u041a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438: \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043a\u043b\u044e\u0447\u0438, \u0432\u044b\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435.<\/p>\n<pre><code>CREATE TABLE foo(i int) USING ao_row; INSERT INTO foo VALUES(1); INSERT INTO foo VALUES(1);  CREATE UNIQUE INDEX on foo(i); ERROR:  could not create unique index \"foo_i_idx\" DETAIL:  Key (i)=(1) is duplicated.<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p><a href=\"https:\/\/slurm.io\/green-plum?utm_source=habr&amp;utm_medium=promo&amp;utm_campaign=green-plum&amp;utm_content=promo_07-04-2023&amp;utm_term=gornushkina\"><u>\u00abDWH\u00a0\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435\u00a0GreenPlum\u00bb<\/u><\/a><\/p>\n<h3>\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432 \u043f\u0440\u0438 \u043f\u0440\u0438\u0451\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<h4>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438<\/h4>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0434\u043b\u044f \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<pre><code>CREATE TABLE foo(i int UNIQUE) USING ao_row; -- reveals unique index created on foo \\d+ foo                                     Table \"public.foo\"  Column |  Type   | Collation | Nullable | Default | Storage | Stats target | Description  --------+---------+-----------+----------+---------+---------+--------------+-------------  i      | integer |           |          |         | plain   |              |  Compression Type: None Compression Level: 0 Block Size: 32768 Checksum: t Indexes:     \"foo_i_key\" UNIQUE CONSTRAINT, btree (i) Distributed by: (i) Access method: ao_row<\/code><\/pre>\n<pre><code>-- Case 0: no conflict as key doesn't exist in the table -- succeeds INSERT INTO foo VALUES(0);<\/code><\/pre>\n<pre><code>-- Case 1: conflict against committed tuple INSERT INTO foo VALUES(1); -- raises conflict INSERT INTO foo VALUES(1); ERROR:  duplicate key value violates unique constraint \"foo_i_key\"  (seg1 ...) DETAIL:  Key (i)=(1) already exists.<\/code><\/pre>\n<pre><code>-- Case 2: conflict against aborted tuple BEGIN; INSERT INTO foo VALUES(2); ABORT;  -- should succeed INSERT INTO foo VALUES(2);<\/code><\/pre>\n<pre><code>-- Case 3: conflict against row inserted by in-progress transaction  -- Session 1: BEGIN; INSERT INTO foo VALUES(3);  -- Session 2: -- will block until transaction in session 1 commits\/aborts INSERT INTO foo VALUES(3);  -- Session 1: COMMIT;  -- Session 2: -- Conflict raised. ERROR:  duplicate key value violates unique constraint \"foo_i_key\"  (seg0 ...) DETAIL:  Key (i)=(3) already exists. <\/code><\/pre>\n<pre><code>-- Case 4: Conflict against a deleted tuple DELETE FROM foo WHERE i = 1; -- should succeed INSERT INTO foo VALUES(1);<\/code><\/pre>\n<h4>\u041e\u0431\u0449\u0438\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c<\/h4>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0430, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 INSERT \u0438\u043b\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 INSERT, \u043e\u043d \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0415\u0441\u043b\u0438 \u0442\u0435\u0441\u0442 \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0439\u0434\u0451\u043d \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u043e. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 ERROR, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438 \u043a\u043e\u0440\u0442\u0435\u0436 \u0441\u0442\u0430\u043d\u0435\u0442 \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u044b\u043c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f MVCC.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u2014 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0443 \u043d\u0430\u0441 \u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0434\u043b\u044f \u043a\u043b\u044e\u0447\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0430. \u0415\u0441\u043b\u0438 \u043a\u043e\u0440\u0442\u0435\u0436 \u0441 \u0442\u0430\u043a\u0438\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0441\u044f (\u043a\u0435\u0439\u0441 0), \u0442\u043e \u0448\u0430\u043d\u0441\u043e\u0432 \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430 \u043d\u0435\u0442. \u0415\u0441\u043b\u0438 \u043c\u044b \u043d\u0430\u0439\u0434\u0451\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u2014 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0435\u0439\u0441 2, 3 \u0438\u043b\u0438 4 (\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432\u044b\u0448\u0435). \u0412 \u044d\u0442\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u044b\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e vacuum-time. \u0412\u0442\u043e\u0440\u043e\u0439 \u0448\u0430\u0433 \u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u0430. \u0415\u0441\u043b\u0438 \u043d\u0430\u0439\u0434\u0451\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c TID (\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043e\u0440\u0442\u0435\u0436\u0430) \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e tid. \u0415\u0441\u043b\u0438 \u043a\u043e\u0440\u0442\u0435\u0436 \u0432\u0438\u0434\u0435\u043d, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 (\u043a\u0435\u0439\u0441 3) \u0438\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 (\u043a\u0435\u0439\u0441 1). \u0415\u0441\u043b\u0438 \u043a\u043e\u0440\u0442\u0435\u0436 \u043d\u0435 \u0432\u0438\u0434\u0435\u043d (\u043a\u0435\u0439\u0441\u044b 2 \u0438 4), \u0442\u043e \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430 \u043d\u0435\u0442.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u00ab\u0433\u0440\u044f\u0437\u043d\u044b\u0439\u00bb \u0441\u043d\u0430\u043f\u0448\u043e\u0442, \u0447\u0442\u043e\u0431\u044b \u00ab\u0443\u0432\u0438\u0434\u0435\u0442\u044c\u00bb \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u0430, \u0435\u0441\u0442\u044c \u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p>\u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0441\u043e\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439 (\u043a\u0435\u0439\u0441 1);<\/p>\n<\/li>\n<li>\n<p>\u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439 (\u043a\u0435\u0439\u0441 2);<\/p>\n<\/li>\n<li>\n<p>\u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439 (\u043a\u0435\u0439\u0441 3)<\/p>\n<\/li>\n<li>\n<p>\u0443\u0434\u0430\u043b\u0435\u043d\u044b \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (\u043a\u0435\u0439\u0441 4)<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u0435\u0439\u0441\u044b, \u043d\u043e \u043e\u043d\u0438 \u043b\u0438\u0431\u043e \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c AO\/CO, \u043b\u0438\u0431\u043e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b \u0434\u043b\u044f \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f.\u00a0<\/p>\n<h4>Heap tables<\/h4>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 \u0432 heap-\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u043f\u0440\u043e\u0441\u0442\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u0440\u0442\u0435\u0436\u0435 (xmin \u0438 xmax). \u0412\u0441\u0451, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e \u00ab\u0432\u044b\u0431\u0440\u0430\u0442\u044c\u00bb \u043a\u043e\u0440\u0442\u0435\u0436 \u043f\u043e \u0435\u0433\u043e tid \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c xmin\/xmax \u0441\u043e \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u043e\u043c.<\/p>\n<pre><code>-- Setup CREATE EXTENSION pageinspect;<\/code><\/pre>\n<pre><code>-- Case 1: conflict against committed tuple CREATE TABLE foo(i int UNIQUE) USING heap DISTRIBUTED REPLICATED; INSERT INTO foo VALUES(1);  -- In utility mode on seg0, run inspection functions:  SELECT * FROM bt_page_items('foo_i_key', 1);  itemoffset | ctid  | itemlen | nulls | vars |          data            ------------+-------+---------+-------+------+-------------------------           1 | (0,1) |      16 | f     | f    | 01 00 00 00 00 00 00 00 (1 row)  -- Since we have a live index entry for i = 1 pointing to tid `(0,1)` -- any insert for key i = 1 will have to determine tuple visibility.  SELECT     ctid, i,     txid_status(xmin::text::bigint) AS inserting_xid_status,     txid_status(xmax::text::bigint) AS deleting_xid_status FROM foo;  ctid  | i | inserting_xid_status | deleting_xid_status  -------+---+----------------------+---------------------  (0,1) | 1 | committed            |  (1 row)  -- Since the tuple has its xmin committed, it is visible and the following -- will raise a conflict. INSERT INTO foo VALUES(1); ERROR:  duplicate key value violates unique constraint \"foo_i_key\"  (seg1 ...) DETAIL:  Key (i)=(1) already exists.<\/code><\/pre>\n<pre><code>-- Case 2: conflict against aborted tuple CREATE TABLE foo(i int UNIQUE) USING heap DISTRIBUTED REPLICATED; BEGIN; INSERT INTO foo VALUES(2); ABORT;  -- In utility mode on seg0, run inspection functions:  SELECT * FROM bt_page_items('foo_i_key', 1);  itemoffset | ctid  | itemlen | nulls | vars |          data            ------------+-------+---------+-------+------+-------------------------           1 | (0,1) |      16 | f     | f    | 02 00 00 00 00 00 00 00 (1 row)  -- Since we have a live index entry for i = 1 pointing to tid `(0,2)` -- any insert for key i = 1 will have to determine tuple visibility.  SET gp_select_invisible TO ON; SELECT     ctid, i,     txid_status(xmin::text::bigint) AS inserting_xid_status,     txid_status(xmax::text::bigint) AS deleting_xid_status FROM foo;  ctid  | i | inserting_xid_status | deleting_xid_status  -------+---+----------------------+---------------------  (0,1) | 2 | aborted              |  (1 row)  -- Since the tuple has its xmin aborted, it is invisible and the following -- will succeed. INSERT INTO foo VALUES(2);<\/code><\/pre>\n<pre><code>-- Case 3: conflict against row inserted by in-progress transaction CREATE TABLE foo(i int UNIQUE) USING heap DISTRIBUTED REPLICATED;  -- Session 1: BEGIN; INSERT INTO foo VALUES(3);  -- Session 3: (for snooping) - in utility mode on segment 0  SELECT * FROM bt_page_items('foo_i_key', 1);  itemoffset | ctid  | itemlen | nulls | vars |          data            ------------+-------+---------+-------+------+-------------------------           1 | (0,1) |      16 | f     | f    | 03 00 00 00 00 00 00 00 (1 row)  -- Since we have a live index entry for i = 3 pointing to tid `(0,1)` -- any insert for key i = 3 will have to determine tuple visibility.  SELECT     ctid, i,     txid_status(xmin::text::bigint) AS inserting_xid_status,     txid_status(xmax::text::bigint) AS deleting_xid_status FROM foo; SET  ctid  | i | inserting_xid_status | deleting_xid_status  -------+---+----------------------+---------------------  (0,1) | 3 | in progress          |  (1 row)  -- Session 2: -- Since the tuple has its xmin in-progress, meaning its inserting -- transaction is still running, the backend will go into an xwait -- state to wait for the inserting transaction to complete. INSERT INTO foo VALUES(3); -- will block  -- Session 1: COMMIT;  -- Session 2: -- Since Session 1 committed, Session 2 will wake up and retry the -- insert and will raise a conflict. ERROR:  duplicate key value violates unique constraint \"foo_i_key\"  (seg0 ...) DETAIL:  Key (i)=(3) already exists.<\/code><\/pre>\n<pre><code>-- Case 4: Conflict against a deleted tuple CREATE TABLE foo(i int UNIQUE) USING heap DISTRIBUTED REPLICATED; INSERT INTO foo VALUES(1); DELETE FROM foo WHERE i = 1;  -- In utility mode on seg0, run inspection functions:  SELECT * FROM bt_page_items('foo_i_key', 1);  itemoffset | ctid  | itemlen | nulls | vars |          data<\/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-396009","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/396009","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=396009"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/396009\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=396009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=396009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=396009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}