Skip to content

Commit 121bae4

Browse files
committed
Converted newest pg_pathman doc to sgml
1 parent e6288ad commit 121bae4

File tree

1 file changed

+55
-56
lines changed

1 file changed

+55
-56
lines changed

doc/src/sgml/pathman.sgml

Lines changed: 55 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</listitem>
3232
</itemizedlist>
3333
<para>
34-
&productname; supports partitioning via table inheritance. Each
34+
PostgreSQL supports partitioning via table inheritance. Each
3535
partition must be created as child table with CHECK CONSTRAINT.
3636
For example:
3737
</para>
@@ -80,27 +80,25 @@ WHERE id = 150
8080
<sect2 id="pg-pathman-installation">
8181
<title>Installation</title>
8282
<para>
83-
To install pathman run:
83+
To install pg_pathman run in psql:
8484
</para>
8585
<programlisting>
86-
CREATE SCHEMA pathman;
87-
CREATE EXTENSION pg_pathman SCHEMA pathman;
86+
CREATE EXTENSION pg_pathman;
8887
</programlisting>
8988
<para>
90-
Then modify <literal>shared_preload_libraries</>
91-
parameter in postgresql.conf as
89+
Then modify shared_preload_libraries parameter in postgres.conf as
9290
following:
9391
</para>
9492
<programlisting>
9593
shared_preload_libraries = 'pg_pathman'
9694
</programlisting>
9795
<para>
98-
It will require to restart of the &productname; instance.
96+
It will require to restart the PostgreSQL instance.
9997
</para>
10098
</sect2>
10199
<sect2 id="pg-pathman-functions">
102-
<title>FUNCTIONS</title>
103-
<sect3 id="pg-pathman-partitions-creation">
100+
<title>pg_pathman Functions</title>
101+
<sect3 id="partitions-creation">
104102
<title>Partitions Creation</title>
105103
<programlisting>
106104
create_hash_partitions(
@@ -112,9 +110,8 @@ create_hash_partitions(
112110
Performs HASH partitioning for <literal>relation</literal> by
113111
integer key <literal>attribute</literal>. Creates
114112
<literal>partitions_count</literal> partitions and trigger on
115-
INSERT. Data doesn't automatically copied from parent table to
116-
partitions. Use <literal>partition_data()</literal> function
117-
(see below) to migrate data.
113+
INSERT. All the data will be automatically copied from the
114+
parent to partitions.
118115
</para>
119116
<programlisting>
120117
create_range_partitions(
@@ -123,37 +120,47 @@ create_range_partitions(
123120
start_value ANYELEMENT,
124121
interval ANYELEMENT,
125122
premake INTEGER)
123+
124+
create_range_partitions(
125+
relation TEXT,
126+
attribute TEXT,
127+
start_value ANYELEMENT,
128+
interval INTERVAL,
129+
premake INTEGER)
126130
</programlisting>
127131
<para>
128132
Performs RANGE partitioning for <literal>relation</literal> by
129133
partitioning key <literal>attribute</literal>.
130134
<literal>start_value</literal> argument specifies initial value,
131135
<literal>interval</literal> sets the range of values in a single
132136
partition, <literal>premake</literal> is the number of premade
133-
partitions (the only one partition will be created if
134-
<literal>premake</literal> is 0).
137+
partitions. All the data will be automatically copied from the
138+
parent to partitions.
135139
</para>
136140
<programlisting>
137-
create_range_partitions(
141+
create_partitions_from_range(
138142
relation TEXT,
139143
attribute TEXT,
140144
start_value ANYELEMENT,
141-
interval INTERVAL,
142-
premake INTEGER)
145+
end_value ANYELEMENT,
146+
interval ANYELEMENT)
147+
148+
create_partitions_from_range(
149+
relation TEXT,
150+
attribute TEXT,
151+
start_value ANYELEMENT,
152+
end_value ANYELEMENT,
153+
interval INTERVAL)
143154
</programlisting>
144155
<para>
145-
Same as above but suitable for <literal>DATE</literal> and
146-
<literal>TIMESTAMP</literal> partitioning keys.
156+
Performs RANGE-partitioning from specified range for
157+
<literal>relation</literal> by partitioning key
158+
<literal>attribute</literal>. Data will be copied to partitions
159+
as well.
147160
</para>
148161
</sect3>
149-
<sect3 id="pg-pathman-data-migration">
150-
<title>Data migration</title>
151-
<programlisting>
152-
partition_data(parent text)
153-
</programlisting>
154-
<para>
155-
Copies data from parent table to its partitions.
156-
</para>
162+
<sect3 id="utilities">
163+
<title>Utilities</title>
157164
<programlisting>
158165
create_hash_update_trigger(parent TEXT)
159166
</programlisting>
@@ -163,13 +170,13 @@ create_hash_update_trigger(parent TEXT)
163170
useful in cases when key attribute could be changed.
164171
</para>
165172
<programlisting>
166-
create_hash_update_trigger(parent TEXT)
173+
create_range_update_trigger(parent TEXT)
167174
</programlisting>
168175
<para>
169176
Same as above for RANGE sections.
170177
</para>
171178
</sect3>
172-
<sect3 id="pg-pathman-partitions-management">
179+
<sect3 id="partitions-management">
173180
<title>Partitions management</title>
174181
<programlisting>
175182
split_range_partition(partition TEXT, value ANYELEMENT)
@@ -211,9 +218,9 @@ disable_partitioning(relation TEXT)
211218
</para>
212219
</sect3>
213220
</sect2>
214-
<sect2 id="pg-pathman-examples">
221+
<sect2 id="examples">
215222
<title>Examples</title>
216-
<sect3 id="pg-pathman-example-hash">
223+
<sect3 id="hash">
217224
<title>HASH</title>
218225
<para>
219226
Consider an example of HASH partitioning. First create a table
@@ -226,23 +233,19 @@ CREATE TABLE hash_rel (
226233
INSERT INTO hash_rel (value) SELECT g FROM generate_series(1, 10000) as g;
227234
</programlisting>
228235
<para>
229-
Then run create_hash_partitions() function with appropriate
236+
If partitions are supposed to have indexes, then they should be
237+
created for parent table before partitioning. In this case
238+
pg_pathman will automaticaly create indexes for partitions. Then
239+
run create_hash_partitions() function with appropriate
230240
arguments:
231241
</para>
232242
<programlisting>
233243
SELECT create_hash_partitions('hash_rel', 'value', 100);
234244
</programlisting>
235245
<para>
236-
This will create new partitions but data will still be in the
237-
parent table. To move data to the corresponding partitions use
238-
partition_data() function:
239-
</para>
240-
<programlisting>
241-
SELECT partition_data('hash_rel');
242-
</programlisting>
243-
<para>
244-
Here is an example of the query with filtering by partitioning
245-
key and its plan:
246+
This will create new partitions and move the data from parent to
247+
partitions. Here is an example of the query with filtering by
248+
partitioning key and its plan:
246249
</para>
247250
<programlisting>
248251
SELECT * FROM hash_rel WHERE value = 1234;
@@ -268,7 +271,7 @@ EXPLAIN SELECT * FROM ONLY hash_rel;
268271
Seq Scan on hash_rel (cost=0.00..0.00 rows=1 width=8)
269272
</programlisting>
270273
</sect3>
271-
<sect3 id="pg-pathman-example-range">
274+
<sect3 id="range">
272275
<title>RANGE</title>
273276
<para>
274277
Consider an example of RANGE partitioning. Create a table with
@@ -278,26 +281,19 @@ EXPLAIN SELECT * FROM ONLY hash_rel;
278281
CREATE TABLE range_rel (
279282
id SERIAL PRIMARY KEY,
280283
dt TIMESTAMP);
281-
INSERT INTO range_rel (dt) SELECT g FROM generate_series('2010-01-01'::date, '2015-12-31'::date, '1 day') as g;
284+
INSERT INTO range_rel (dt) SELECT g FROM generate_series('2010-01-01'::date, '2014-12-31'::date, '1 day') as g;
282285
</programlisting>
283286
<para>
284287
Run create_range_partitions() function to create partitions so
285288
that each partition would contain data for one month:
286289
</para>
287290
<programlisting>
288-
SELECT create_range_partitions('range_rel', 'dt', '2010-01-01'::date, '1 month'::interval, 59);
291+
SELECT create_range_partitions('range_rel', 'dt', '2010-01-01'::date, '1 month'::interval, 60);
289292
</programlisting>
290293
<para>
291-
It will create 60 partitions (one partition is created
292-
regardless of <literal>premake</literal> parameter). Now move
293-
data from the parent to partitions.
294-
</para>
295-
<programlisting>
296-
SELECT partition_data('range_rel');
297-
</programlisting>
298-
<para>
299-
To merge to adjacent partitions run merge_range_partitions()
300-
function:
294+
It will create 60 partitions and move the data from parent to
295+
partitions. To merge to adjacent partitions run
296+
merge_range_partitions() function:
301297
</para>
302298
<programlisting>
303299
SELECT merge_range_partitions('range_rel_1', 'range_rel_2');
@@ -396,11 +392,14 @@ DELETE FROM pathman_config WHERE relname = 'public.range_rel';
396392
</programlisting>
397393
</sect3>
398394
</sect2>
399-
<sect2 id="pg-pathman-author">
395+
<sect2 id="author">
400396
<title>Author</title>
401397
<para>
402398
Ildar Musin <email>i.musin@postgrespro.ru</email> Postgres
403399
Professional Ltd., Russia
404400
</para>
401+
<para>
402+
This module is sponsored by Postgres Professional Ltd., Russia
403+
</para>
405404
</sect2>
406405
</sect1>

0 commit comments

Comments
 (0)