ruby-pg-extras 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/ruby-pg-extras.rb +2 -1
- data/lib/ruby-pg-extras/queries/null_indexes.sql +3 -3
- data/lib/ruby-pg-extras/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 869687fea5c3e1c4c00ddd705bd3446413529164b8d628368daff0fe7161ee94
|
4
|
+
data.tar.gz: 074a7847ca0e36fad4059a5650d2a02806d01da92deeabb19bf1a93ae490366f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d51fd8809cda4c5d167a352ab6a0c1dbd09e043474a5a763e4ca1853a35d0f4fda8788d7f603bd89238823ddf1cb1a9014eec97674ea039b367d3b449f6ab96
|
7
|
+
data.tar.gz: d1fcf3c26a1ff72ae8b2cff877c650d38e5ebc03b4ef139c62a9f7be04582882e1f18f9b24ac1bfcb2fc746492ac5e28fe63009afa77413a1cf3a0d4f626a65c
|
data/README.md
CHANGED
@@ -359,9 +359,9 @@ RubyPGExtras.null_indexes
|
|
359
359
|
|
360
360
|
oid | index | index_size | unique | indexed_column | null_frac | expected_saving
|
361
361
|
---------+--------------------+------------+--------+----------------+-----------+-----------------
|
362
|
-
183764 | users_reset_token |
|
363
|
-
88732 | plan_cancelled_at |
|
364
|
-
9827345 | users_email |
|
362
|
+
183764 | users_reset_token | 1445 MB | t | reset_token | 97.00% | 1401 MB
|
363
|
+
88732 | plan_cancelled_at | 539 MB | f | cancelled_at | 8.30% | 44 MB
|
364
|
+
9827345 | users_email | 18 MB | t | email | 28.67% | 5160 kB
|
365
365
|
|
366
366
|
```
|
367
367
|
|
data/lib/ruby-pg-extras.rb
CHANGED
@@ -21,7 +21,8 @@ module RubyPGExtras
|
|
21
21
|
calls: { limit: 10 },
|
22
22
|
long_running_queries: { threshold: "500 milliseconds" },
|
23
23
|
outliers: { limit: 10 },
|
24
|
-
unused_indexes: { min_scans: 50 }
|
24
|
+
unused_indexes: { min_scans: 50 },
|
25
|
+
null_indexes: { min_relation_size_mb: 10 }
|
25
26
|
})
|
26
27
|
|
27
28
|
QUERIES.each do |query_name|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* Find
|
1
|
+
/* Find indexes with a high ratio of NULL values */
|
2
2
|
SELECT
|
3
3
|
c.oid,
|
4
4
|
c.relname AS index,
|
@@ -26,7 +26,7 @@ WHERE
|
|
26
26
|
AND array_length(i.indkey, 1) = 1
|
27
27
|
-- Exclude indexes without null_frac ratio
|
28
28
|
AND coalesce(s.null_frac, 0) != 0
|
29
|
-
-- Larger than
|
30
|
-
AND pg_relation_size(c.oid) >
|
29
|
+
-- Larger than threshold
|
30
|
+
AND pg_relation_size(c.oid) > %{min_relation_size_mb} * 1024 ^ 2
|
31
31
|
ORDER BY
|
32
32
|
pg_relation_size(c.oid) * s.null_frac DESC;
|