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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c471b7ac80895c7a7da88e209e09ade77e19c271afb9f521f5e509364f92602
4
- data.tar.gz: 0dafaec9b06d5933ea0ff47b319f8f6f124efa198033081646171bc5ad41be6c
3
+ metadata.gz: d029c96b61595f277b52f37a747a644943f7569394a9d7bf3e84758397e40174
4
+ data.tar.gz: 0f5abfe2d07b9030d0eb768d6e3712d139eecafa9c12d77c4ac51f802bc9f007
5
5
  SHA512:
6
- metadata.gz: a3d883fbc9df95bde2bdc4172d9228bc271258ab4a3d786cbe201b3c14d7a7f2cf77f84be1bffea5b24db0b0e8d58bdfa85fab391058966090f688e13f5525b4
7
- data.tar.gz: 3ec452eeab7223d6f9d4cf522aa9f795b769d076f25564b3915220f53292ced82fcdd642845978915da0102c7e60c479e781cfce1d95eb4d6aa910ca381c14ae
6
+ metadata.gz: '083ed61d5ab3804b90416da21b11e4463efda2e2e81dbd457b60bbb31bbb165ef2e097d1eb65114437a87e54c6aa434e214630c3652f47871a3ac40b3bb4eb88'
7
+ data.tar.gz: 8451042b71129d99672ad90d6906c31bee8181ba4e0acc12af68b85ab14a9f5eac19e2ecea7dd485fc7b7738b02f2d8df3c8d74b26e976f087cd906ac1b9ac2d
@@ -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}';
@@ -11,5 +11,7 @@ SELECT
11
11
  END ratio
12
12
  FROM
13
13
  pg_statio_user_tables
14
+ WHERE
15
+ schemaname = '%{schema}'
14
16
  ORDER BY
15
17
  idx_blks_hit / (idx_blks_hit + idx_blks_read + 1)::float DESC;
@@ -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% and up) */
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;
@@ -5,5 +5,7 @@ SELECT
5
5
  n_live_tup AS estimated_count
6
6
  FROM
7
7
  pg_stat_user_tables
8
+ WHERE
9
+ schemaname = '%{schema}'
8
10
  ORDER BY
9
11
  n_live_tup DESC;
@@ -4,4 +4,6 @@ SELECT relname AS name,
4
4
  seq_scan as count
5
5
  FROM
6
6
  pg_stat_user_tables
7
+ WHERE
8
+ schemaname = '%{schema}'
7
9
  ORDER BY seq_scan DESC;
@@ -11,5 +11,7 @@ SELECT
11
11
  END ratio
12
12
  FROM
13
13
  pg_statio_user_tables
14
+ WHERE
15
+ schemaname = '%{schema}'
14
16
  ORDER BY
15
17
  heap_blks_hit / (heap_blks_hit + heap_blks_read + 1)::float DESC;
@@ -4,4 +4,6 @@ SELECT relname AS name,
4
4
  idx_scan as count
5
5
  FROM
6
6
  pg_stat_user_tables
7
+ WHERE
8
+ schemaname = '%{schema}'
7
9
  ORDER BY idx_scan DESC;
@@ -1,3 +1,3 @@
1
1
  /* List all the tables. */
2
2
 
3
- select relname as tablename, schemaname from pg_statio_user_tables;
3
+ select relname as tablename, schemaname from pg_statio_user_tables where schemaname = '%{schema}';
@@ -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;
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyPgExtras
4
- VERSION = "4.4.3"
4
+ VERSION = "4.5.1"
5
5
  end
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.3
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-03-23 00:00:00.000000000 Z
11
+ date: 2022-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg