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: README.md
+42-4Lines changed: 42 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -124,14 +124,35 @@ CREATE TABLE hash_rel (
124
124
value INTEGER);
125
125
INSERT INTO hash_rel (value) SELECT g FROM generate_series(1, 10000) as g;
126
126
```
127
-
Then run create_hash_partitions() function with appropriate arguments:
127
+
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:
132
132
```
133
133
SELECT partition_data('hash_rel');
134
134
```
135
+
Here is an example of the query with filtering by partitioning key and its plan:
136
+
```
137
+
SELECT * FROM hash_rel WHERE value = 1234;
138
+
id | value
139
+
------+-------
140
+
1234 | 1234
141
+
142
+
EXPLAIN SELECT * FROM hash_rel WHERE value = 1234;
Copy file name to clipboardExpand all lines: README.rus.md
+44-4Lines changed: 44 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -125,14 +125,36 @@ CREATE TABLE hash_rel (
125
125
value INTEGER);
126
126
INSERT INTO hash_rel (value) SELECT g FROM generate_series(1, 10000) as g;
127
127
```
128
-
Разобьем таблицу `hash_rel` на 100 секций по полю `value`:
128
+
Если дочерние секции подразумевают наличие индексов, то стоит их создать в родительской таблице до разбиения. Тогда при разбиении pg_pathman автоматически создаст соответствующие индексы в дочерних.таблицах. Разобьем таблицу `hash_rel` на 100 секций по полю `value`:
0 commit comments