ruby-pg-extras 0.7.0 → 1.0.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: '05768abc8a8d84bf67f2b5421f687044aab327521e9206cb58356d6c0905ec68'
4
- data.tar.gz: 864923ef0192c664b46dce8ecc0b126a5d6699319fda1f101d9d36c5b1e73758
3
+ metadata.gz: 31f7c01df2a34c5808c2b8453093e6ce9bf2d55511ac88375279fea78a8d46e9
4
+ data.tar.gz: a1f285519deb70a92aeb1680a3babb4bca74e7b91ed7d55ff11f188200611046
5
5
  SHA512:
6
- metadata.gz: 113c943c72a86772077079886dc6ea0b23b82651e00dad201921b91caa40900802a5efe832f9e3945012ba23ae17c5c8044d8e18a1325ff16df965843aeb6c15
7
- data.tar.gz: 15e13d0547b587ddb7fc3fb26bfbde451b7a9e47615631cfa379bb0fc6b69dd96a95624814e4ebec1d876861685528028b467325725815cd78d8d14a06fcdd9f
6
+ metadata.gz: cd2503652ba87050811d301fa47fff20614c0d3821aea52001c2acb6c6f22b4d1f2de7294408c57b48fe7c657fb8f65c26690f5459f8d0c8c1cd2a4003426c60
7
+ data.tar.gz: ded972ab987058cbdc701e40a3046a02fa0ca70a315a83effa01a6925adfbb26418e42c1fa7c1413308b411ec73f6ff4179c8957dece6a427686d88c059c1c73
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Ruby PG Extras [![Gem Version](https://badge.fury.io/rb/ruby-pg-extras.svg)](https://badge.fury.io/rb/ruby-pg-extras) [![CircleCI](https://circleci.com/gh/pawurb/ruby-pg-extras.svg?style=svg)](https://circleci.com/gh/pawurb/ruby-pg-extras)
2
2
 
3
- Ruby port of [Heroku PG Extras](https://github.com/heroku/heroku-pg-extras). The goal of this project is to provide powerful insights into the PostgreSQL database for Ruby apps that are not using the Heroku PostgreSQL plugin.
3
+ Ruby port of [Heroku PG Extras](https://github.com/heroku/heroku-pg-extras) with several additions and improvements. The goal of this project is to provide powerful insights into the PostgreSQL database for Ruby apps that are not using the Heroku PostgreSQL plugin.
4
4
 
5
- Included rake tasks and Ruby methods can be used to obtain information about a Postgres instance, that may be useful when analyzing performance issues. This includes information about locks, index usage, buffer cache hit ratios and vacuum statistics. Ruby API enables developers to easily integrate the tool into e.g. automatic monitoring tasks.
5
+ Queries can be used to obtain information about a Postgres instance, that may be useful when analyzing performance issues. This includes information about locks, index usage, buffer cache hit ratios and vacuum statistics. Ruby API enables developers to easily integrate the tool into e.g. automatic monitoring tasks.
6
6
 
7
7
  Are you riding on Rails? Check out the [Rails version](https://github.com/pawurb/rails-pg-extras).
8
8
 
@@ -77,6 +77,38 @@ RubyPGExtras.cache_hit
77
77
 
78
78
  This command provides information on the efficiency of the buffer cache, for both index reads (`index hit rate`) as well as table reads (`table hit rate`). A low buffer cache hit ratio can be a sign that the Postgres instance is too small for the workload.
79
79
 
80
+ #### `index_cache_hit`
81
+
82
+ ```ruby
83
+
84
+ RubyPGExtras.index_cache_hit
85
+
86
+ | name | buffer_hits | block_reads | total_read | ratio |
87
+ +-----------------------+-------------+-------------+------------+-------------------+
88
+ | teams | 187665 | 109 | 187774 | 0.999419514948821 |
89
+ | subscriptions | 5160 | 6 | 5166 | 0.99883855981417 |
90
+ | plans | 5718 | 9 | 5727 | 0.998428496595076 |
91
+ (truncated results for brevity)
92
+ ```
93
+
94
+ The same as `cache_hit` with each table's indexes cache hit info displayed seperately.
95
+
96
+ #### `table_cache_hit`
97
+
98
+ ```ruby
99
+
100
+ RubyPGExtras.table_cache_hit
101
+
102
+ | name | buffer_hits | block_reads | total_read | ratio |
103
+ +-----------------------+-------------+-------------+------------+-------------------+
104
+ | plans | 32123 | 2 | 32125 | 0.999937743190662 |
105
+ | subscriptions | 95021 | 8 | 95029 | 0.999915815172211 |
106
+ | teams | 171637 | 200 | 171837 | 0.99883610631005 |
107
+ (truncated results for brevity)
108
+ ```
109
+
110
+ The same as `cache_hit` with each table's cache hit info displayed seperately.
111
+
80
112
  #### `index_usage`
81
113
 
82
114
  ```ruby
@@ -139,10 +171,7 @@ RubyPGExtras.outliers
139
171
  SELECT * FROM usage_events WHERE (alp.. | 01:18:10.754354 | 0.6% | 102,114,301 | 00:00:00
140
172
  UPDATE usage_events SET reporter_id =.. | 00:52:35.683254 | 0.4% | 23,786,348 | 00:00:00
141
173
  INSERT INTO usage_events (id, retaine.. | 00:49:24.952561 | 0.4% | 21,988,201 | 00:00:00
142
- COPY public.app_ownership_events (id,.. | 00:37:14.31082 | 0.3% | 13 | 00:12:32.584754
143
- INSERT INTO app_ownership_events (id,.. | 00:26:59.808212 | 0.2% | 383,109 | 00:00:00
144
- SELECT * FROM app_ownership_events .. | 00:19:06.021846 | 0.1% | 744,879 | 00:00:00
145
- (10 rows)
174
+ (truncated results for brevity)
146
175
  ```
147
176
 
148
177
  This command displays statements, obtained from `pg_stat_statements`, ordered by the amount of time to execute in aggregate. This includes the statement itself, the total execution time for that statement, the proportion of total execution time for all statements that statement has taken up, the number of times that statement has been called, and the amount of time that statement spent on synchronous I/O (reading/writing from the filesystem).
@@ -164,10 +193,7 @@ RubyPGExtras.calls
164
193
  UPDATE usage_events SET reporter_id =.. | 00:52:35.986167 | 0.4% | 23,788,388 | 00:00:00
165
194
  INSERT INTO usage_events (id, retaine.. | 00:49:25.260245 | 0.4% | 21,990,326 | 00:00:00
166
195
  INSERT INTO usage_events (id, retaine.. | 01:42:59.436532 | 0.8% | 12,328,187 | 00:00:00
167
- SELECT * FROM app_ownership_events .. | 00:19:06.289521 | 0.1% | 744,976 | 00:00:00
168
- INSERT INTO app_ownership_events(id, .. | 00:26:59.885631 | 0.2% | 383,153 | 00:00:00
169
- UPDATE app_ownership_events SET app_i.. | 00:01:22.282337 | 0.0% | 359,741 | 00:00:00
170
- (10 rows)
196
+ (truncated results for brevity)
171
197
  ```
172
198
 
173
199
  This command is much like `pg:outliers`, but ordered by the number of times a statement has been called.
@@ -218,11 +244,6 @@ RubyPGExtras.index_size
218
244
  index_attempts_on_enrollment_id | 1957 MB
219
245
  index_enrollment_attemptables_by_enrollment_activity_id | 1789 MB
220
246
  enrollment_activities_pkey | 458 MB
221
- index_enrollment_activities_by_lesson_enrollment_and_activity | 402 MB
222
- index_placement_attempts_on_response_id | 109 MB
223
- index_placement_attempts_on_placement_test_id | 108 MB
224
- index_placement_attempts_on_grade_level_id | 97 MB
225
- index_lesson_enrollments_on_lesson_id | 93 MB
226
247
  (truncated results for brevity)
227
248
  ```
228
249
 
@@ -315,14 +336,6 @@ RubyPGExtras.seq_scans
315
336
  messages | 3922247
316
337
  contests_customers | 2915972
317
338
  classroom_goals | 2142014
318
- contests | 1370267
319
- goals | 1112659
320
- districts | 158995
321
- rollup_reports | 115942
322
- customers | 93847
323
- schools | 92984
324
- classrooms | 92982
325
- customer_settings | 91226
326
339
  (truncated results for brevity)
327
340
  ```
328
341
 
@@ -378,6 +391,7 @@ RubyPGExtras.bloat
378
391
  index | public | bloated_table::bloated_index | 3.7 | 34 MB
379
392
  table | public | clean_table | 0.2 | 3808 kB
380
393
  table | public | other_clean_table | 0.3 | 1576 kB
394
+ (truncated results for brevity)
381
395
  ```
382
396
 
383
397
  This command displays an estimation of table "bloat" – space allocated to a relation that is full of dead tuples, that has yet to be reclaimed. Tables that have a high bloat ratio, typically 10 or greater, should be investigated to see if vacuuming is aggressive enough, and can be a sign of high table churn.
@@ -395,6 +409,7 @@ RubyPGExtras.vacuum_stats
395
409
  public | other_table | | 2013-04-26 11:41 | 41 | 47 | 58 |
396
410
  public | queue_table | | 2013-04-26 17:39 | 12 | 8,228 | 52 | yes
397
411
  public | picnic_table | | | 13 | 0 | 53 |
412
+ (truncated results for brevity)
398
413
  ```
399
414
 
400
415
  This command displays statistics related to vacuum operations for each table, including an estiamtion of dead rows, last autovacuum and the current autovacuum threshold. This command can be useful when determining if current vacuum thresholds require adjustments, and to determine when the table was last vacuumed.
@@ -1,3 +1,3 @@
1
1
  module RubyPGExtras
2
- VERSION = "0.7.0"
2
+ VERSION = "1.0.0"
3
3
  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: 0.7.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-11 00:00:00.000000000 Z
11
+ date: 2020-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg