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
+11-7Lines changed: 11 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,9 @@ Partitioning refers to splitting one large table into smaller pieces. Each row i
13
13
PostgreSQL supports partitioning via table inheritance. Each partition must be created as child table with CHECK CONSTRAINT. For example:
14
14
15
15
```
16
-
CHECK ( id >= 100 AND id < 200 )
17
-
CHECK ( id >= 200 AND id < 300 )
16
+
CREATE TABLE test (id SERIAL PRIMARY KEY, title TEXT);
17
+
CREATE TABLE test_1 (CHECK ( id >= 100 AND id < 200 )) INHERITS (test);
18
+
CREATE TABLE test_2 (CHECK ( id >= 200 AND id < 300 )) INHERITS (test);
18
19
```
19
20
20
21
Despite the flexibility of this approach it has weakness. If query uses filtering the optimizer forced to perform an exhaustive search and check constraints for each partition to determine partitions from which it should select data. If the number of partitions is large the overhead may be significant.
@@ -34,16 +35,19 @@ Based on partitioning type and operator the `pathman` searches corresponding par
34
35
35
36
##Installation
36
37
37
-
To install pathman run inpsql:
38
+
To install pathman run inpathman directory:
38
39
```
39
-
CREATE SCHEMA pathman;
40
-
CREATE EXTENSION pathman SCHEMA pathman;
40
+
make install
41
41
```
42
-
Then modify shared_preload_libraries parameter in postgres.conf as following:
42
+
Modify shared_preload_libraries parameter in postgres.conf as following:
43
43
```
44
44
shared_preload_libraries = 'pathman'
45
45
```
46
-
It will require to restart the PostgreSQL instance.
46
+
It will require to restart the PostgreSQL instance. Then execute following query in psql:
Copy file name to clipboardExpand all lines: README.rus.md
+11-8Lines changed: 11 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,9 @@
13
13
Секционирование в postgres основано на механизме наследования. Каждому наследнику задается условие CHECK CONSTRAINT. Например:
14
14
15
15
```
16
-
CHECK ( id >= 100 AND id < 200 )
17
-
CHECK ( id >= 200 AND id < 300 )
16
+
CREATE TABLE test (id SERIAL PRIMARY KEY, title TEXT);
17
+
CREATE TABLE test_1 (CHECK ( id >= 100 AND id < 200 )) INHERITS (test);
18
+
CREATE TABLE test_2 (CHECK ( id >= 200 AND id < 300 )) INHERITS (test);
18
19
```
19
20
20
21
Несмотря на гибкость, этот механизм обладает недостатками. Так при фильтрации данных оптимизатор вынужден перебирать все дочерние секции и сравнивать условие запроса с CHECK CONSTRAINT-ами секции, чтобы определить из каких секций ему следует загружать данные. При большом количестве секций это создает дополнительные накладные расходы, которые могут свести на нет выигрыш в производительности от применения секционирования.
@@ -35,17 +36,19 @@ WHERE id = 150
35
36
36
37
##Installation
37
38
38
-
Для установки pathman выполните вкомандной строке:
39
+
Для установки pathman выполните вдиректории модуля команду:
39
40
```
40
-
CREATE SCHEMA pathman;
41
-
CREATE EXTENSION pathman SCHEMA pathman;
42
-
41
+
make install
43
42
```
44
-
Затем модифицируйте параметр shared_preload_libraries в конфигурационном файле postgres.conf:
43
+
Модифицируйте параметр shared_preload_libraries в конфигурационном файле postgres.conf:
45
44
```
46
45
shared_preload_libraries = 'pathman'
47
46
```
48
-
Для вступления изменений в силу потребуется перезагрузка сервера PostgreSQL.
47
+
Для вступления изменений в силу потребуется перезагрузка сервера PostgreSQL. Затем выполните в psql: