ruby-pg-extras 5.6.2 → 5.6.4
Sign up to get free protection for your applications and to get access to all the features.
- 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: a728972344534c857c0e29497db20350a53f349e0642eea684c802e7e33f883d
|
4
|
+
data.tar.gz: 52308c26cf8a0fd2078d65467ecd1ab83a2014fbee99c00d1a9d1a33dff7d159
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44054f88d5144d5dd2b4b50ce3ba91527fcdab25867279f90bce56977e125c6ec1baa7021d95b3dca2ac4d5aa2c70bf788426642172f40e207a7f68823c5cce6
|
7
|
+
data.tar.gz: 7c0a736b6739add4949933236d3e3e36f44dfd917545386d206d66cf1f9c9604314e63990b86109311fb12a19a54d7366a38446d336c29e54406248f690ca0a9
|
@@ -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: "It looks like 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: "It looks like 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.4
|
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
|