ruby-pg-extras 4.4.2 → 4.5.0

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: a75a544ae447f84999d6bcc098f3ebb7aa94e735e9b8eba6b8df6b7253e7a4fe
4
- data.tar.gz: 95afe79682512d1e10d681faee01b31c0c582025dd0a930017a7aaf3948ff2c9
3
+ metadata.gz: eccdaebec580ef42cfdb092693f1adf4db2b1b3dbfcb42a929d7d867fc4b853c
4
+ data.tar.gz: 87aefe7bf42510e3b3d1df787ce046eadef69965470edffd7cf02b462156a841
5
5
  SHA512:
6
- metadata.gz: f5ca9f98949e04fa469406d501b0df711cad8f2fbf50bc6d6870739d0b6cd549521bb631ca3ba6baf49df30655ca409be39f6c5a8579cab5b2fe75accd1bd2e3
7
- data.tar.gz: 876b69866ae37d3316d3a463dd95ec821db9b95c1c01dca563ac61fe381c74ab0e1c6dc4a2881f1b77b54728dbacdc2789db315f2068e608030f7f6939448b14
6
+ metadata.gz: 28bfa046456ae5fd15183d56c185ca5fc30ab8e2f3208e7640c53e5cdb4ad6d9df223f97d81b8e529405c44d6041ebefd0fe92b0135a1762a7a72fc83b3e5617
7
+ data.tar.gz: 1189fe24c64b2de4dfaa807f1b98e380b33cd60a4a8d209ba453d14cd41e726718dc42d6ca35300d4f812dcdd2d8730ce298bfebaa4911b29cf0441f105f9ae9
@@ -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.2"
4
+ VERSION = "4.5.0"
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.2
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-03-22 00:00:00.000000000 Z
11
+ date: 2022-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg