ruby-pg-extras 3.2.1 → 3.2.5

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: 05d2e5841e02ca2a6ea167296d565a0df5e9a516c9e975589db3bd1b7856a5f7
4
- data.tar.gz: 21a2d1b015d0558f4875f5cf1862b5e63a6e1ecbface59d88439712894716d17
3
+ metadata.gz: 215a0cc7419021dbe7a9d0a62ec22707110338b891d4b822de03a5040391180c
4
+ data.tar.gz: 3bda8bea49fc3e05c96e45652a4d35036cc675c3e4e245febbcbc1198e4e90d2
5
5
  SHA512:
6
- metadata.gz: 0bf1ddceb1d24b718b979abc9dc03c04b94d6500487318e32805c8885f8a244bb548dd7c9dd7f738be7de0fa73f1212493a3a22c431ace69478aed2a38901dc7
7
- data.tar.gz: 628eeea090e2839bc38d512a801f13ab7ef7413eb2c45719171dd9946800e9a98444f81a96d14102da749de85776931a616aee5e06f46a4d4f0469cca0e6cb1c
6
+ metadata.gz: 3e8fe8accc5518cfa61fa5f4f80aee4272d392d7e31f8c63e0e979c2e046537a12ccb658f89a360d50aa8e155d5369de44fa3f8c0e9b202f9cdf6a34df23d82b
7
+ data.tar.gz: 550f63e042809b83777baf3dcbaec7e36800017e5d22376dbbab1a512a903c31f5eb7f72efe4d6ca413aee18acb72ed11ab7c3ebf7e50f26cea8aa52fb45032d
data/README.md CHANGED
@@ -112,6 +112,38 @@ Keep reading to learn about methods that `diagnose` uses under the hood.
112
112
 
113
113
  ## Available methods
114
114
 
115
+ ### `table_info`
116
+
117
+ This method displays metadata metrics for all or a selected table. You can use it to check the table's size, its cache hit metrics, and whether it is correctly indexed. Many sequential scans or no index scans are potential indicators of misconfigured indexes. This method aggregates data provided by other methods in an easy to analyze summary format.
118
+
119
+ ```ruby
120
+ RubyPGExtras.table_info(args: { table_name: "users" })
121
+
122
+ | Table name | Table size | Table cache hit | Indexes cache hit | Estimated rows | Sequential scans | Indexes scans |
123
+ +------------+------------+-------------------+--------------------+----------------+------------------+---------------+
124
+ | users | 2432 kB | 0.999966685701511 | 0.9988780464661853 | 16650 | 2128 | 512496 |
125
+
126
+ ```
127
+
128
+ ### `index_info`
129
+
130
+ This method returns summary info about database indexes. You can check index size, how often it is used and what percentage of its total size are NULL values. Like the previous method, it aggregates data from other helper methods in an easy-to-digest format.
131
+
132
+ ```ruby
133
+
134
+ RubyPGExtras.index_info(args: { table_name: "users" })
135
+
136
+ | Index name | Table name | Columns | Index size | Index scans | Null frac |
137
+ +-------------------------------+------------+----------------+------------+-------------+-----------+
138
+ | users_pkey | users | id | 1152 kB | 163007 | 0.00% |
139
+ | index_users_on_slack_id | users | slack_id | 1080 kB | 258870 | 0.00% |
140
+ | index_users_on_team_id | users | team_id | 816 kB | 70962 | 0.00% |
141
+ | index_users_on_uuid | users | uuid | 1032 kB | 0 | 0.00% |
142
+ | index_users_on_block_uuid | users | block_uuid | 776 kB | 19502 | 100.00% |
143
+ | index_users_on_api_auth_token | users | api_auth_token | 1744 kB | 156 | 0.00% |
144
+
145
+ ```
146
+
115
147
  ### `cache_hit`
116
148
 
117
149
  ```ruby
@@ -28,7 +28,7 @@ module RubyPGExtras
28
28
  end.fetch("index_scans", "N/A"),
29
29
  null_frac: null_indexes_data.find do |el|
30
30
  el.fetch("index") == index_name
31
- end&.fetch("null_frac", "N/A") || "0.00%"
31
+ end&.fetch("null_frac", "N/A")&.strip || "0.00%"
32
32
  }
33
33
  end
34
34
  end
@@ -28,7 +28,7 @@ module RubyPGExtras
28
28
  "Table cache hit",
29
29
  "Indexes cache hit",
30
30
  "Estimated rows",
31
- "Sequentail scans",
31
+ "Sequential scans",
32
32
  "Indexes scans"
33
33
  ],
34
34
  title: title,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyPGExtras
4
- VERSION = "3.2.1"
4
+ VERSION = "3.2.5"
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: 3.2.1
4
+ version: 3.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-15 00:00:00.000000000 Z
11
+ date: 2021-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg