pg_partitioner 0.7.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/pg_partitioner/separation_type/base.rb +11 -0
- data/lib/pg_partitioner/separation_type/month.rb +6 -6
- data/lib/pg_partitioner/separation_type/quater.rb +6 -6
- data/lib/pg_partitioner/separation_type/week.rb +6 -6
- data/lib/pg_partitioner/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9c728338fd4206174f0dc4f4632c7dd54be951f419295f56c96d0b161327ced9
|
|
4
|
+
data.tar.gz: bca15bd396a5606b632e8c3f00af80163bd6d6a8f65d3626e1e7ea7761338575
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6d1d47e0c1e8bf3d70b2c4f1de6702cedb1a337025bbbd22d14e8c6a783a3167c19a8fc14462cd25793feee5fb91a7e0c4117959c54188ee4b24ec33871793e9
|
|
7
|
+
data.tar.gz: fe83006a1699ef8cb31ce9dc2e1fe739bb1c220cf1a93223a339648b6662d144993ce7b7ce4a317409f66a6f4765cbae21958b2335af138076695771bb5aa01f
|
data/README.md
CHANGED
|
@@ -73,6 +73,17 @@ module PgPartitioner
|
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
|
+
|
|
77
|
+
def partition_table_names
|
|
78
|
+
sql = "SELECT child.relname
|
|
79
|
+
FROM pg_inherits
|
|
80
|
+
JOIN pg_class parent ON pg_inherits.inhparent = parent.oid
|
|
81
|
+
JOIN pg_class child ON pg_inherits.inhrelid = child.oid
|
|
82
|
+
WHERE parent.relname = '#{table_name}'
|
|
83
|
+
ORDER BY child.relname;"
|
|
84
|
+
|
|
85
|
+
execute_sql(sql).map { |row| row['relname'] }
|
|
86
|
+
end
|
|
76
87
|
end
|
|
77
88
|
end
|
|
78
89
|
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
module PgPartitioner
|
|
2
2
|
module SeparationType
|
|
3
3
|
module Month
|
|
4
|
-
def create_current_month_table
|
|
5
|
-
create_month_table(Date.today)
|
|
4
|
+
def create_current_month_table(autovacuum:)
|
|
5
|
+
create_month_table(Date.today, autovacuum:)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
def create_next_month_table
|
|
9
|
-
create_month_table(Date.today.next_month)
|
|
8
|
+
def create_next_month_table(autovacuum:)
|
|
9
|
+
create_month_table(Date.today.next_month, autovacuum)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def drop_old_month_table
|
|
@@ -15,7 +15,7 @@ module PgPartitioner
|
|
|
15
15
|
drop_table(table_name)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def create_month_table(date = Date.today)
|
|
18
|
+
def create_month_table(date = Date.today, autovacuum = true)
|
|
19
19
|
date_start = date.at_beginning_of_month
|
|
20
20
|
date_end = date.at_beginning_of_month.next_month
|
|
21
21
|
partition_table_name = name_of_partition_table(date, type: :month)
|
|
@@ -28,7 +28,7 @@ module PgPartitioner
|
|
|
28
28
|
sql = "ALTER TABLE #{partition_table_name} ADD PRIMARY KEY (id);"
|
|
29
29
|
execute_sql(sql)
|
|
30
30
|
|
|
31
|
-
disable_autovacuum(partition_table_name)
|
|
31
|
+
disable_autovacuum(partition_table_name) if autovacuum == false
|
|
32
32
|
create_partition_indexes(partition_table_name)
|
|
33
33
|
create_partition_named_indexes(partition_table_name)
|
|
34
34
|
create_partition_unique_indexes(partition_table_name)
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
module PgPartitioner
|
|
2
2
|
module SeparationType
|
|
3
3
|
module Quater
|
|
4
|
-
def create_current_quater_table
|
|
5
|
-
create_quater_table(Date.today)
|
|
4
|
+
def create_current_quater_table(autovacuum:)
|
|
5
|
+
create_quater_table(Date.today, autovacuum)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
def create_next_quater_table
|
|
9
|
-
create_quater_table(Date.today.next_quarter)
|
|
8
|
+
def create_next_quater_table(autovacuum:)
|
|
9
|
+
create_quater_table(Date.today.next_quarter, autovacuum)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
def create_quater_table(date = Date.today)
|
|
12
|
+
def create_quater_table(date = Date.today, autovacuum = true)
|
|
13
13
|
date_start = date.at_beginning_of_quarter
|
|
14
14
|
date_end = date.end_of_quarter.next_month.at_beginning_of_month
|
|
15
15
|
partition_table_name = name_of_partition_table(date, type: :quater)
|
|
@@ -22,7 +22,7 @@ module PgPartitioner
|
|
|
22
22
|
sql = "ALTER TABLE #{partition_table_name} ADD PRIMARY KEY (id);"
|
|
23
23
|
execute_sql(sql)
|
|
24
24
|
|
|
25
|
-
disable_autovacuum(partition_table_name)
|
|
25
|
+
disable_autovacuum(partition_table_name) if autovacuum == false
|
|
26
26
|
create_partition_indexes(partition_table_name)
|
|
27
27
|
create_partition_named_indexes(partition_table_name)
|
|
28
28
|
create_partition_unique_indexes(partition_table_name)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
module PgPartitioner
|
|
2
2
|
module SeparationType
|
|
3
3
|
module Week
|
|
4
|
-
def create_current_week_table
|
|
5
|
-
create_week_table(Date.today)
|
|
4
|
+
def create_current_week_table(autovacuum: )
|
|
5
|
+
create_week_table(Date.today, autovacuum)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
def create_next_week_table
|
|
9
|
-
create_week_table(Date.today.next_week)
|
|
8
|
+
def create_next_week_table(autovacuum: )
|
|
9
|
+
create_week_table(Date.today.next_week, autovacuum)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def drop_old_week_table
|
|
@@ -15,7 +15,7 @@ module PgPartitioner
|
|
|
15
15
|
drop_table(table_name)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def create_week_table(date = Date.today)
|
|
18
|
+
def create_week_table(date = Date.today, autovacuum = true)
|
|
19
19
|
date_start = date.at_beginning_of_week
|
|
20
20
|
date_end = date.at_beginning_of_week.next_week
|
|
21
21
|
partition_table_name = name_of_partition_table(date, type: :week)
|
|
@@ -28,7 +28,7 @@ module PgPartitioner
|
|
|
28
28
|
sql = "ALTER TABLE #{partition_table_name} ADD PRIMARY KEY (id);"
|
|
29
29
|
execute_sql(sql)
|
|
30
30
|
|
|
31
|
-
disable_autovacuum(partition_table_name)
|
|
31
|
+
disable_autovacuum(partition_table_name) if autovacuum == false
|
|
32
32
|
create_partition_indexes(partition_table_name)
|
|
33
33
|
create_partition_named_indexes(partition_table_name)
|
|
34
34
|
create_partition_unique_indexes(partition_table_name)
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pg_partitioner
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ovsapyan Mishel
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-10-22 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: bundler
|
|
@@ -61,6 +62,7 @@ homepage: http://appodeal.com
|
|
|
61
62
|
licenses: []
|
|
62
63
|
metadata:
|
|
63
64
|
allowed_push_host: https://rubygems.org
|
|
65
|
+
post_install_message:
|
|
64
66
|
rdoc_options: []
|
|
65
67
|
require_paths:
|
|
66
68
|
- lib
|
|
@@ -75,7 +77,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
75
77
|
- !ruby/object:Gem::Version
|
|
76
78
|
version: '0'
|
|
77
79
|
requirements: []
|
|
78
|
-
rubygems_version: 3.
|
|
80
|
+
rubygems_version: 3.5.11
|
|
81
|
+
signing_key:
|
|
79
82
|
specification_version: 4
|
|
80
83
|
summary: Gem for a partitoning PG tables
|
|
81
84
|
test_files: []
|