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
+23-18Lines changed: 23 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ create_hash_partitions(
54
54
attribute TEXT,
55
55
partitions_count INTEGER)
56
56
```
57
-
Performs HASH partitioning for`relation` by integer key`attribute`. Creates`partitions_count` partitions and trigger on INSERT.Data doesn'tautomatically copied from parenttableto partitions. Use`partition_data()` function (see below) to migrate data.
57
+
Performs HASH partitioning for`relation` by integer key`attribute`. Creates`partitions_count` partitions and trigger on INSERT.All the data will beautomatically copied fromtheparent to partitions.
58
58
59
59
```
60
60
create_range_partitions(
@@ -63,29 +63,40 @@ create_range_partitions(
63
63
start_value ANYELEMENT,
64
64
interval ANYELEMENT,
65
65
premake INTEGER)
66
-
```
67
-
Performs RANGE partitioning for`relation` by partitioning key`attribute`.`start_value` argument specifies initial value,`interval` sets the range of values in a single partition,`premake` is the number of premade partitions (the only one partition will be created if`premake` is 0).
68
-
```
66
+
69
67
create_range_partitions(
70
68
relation TEXT,
71
69
attribute TEXT,
72
70
start_value ANYELEMENT,
73
71
interval INTERVAL,
74
72
premake INTEGER)
75
73
```
76
-
Same as above but suitable for`DATE` and`TIMESTAMP` partitioning keys.
74
+
Performs RANGE partitioning for`relation` by partitioning key`attribute`.`start_value` argument specifies initial value,`interval` sets the range of values in a single partition,`premake` is the number of premade partitions. All the data will be automatically copied from the parent to partitions.
77
75
78
-
###Utilities
79
76
```
80
-
partition_data(parent text)
77
+
create_partitions_from_range(
78
+
relation TEXT,
79
+
attribute TEXT,
80
+
start_value ANYELEMENT,
81
+
end_value ANYELEMENT,
82
+
interval ANYELEMENT)
83
+
84
+
create_partitions_from_range(
85
+
relation TEXT,
86
+
attribute TEXT,
87
+
start_value ANYELEMENT,
88
+
end_value ANYELEMENT,
89
+
interval INTERVAL)
81
90
```
82
-
Copies data from parent table to its partitions.
91
+
Performs RANGE-partitioning from specified range for`relation` by partitioning key`attribute`. Data will be copied to partitions as well.
92
+
93
+
###Utilities
83
94
```
84
95
create_hash_update_trigger(parent TEXT)
85
96
```
86
97
Creates the trigger on UPDATE for HASH partitions. The UPDATE trigger isn't created by default because of overhead. It is useful in cases when key attribute could be changed.
87
98
```
88
-
create_hash_update_trigger(parent TEXT)
99
+
create_range_update_trigger(parent TEXT)
89
100
```
90
101
Same as above for RANGE sections.
91
102
@@ -124,10 +135,7 @@ If partitions are supposed to have indexes, then they should be created for pare
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:
128
-
```
129
-
SELECT partition_data('hash_rel');
130
-
```
138
+
This will create new partitions and move the data from parent to partitions.
131
139
Here is an example of the query with filtering by partitioning key and its plan:
132
140
```
133
141
SELECT * FROM hash_rel WHERE value = 1234;
@@ -159,12 +167,9 @@ INSERT INTO range_rel (dt) SELECT g FROM generate_series('2010-01-01'::date, '20
159
167
```
160
168
Run create_range_partitions() function to create partitions so that each partition would contain data for one month:
Copy file name to clipboardExpand all lines: contrib/pg_pathman/README.rus.md
+21-20Lines changed: 21 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ create_hash_partitions(
56
56
attribute TEXT,
57
57
partitions_count INTEGER)
58
58
```
59
-
Выполняет HASH-секционирование таблицы`relation` по целочисленному полю`attribute`. Создает`partitions_count` дочерних секций, а также триггер на вставку. Данные из родительской таблицыне копируютсяавтоматически в дочерние. Миграцию данных можно выполнить с помощью функции`partition_data()` (см. ниже), либо вручную.
59
+
Выполняет HASH-секционирование таблицы`relation` по целочисленному полю`attribute`. Создает`partitions_count` дочерних секций, а также триггер на вставку. Данные из родительской таблицыбудутавтоматическископированыв дочерние.
60
60
61
61
```
62
62
create_range_partitions(
@@ -65,29 +65,40 @@ create_range_partitions(
65
65
start_value ANYELEMENT,
66
66
interval ANYELEMENT,
67
67
premake INTEGER)
68
-
```
69
-
Выполняет RANGE-секционирование таблицы`relation` по полю`attribute`. Аргумент`start_value` задает начальное значение,`interval` -- диапазон значений внутри одной секции,`premake` -- количество заранее создаваемых секций (если 0, то будет создана единственная секция).
70
-
```
68
+
71
69
create_range_partitions(
72
70
relation TEXT,
73
71
attribute TEXT,
74
72
start_value ANYELEMENT,
75
73
interval INTERVAL,
76
74
premake INTEGER)
77
75
```
78
-
Аналогично предыдущей с тем лишь отличием, что данная функция предназначена для секционирования по полю типа`DATE` или`TIMESTAMP`.
76
+
Выполняет RANGE-секционирование таблицы`relation` по полю`attribute`. Аргумент`start_value` задает начальное значение,`interval` -- диапазон значений внутри одной секции,`premake` -- количество заранее создаваемых секций. Данные из родительской таблицы будут автоматически скопированы в дочерние.
79
77
80
-
###Утилиты
81
78
```
82
-
partition_data(parent text)
79
+
create_partitions_from_range(
80
+
relation TEXT,
81
+
attribute TEXT,
82
+
start_value ANYELEMENT,
83
+
end_value ANYELEMENT,
84
+
interval ANYELEMENT)
85
+
86
+
create_partitions_from_range(
87
+
relation TEXT,
88
+
attribute TEXT,
89
+
start_value ANYELEMENT,
90
+
end_value ANYELEMENT,
91
+
interval INTERVAL)
83
92
```
84
-
Копирует данные из родительской таблицы`parent` в дочерние секции.
93
+
Выполняет RANGE-секционирование для заданного диапазона таблицы`relation` по полю`attribute`. Данные также будут скопированы в дочерние секции.
94
+
95
+
###Утилиты
85
96
```
86
97
create_hash_update_trigger(parent TEXT)
87
98
```
88
99
Создает триггер на UPDATE для HASH секций. По-умолчанию триггер на обновление данных не создается, т.к. это создает дополнительные накладные расходы. Триггер полезен только в том случае, когда меняется значение ключевого аттрибута.
89
100
```
90
-
create_hash_update_trigger(parent TEXT)
101
+
create_range_update_trigger(parent TEXT)
91
102
```
92
103
Аналогично предыдущей, но для RANGE секций.
93
104
@@ -126,10 +137,6 @@ INSERT INTO hash_rel (value) SELECT g FROM generate_series(1, 10000) as g;