ruby-pg-extras 5.6.2 → 5.6.5
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/lib/ruby_pg_extras/diagnose_data.rb +49 -2
- data/lib/ruby_pg_extras/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af8d0e2edb9db1d0fe94ffdb5201c22f706393958c894543130f3bb77107d498
|
4
|
+
data.tar.gz: bb293f084f8588a96117586170040414859545ccccf0ee09c566af4aa99944c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d87d7591fc5ab1064de8bbaefefc37d12460e821a144438ddaf685b4f50b5184164aade465d2889e70f60f29ccbe2ca8ed14654bf7ce7abb6d940af2224c0c7
|
7
|
+
data.tar.gz: 9fd2e0fba88986669e459dd5a97d53a6b2db6391aac48f1737c1187324fbc32c715a79c203caff8680771a0d1b0eddd984326217feec6ca690628c21a072d5c7
|
@@ -17,14 +17,16 @@ module RubyPgExtras
|
|
17
17
|
|
18
18
|
def call
|
19
19
|
[
|
20
|
+
:missing_fk_indexes,
|
21
|
+
:missing_fk_constraints,
|
22
|
+
:random_page_cost,
|
23
|
+
:work_mem,
|
20
24
|
:table_cache_hit,
|
21
25
|
:index_cache_hit,
|
22
26
|
:unused_indexes,
|
23
27
|
:null_indexes,
|
24
28
|
:bloat,
|
25
29
|
:duplicate_indexes,
|
26
|
-
:missing_fk_indexes,
|
27
|
-
:missing_fk_constraints,
|
28
30
|
].yield_self do |checks|
|
29
31
|
extensions_data = query_module.extensions(in_format: :hash)
|
30
32
|
|
@@ -57,6 +59,51 @@ module RubyPgExtras
|
|
57
59
|
RubyPgExtras
|
58
60
|
end
|
59
61
|
|
62
|
+
def work_mem
|
63
|
+
db_settings = query_module.db_settings(in_format: :hash)
|
64
|
+
|
65
|
+
work_mem_val = db_settings.find do |el|
|
66
|
+
el.fetch("name") == "work_mem"
|
67
|
+
end
|
68
|
+
|
69
|
+
value = work_mem_val.fetch("setting")
|
70
|
+
unit = work_mem_val.fetch("unit")
|
71
|
+
|
72
|
+
if value == "4096" && unit == "kB"
|
73
|
+
{
|
74
|
+
ok: false,
|
75
|
+
message: "The db is using the default 'work_mem' value of '#{value}#{unit}'. This value is often too low for modern hardware and can result in suboptimal query plans. Visit https://pgtune.leopard.in.ua/ to find the correct value for your database.",
|
76
|
+
}
|
77
|
+
else
|
78
|
+
{
|
79
|
+
ok: true,
|
80
|
+
message: "'work_mem' is set to the value of '#{value}#{unit}'. You can check https://pgtune.leopard.in.ua/ to confirm if this is the correct value for your database.",
|
81
|
+
}
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def random_page_cost
|
86
|
+
db_settings = query_module.db_settings(in_format: :hash)
|
87
|
+
|
88
|
+
random_page_cost_val = db_settings.find do |el|
|
89
|
+
el.fetch("name") == "random_page_cost"
|
90
|
+
end
|
91
|
+
|
92
|
+
value = random_page_cost_val.fetch("setting")
|
93
|
+
|
94
|
+
if value == "4"
|
95
|
+
{
|
96
|
+
ok: false,
|
97
|
+
message: "The db is using the default 'random_page_cost' value of '4'. This value is often too low for modern hardware and can result in suboptimal indexes utilization. Consider setting it to '1.1'. See https://pgtune.leopard.in.ua/ for more information.",
|
98
|
+
}
|
99
|
+
else
|
100
|
+
{
|
101
|
+
ok: true,
|
102
|
+
message: "'random_page_cost' is set to the value of '#{value}'. You can check https://pgtune.leopard.in.ua/ to confirm if this is the correct value for your database.",
|
103
|
+
}
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
60
107
|
def missing_fk_indexes
|
61
108
|
missing = query_module.missing_fk_indexes(in_format: :hash)
|
62
109
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-pg-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.6.
|
4
|
+
version: 5.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|