ruby-pg-extras 4.4.2 → 4.5.0
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.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: eccdaebec580ef42cfdb092693f1adf4db2b1b3dbfcb42a929d7d867fc4b853c
|
4
|
+
data.tar.gz: 87aefe7bf42510e3b3d1df787ce046eadef69965470edffd7cf02b462156a841
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28bfa046456ae5fd15183d56c185ca5fc30ab8e2f3208e7640c53e5cdb4ad6d9df223f97d81b8e529405c44d6041ebefd0fe92b0135a1762a7a72fc83b3e5617
|
7
|
+
data.tar.gz: 1189fe24c64b2de4dfaa807f1b98e380b33cd60a4a8d209ba453d14cd41e726718dc42d6ca35300d4f812dcdd2d8730ce298bfebaa4911b29cf0441f105f9ae9
|
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.0
|
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-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|