バージョンごとのドキュメント一覧

F.34. pg_surgery — リレーションデータに対して低レベルの手術を行う #

<title>pg_surgery &mdash; perform low-level surgery on relation data</title>

The <filename>pg_surgery</filename> module provides various functions to perform surgery on a damaged relation. These functions are unsafe by design and using them may corrupt (or further corrupt) your database. For example, these functions can easily be used to make a table inconsistent with its own indexes, to cause <literal>UNIQUE</literal> or <literal>FOREIGN KEY</literal> constraint violations, or even to make tuples visible which, when read, will cause a database server crash. They should be used with great caution and only as a last resort. pg_surgeryモジュールは、破損したリレーションに対して手術を行うための様々な関数を提供します。 これらの関数は設計上安全ではなく、使用することによってデータベースを破損する(あるいは既存の破損を更に拡大する)可能性があります。 たとえば、これらの関数を使用することによって簡単にテーブルは自身のインデックスと一貫性がなくなり、UNIQUEあるいはFOREIGN KEY制約の違反が生じたり、更には読み出すことによってデータベースサーバをクラッシュさせるタプルを可視状態にすることさえあります。 これらの関数は使用にあたっては十分に注意するとともに、最後の手段としてのみ使用すべきです。

F.34.1. 関数 #

<title>Functions</title>
heap_force_kill(regclass, tid[]) returns void

<function>heap_force_kill</function> marks <quote>used</quote> line pointers as <quote>dead</quote> without examining the tuples. The intended use of this function is to forcibly remove tuples that are not otherwise accessible. For example: heap_force_killはタプルを調べることなく使用中ラインポインター(line pointer)に削除済み(dead)の印を付けます。 この関数はアクセスする方法がないタプルを強制的に削除するために使用することを意図しています。 例を示します。

test=> select * from t1 where ctid = '(0, 1)';
ERROR:  could not access status of transaction 4007513275
DETAIL:  Could not open file "pg_xact/0EED": No such file or directory.

test=# select heap_force_kill('t1'::regclass, ARRAY['(0, 1)']::tid[]);
 heap_force_kill
-----------------

(1 row)

test=# select * from t1 where ctid = '(0, 1)';
(0 rows)

heap_force_freeze(regclass, tid[]) returns void

<function>heap_force_freeze</function> marks tuples as frozen without examining the tuple data. The intended use of this function is to make accessible tuples which are inaccessible due to corrupted visibility information, or which prevent the table from being successfully vacuumed due to corrupted visibility information. For example: heap_force_freezeはタプルデータを調べることなくタプルに凍結済みの印を付けます。 この関数は可視性情報が破壊されていてタプルがアクセスできなかったり、あるいは可視性が破壊されたタプルによってテーブルがバキュームできなくなったときに、タプルを強制的にアクセスできるようにするために使用することを意図しています。 例を示します。

test=> vacuum t1;
ERROR:  found xmin 507 from before relfrozenxid 515
CONTEXT:  while scanning block 0 of relation "public.t1"

test=# select ctid from t1 where xmin = 507;
 ctid
-------
 (0,3)
(1 row)

test=# select heap_force_freeze('t1'::regclass, ARRAY['(0, 3)']::tid[]);
 heap_force_freeze
-------------------

(1 row)

test=# select ctid from t1 where xmin = 2;
 ctid
-------
 (0,3)
(1 row)

F.34.2. 作者 #

<title>Authors</title>

Ashutosh Sharma