ruby-pg-extras 4.4.3 → 4.5.1
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.rb +11 -2
- data/lib/ruby_pg_extras/queries/cache_hit.sql +3 -1
- data/lib/ruby_pg_extras/queries/index_cache_hit.sql +2 -0
- data/lib/ruby_pg_extras/queries/index_scans.sql +1 -0
- data/lib/ruby_pg_extras/queries/index_usage.sql +3 -1
- data/lib/ruby_pg_extras/queries/records_rank.sql +2 -0
- data/lib/ruby_pg_extras/queries/seq_scans.sql +2 -0
- data/lib/ruby_pg_extras/queries/table_cache_hit.sql +2 -0
- data/lib/ruby_pg_extras/queries/table_index_scans.sql +2 -0
- data/lib/ruby_pg_extras/queries/tables.sql +1 -1
- data/lib/ruby_pg_extras/queries/unused_indexes.sql +1 -0
- 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: d029c96b61595f277b52f37a747a644943f7569394a9d7bf3e84758397e40174
|
4
|
+
data.tar.gz: 0f5abfe2d07b9030d0eb768d6e3712d139eecafa9c12d77c4ac51f802bc9f007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '083ed61d5ab3804b90416da21b11e4463efda2e2e81dbd457b60bbb31bbb165ef2e097d1eb65114437a87e54c6aa434e214630c3652f47871a3ac40b3bb4eb88'
|
7
|
+
data.tar.gz: 8451042b71129d99672ad90d6906c31bee8181ba4e0acc12af68b85ab14a9f5eac19e2ecea7dd485fc7b7738b02f2d8df3c8d74b26e976f087cd906ac1b9ac2d
|
data/lib/ruby-pg-extras.rb
CHANGED
@@ -34,8 +34,17 @@ module RubyPgExtras
|
|
34
34
|
outliers_legacy: { limit: 10 },
|
35
35
|
buffercache_stats: { limit: 10 },
|
36
36
|
buffercache_usage: { limit: 20 },
|
37
|
-
unused_indexes: { max_scans: 50 },
|
38
|
-
null_indexes: { min_relation_size_mb: 10 }
|
37
|
+
unused_indexes: { max_scans: 50, schema: "public" },
|
38
|
+
null_indexes: { min_relation_size_mb: 10 },
|
39
|
+
index_usage: { schema: "public" },
|
40
|
+
index_cache_hit: { schema: "public" },
|
41
|
+
table_cache_hit: { schema: "public" },
|
42
|
+
index_scans: { schema: "public" },
|
43
|
+
cache_hit: { schema: "public" },
|
44
|
+
seq_scans: { schema: "public" },
|
45
|
+
table_index_scans: { schema: "public" },
|
46
|
+
records_rank: { schema: "public" },
|
47
|
+
tables: { schema: "public" }
|
39
48
|
})
|
40
49
|
|
41
50
|
QUERIES.each do |query_name|
|
@@ -4,8 +4,10 @@ SELECT
|
|
4
4
|
'index hit rate' AS name,
|
5
5
|
(sum(idx_blks_hit)) / nullif(sum(idx_blks_hit + idx_blks_read),0) AS ratio
|
6
6
|
FROM pg_statio_user_indexes
|
7
|
+
WHERE schemaname = '%{schema}'
|
7
8
|
UNION ALL
|
8
9
|
SELECT
|
9
10
|
'table hit rate' AS name,
|
10
11
|
sum(heap_blks_hit) / nullif(sum(heap_blks_hit) + sum(heap_blks_read),0) AS ratio
|
11
|
-
FROM pg_statio_user_tables
|
12
|
+
FROM pg_statio_user_tables
|
13
|
+
WHERE schemaname = '%{schema}';
|
@@ -8,5 +8,6 @@ SELECT
|
|
8
8
|
idx_scan as index_scans
|
9
9
|
FROM pg_stat_user_indexes ui
|
10
10
|
JOIN pg_index i ON ui.indexrelid = i.indexrelid
|
11
|
+
WHERE schemaname = '%{schema}'
|
11
12
|
ORDER BY pg_relation_size(i.indexrelid) / nullif(idx_scan, 0) DESC NULLS FIRST,
|
12
13
|
pg_relation_size(i.indexrelid) DESC;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* Index hit rate (effective databases are at 99
|
1
|
+
/* Index hit rate (effective databases are at 99 percent and up) */
|
2
2
|
|
3
3
|
SELECT relname,
|
4
4
|
CASE idx_scan
|
@@ -8,5 +8,7 @@ SELECT relname,
|
|
8
8
|
n_live_tup rows_in_table
|
9
9
|
FROM
|
10
10
|
pg_stat_user_tables
|
11
|
+
WHERE
|
12
|
+
schemaname = '%{schema}'
|
11
13
|
ORDER BY
|
12
14
|
n_live_tup DESC;
|
@@ -12,5 +12,6 @@ SELECT
|
|
12
12
|
FROM pg_stat_user_indexes ui
|
13
13
|
JOIN pg_index i ON ui.indexrelid = i.indexrelid
|
14
14
|
WHERE NOT indisunique AND idx_scan < %{max_scans} AND pg_relation_size(relid) > 5 * 8192
|
15
|
+
AND schemaname = '%{schema}'
|
15
16
|
ORDER BY pg_relation_size(i.indexrelid) / nullif(idx_scan, 0) DESC NULLS FIRST,
|
16
17
|
pg_relation_size(i.indexrelid) DESC;
|
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: 4.
|
4
|
+
version: 4.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|