Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit38923e2

Browse files
committed
russian docs (dump_stat_rus.sgml
1 parent62f7a63 commit38923e2

File tree

1 file changed

+306
-0
lines changed

1 file changed

+306
-0
lines changed

‎doc/src/sgml/dump_stat_rus.sgml

Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,306 @@
1+
<!-- doc/src/sgml/dump_stat.sgml -->
2+
3+
<sect1 id="dump-stat" xreflabel="dump-stat">
4+
<title>dump_stat</title>
5+
6+
<indexterm zone="dump-stat">
7+
<primary>dump_stat</primary>
8+
</indexterm>
9+
10+
<para>
11+
Модуль <filename>dump_stat</> предоставляет функции для сохранения и восстановления
12+
содержимого таблицы
13+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>.
14+
Функция <function>dump_statistic</> возвращает набор <literal>INSERT</>-запросов,
15+
которые можно выполнить на совместимом сервере для восстановления статистики.
16+
Расширение должно быть установлено на целевом сервере, поскольку предоставленные им
17+
функции необходимы для корректной работы сгенерированных запросов.
18+
</para>
19+
20+
<para>
21+
Обратите внимание, что в будущем определение таблицы
22+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
23+
может измениться, вследствие чего созданные ранее резервные копии статистики могут
24+
стать несовместимыми с новыми версиями PostgreSQL.
25+
</para>
26+
27+
<sect2>
28+
<title>Функции</title>
29+
30+
<variablelist>
31+
<varlistentry>
32+
<term>
33+
<function>dump_statistic() returns setof text</function>
34+
<indexterm>
35+
<primary>dump_statistic</primary>
36+
</indexterm>
37+
</term>
38+
39+
<listitem>
40+
<para>
41+
<function>dump_statistic</function> возвращает содержимое системной
42+
таблицы
43+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
44+
в виде специально сформированных <literal>INSERT</>-запросов.
45+
Статистика для таблиц, включенных в схемы
46+
<literal>information_schema</> и <literal>pg_catalog</>
47+
отбрасывается.
48+
</para>
49+
50+
<para>
51+
<literal>INSERT</>-запрос принимает следующий вид:
52+
<screen>
53+
WITH upsert as (
54+
UPDATE pg_catalog.pg_statistic SET <replaceable class="PARAMETER">column_name</> = <replaceable class="PARAMETER">выражение</> [, ...]
55+
WHERE to_schema_qualified_relation(starelid) = <replaceable class="PARAMETER">t_relname</>
56+
AND to_attname(<replaceable class="PARAMETER">t_relname</>, staattnum) = <replaceable class="PARAMETER">t_attname</>
57+
AND to_atttype(<replaceable class="PARAMETER">t_relname</>, staattnum) = <replaceable class="PARAMETER">t_atttype</>
58+
AND stainherit = <replaceable class="PARAMETER">t_stainherit</>
59+
RETURNING *)
60+
ins as (
61+
SELECT <replaceable class="PARAMETER">выражение</> [, ...]
62+
WHERE NOT EXISTS (SELECT * FROM upsert)
63+
AND to_attnum(<replaceable class="PARAMETER">t_relname</>, <replaceable class="PARAMETER">t_attname</>) IS NOT NULL
64+
AND to_atttype(<replaceable class="PARAMETER">t_relname</>, <replaceable class="PARAMETER">t_attname</>) = <replaceable class="PARAMETER">t_atttype</>)
65+
INSERT INTO pg_catalog.pg_statistic SELECT * FROM ins;
66+
67+
где <replaceable class="PARAMETER">выражение</> может принимать следующие значения:
68+
69+
array_in(<replaceable class="PARAMETER">array_text</>, <replaceable class="PARAMETER">имя_типа</>::regtype::oid, -1)
70+
<replaceable class="PARAMETER">значение</>::<replaceable class="PARAMETER">имя_типа</>
71+
</screen>
72+
</para>
73+
74+
<para>
75+
Полученные запросы могут быть сохранены в файл, например:
76+
<screen>
77+
test=# \COPY (select dump_statistic()) TO 'dump_stat.sql'
78+
</screen>
79+
</para>
80+
</listitem>
81+
</varlistentry>
82+
83+
<varlistentry>
84+
<term>
85+
<function>dump_statistic(schema_name text) returns setof text</function>
86+
</term>
87+
88+
<listitem>
89+
<para>
90+
<function>dump_statistic</function> возвращает содержимое системной
91+
таблицы
92+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
93+
в виде специально сформированных <literal>INSERT</>-запросов.
94+
Статистика для таблиц, не включенных в схему <literal>schema_name</>,
95+
отбрасывается.
96+
</para>
97+
</listitem>
98+
</varlistentry>
99+
100+
<varlistentry>
101+
<term>
102+
<function>dump_statistic(schema_name text, table_name text) returns setof text</function>
103+
</term>
104+
105+
<listitem>
106+
<para>
107+
<function>dump_statistic</function> возвращает содержимое системной
108+
таблицы
109+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
110+
в виде специально сформированных <literal>INSERT</>-запросов.
111+
Результат выполнения функции содержит статистику только для таблицы
112+
<literal>schema_name.table_name</>.
113+
</para>
114+
</listitem>
115+
</varlistentry>
116+
117+
<varlistentry>
118+
<term>
119+
<function>dump_statistic(relid oid) returns setof text</function>
120+
</term>
121+
122+
<listitem>
123+
<para>
124+
<function>dump_statistic</function> возвращает содержимое системной
125+
таблицы
126+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
127+
в виде специально сформированных <literal>INSERT</>-запросов.
128+
Результат выполнения функции содержит статистику только для таблицы,
129+
заданной с помощью <literal>relid</>.
130+
</para>
131+
</listitem>
132+
</varlistentry>
133+
134+
<varlistentry>
135+
<term>
136+
<function>to_schema_qualified_operator(opid oid) returns text</function>
137+
<indexterm>
138+
<primary>to_schema_qualified_operator</primary>
139+
</indexterm>
140+
</term>
141+
142+
<listitem>
143+
<para>
144+
Возвращает полное имя оператора (предваренное именем схемы),
145+
заданного с помощью идентификатора <literal>opid</>. Пример:
146+
</para>
147+
<screen>
148+
test=# SELECT to_schema_qualified_operator('+(int,int)'::regoperator);
149+
to_schema_qualified_operator
150+
------------------------------------------------
151+
pg_catalog.+(pg_catalog.int4, pg_catalog.int4)
152+
(1 row)
153+
</screen>
154+
</listitem>
155+
</varlistentry>
156+
157+
<varlistentry>
158+
<term>
159+
<function>to_schema_qualified_type(typid oid) returns text</function>
160+
<indexterm>
161+
<primary>to_schema_qualified_type</primary>
162+
</indexterm>
163+
</term>
164+
165+
<listitem>
166+
<para>
167+
Возвращает полное имя типа (предваренное именем схемы),
168+
заданного с помощью идентификатора <literal>typid</>.
169+
</para>
170+
</listitem>
171+
</varlistentry>
172+
173+
<varlistentry>
174+
<term>
175+
<function>to_schema_qualified_relation(relid oid) returns text</function>
176+
<indexterm>
177+
<primary>to_schema_qualified_relation</primary>
178+
</indexterm>
179+
</term>
180+
181+
<listitem>
182+
<para>
183+
Возвращает полное имя таблицы (предваренное именем схемы),
184+
заданной с помощью идентификатора <literal>relid</>.
185+
</para>
186+
</listitem>
187+
</varlistentry>
188+
189+
<varlistentry>
190+
<term>
191+
<function>anyarray_elemtype(arr anyarray) returns oid</function>
192+
<indexterm>
193+
<primary>anyarray_elemtype</primary>
194+
</indexterm>
195+
</term>
196+
197+
<listitem>
198+
<para>
199+
Возвращает идентификатор <literal>oid</> типа элемента массива, например:
200+
</para>
201+
<screen>
202+
test=# SELECT anyarray_elemtype(array_in('{1,2,3}', 'int'::regtype, -1));
203+
anyarray_elemtype
204+
-------------------
205+
23
206+
(1 row)
207+
</screen>
208+
</listitem>
209+
</varlistentry>
210+
211+
<varlistentry>
212+
<term>
213+
<function>to_attname(relation text, colnum int2) returns text</function>
214+
<indexterm>
215+
<primary>to_attname</primary>
216+
</indexterm>
217+
</term>
218+
219+
<listitem>
220+
<para>
221+
Возвращает имя столбца таблицы <literal>relation</> под номером
222+
<literal>colnum</>.
223+
</para>
224+
</listitem>
225+
</varlistentry>
226+
227+
<varlistentry>
228+
<term>
229+
<function>to_attnum(relation text, col text) returns int2</function>
230+
<indexterm>
231+
<primary>to_attnum</primary>
232+
</indexterm>
233+
</term>
234+
235+
<listitem>
236+
<para>
237+
Возвращает номер столбца <literal>col</> таблицы <literal>relation</>.
238+
</para>
239+
</listitem>
240+
</varlistentry>
241+
242+
<varlistentry>
243+
<term>
244+
<function>to_atttype(relation text, col text) returns text</function>
245+
<indexterm>
246+
<primary>to_atttype</primary>
247+
</indexterm>
248+
</term>
249+
250+
<listitem>
251+
<para>
252+
Возвращает имя типа столбца <literal>col</> таблицы <literal>relation</>.
253+
</para>
254+
</listitem>
255+
</varlistentry>
256+
257+
<varlistentry>
258+
<term>
259+
<function>to_atttype(relation text, colnum int2) returns text</function>
260+
</term>
261+
262+
<listitem>
263+
<para>
264+
Возвращает имя типа столбца таблицы <literal>relation</> под номером
265+
<literal>colnum</>.
266+
</para>
267+
</listitem>
268+
</varlistentry>
269+
270+
<varlistentry>
271+
<term>
272+
<function>to_namespace(nsp text) returns oid</function>
273+
<indexterm>
274+
<primary>to_namespace</primary>
275+
</indexterm>
276+
</term>
277+
278+
<listitem>
279+
<para>
280+
<function>to_namespace</function> имитирует приведение к
281+
системному типу
282+
<link linkend="datatype-oid"><structname>regnamespace</structname></link>
283+
, который отсутствует в PostgreSQL 9.4 (и более ранних версиях).
284+
Функция возвращает <literal>oid</> заданной схемы.
285+
</para>
286+
</listitem>
287+
</varlistentry>
288+
289+
<varlistentry>
290+
<term>
291+
<function>get_namespace(relation oid) returns oid</function>
292+
<indexterm>
293+
<primary>get_namespace</primary>
294+
</indexterm>
295+
</term>
296+
297+
<listitem>
298+
<para>
299+
<function>get_namespace</function> возвращает <literal>oid</>
300+
схемы, включающей в себя заданную таблицу.
301+
</para>
302+
</listitem>
303+
</varlistentry>
304+
</variablelist>
305+
</sect2>
306+
</sect1>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp