ruby-pg-extras 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -3
- data/lib/ruby-pg-extras.rb +1 -1
- data/lib/ruby-pg-extras/queries/long_running_queries.sql +1 -1
- 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: 943bbbbd7e2de25570164a5bbd5e6015708ca2f808e7f0b25523a4125ad1bbf0
|
4
|
+
data.tar.gz: dd4e28f9900f2b50eae39232828c47ebb7c6b57dbb9ca4042be074cda1214e75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12dd59913848f989fe6c186fefcdeb6418ab41cd6082b65f072b48d7d961e5d43b5c41822f8527bfda64e4557d284d52e74c0c3bd6dc1ca722fc958fa77d6b2a
|
7
|
+
data.tar.gz: 6c2d5445c0acb5eb93f614f778464c1059807112ca310efac9f135ca025985783ee553b7dca99e269d932a7d447c736011b54e791897e7e8671832492ee87add
|
data/README.md
CHANGED
@@ -85,6 +85,13 @@ RubyPGExtras.cache_hit(in_format: :raw) =>
|
|
85
85
|
#<PG::Result:0x00007f75777f7328 status=PGRES_TUPLES_OK ntuples=2 nfields=2 cmd_tuples=2>
|
86
86
|
```
|
87
87
|
|
88
|
+
Some methods accept an optional `args` param allowing you to customize queries:
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
RubyPGExtras.long_running_queries(args: { threshold: "200 milliseconds" })
|
92
|
+
|
93
|
+
```
|
94
|
+
|
88
95
|
## Available methods
|
89
96
|
|
90
97
|
### `cache_hit`
|
@@ -185,7 +192,7 @@ This command displays all the current locks, regardless of their type.
|
|
185
192
|
|
186
193
|
```ruby
|
187
194
|
|
188
|
-
RubyPGExtras.outliers
|
195
|
+
RubyPGExtras.outliers(args: { limit: 20 })
|
189
196
|
|
190
197
|
qry | exec_time | prop_exec_time | ncalls | sync_io_time
|
191
198
|
-----------------------------------------+------------------+----------------+-------------+--------------
|
@@ -207,7 +214,7 @@ Typically, an efficient query will have an appropriate ratio of calls to total e
|
|
207
214
|
|
208
215
|
```ruby
|
209
216
|
|
210
|
-
RubyPGExtras.calls
|
217
|
+
RubyPGExtras.calls(args: { limit: 10 })
|
211
218
|
|
212
219
|
qry | exec_time | prop_exec_time | ncalls | sync_io_time
|
213
220
|
-----------------------------------------+------------------+----------------+-------------+--------------
|
@@ -332,7 +339,7 @@ This command displays the total size of each table and materialized view in the
|
|
332
339
|
|
333
340
|
```ruby
|
334
341
|
|
335
|
-
RubyPGExtras.unused_indexes
|
342
|
+
RubyPGExtras.unused_indexes(args: { min_scans: 20 })
|
336
343
|
|
337
344
|
table | index | index_size | index_scans
|
338
345
|
---------------------+--------------------------------------------+------------+-------------
|
data/lib/ruby-pg-extras.rb
CHANGED
@@ -19,7 +19,7 @@ module RubyPGExtras
|
|
19
19
|
|
20
20
|
DEFAULT_ARGS = Hash.new({}).merge({
|
21
21
|
calls: { limit: 10 },
|
22
|
-
long_running_queries: {
|
22
|
+
long_running_queries: { threshold: "500 milliseconds" },
|
23
23
|
outliers: { limit: 10 },
|
24
24
|
unused_indexes: { min_scans: 50 }
|
25
25
|
})
|
@@ -9,6 +9,6 @@ FROM
|
|
9
9
|
WHERE
|
10
10
|
pg_stat_activity.query <> ''::text
|
11
11
|
AND state <> 'idle'
|
12
|
-
AND now() - pg_stat_activity.query_start > interval '%{
|
12
|
+
AND now() - pg_stat_activity.query_start > interval '%{threshold}'
|
13
13
|
ORDER BY
|
14
14
|
now() - pg_stat_activity.query_start 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: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|