You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contrib/pg_pathman/README.md
+43-6Lines changed: 43 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,8 +37,7 @@ Based on partitioning type and operator the `pg_pathman` searches corresponding
37
37
38
38
To install pg_pathman run in psql:
39
39
```
40
-
CREATE SCHEMA pathman;
41
-
CREATE EXTENSION pg_pathman SCHEMA pathman;
40
+
CREATE EXTENSION pg_pathman;
42
41
```
43
42
Then modify shared_preload_libraries parameter in postgres.conf as following:
44
43
```
@@ -121,14 +120,35 @@ CREATE TABLE hash_rel (
121
120
value INTEGER);
122
121
INSERT INTO hash_rel (value) SELECT g FROM generate_series(1, 10000) as g;
123
122
```
124
-
Then run create_hash_partitions() function with appropriate arguments:
123
+
If partitions are supposed to have indexes, then they should be created for parent table before partitioning. In this case pg_pathman will automaticaly create indexes for partitions.Then run create_hash_partitions() function with appropriate arguments:
This will create new partitions but data will still be in the parent table. To move data to the corresponding partitions use partition_data() function:
129
128
```
130
129
SELECT partition_data('hash_rel');
131
130
```
131
+
Here is an example of the query with filtering by partitioning key and its plan:
132
+
```
133
+
SELECT * FROM hash_rel WHERE value = 1234;
134
+
id | value
135
+
------+-------
136
+
1234 | 1234
137
+
138
+
EXPLAIN SELECT * FROM hash_rel WHERE value = 1234;
Copy file name to clipboardExpand all lines: contrib/pg_pathman/README.rus.md
+45-6Lines changed: 45 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,8 +38,7 @@ WHERE id = 150
38
38
39
39
Для установки pg_pathman выполните в командной строке:
40
40
```
41
-
CREATE SCHEMA pathman;
42
-
CREATE EXTENSION pg_pathman SCHEMA pathman;
41
+
CREATE EXTENSION pg_pathman;
43
42
44
43
```
45
44
Затем модифицируйте параметр shared_preload_libraries в конфигурационном файле postgres.conf:
@@ -123,14 +122,36 @@ CREATE TABLE hash_rel (
123
122
value INTEGER);
124
123
INSERT INTO hash_rel (value) SELECT g FROM generate_series(1, 10000) as g;
125
124
```
126
-
Разобьем таблицу`hash_rel` на 100 секций по полю`value`:
125
+
Если дочерние секции подразумевают наличие индексов, то стоит их создать в родительской таблице до разбиения. Тогда при разбиении pg_pathman автоматически создаст соответствующие индексы в дочерних.таблицах.Разобьем таблицу`hash_rel` на 100 секций по полю`value`: