rails-pg-extras 5.2.1 → 5.2.2

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: 4bd83f21b85de2b816dc334b72ad1bd0dfcb0f13ea6946fec42ebb93f47ba876
4
- data.tar.gz: 4e9e5b00cc7e07cf3baa1bc3e224fe8ab50510afa909b47e753873fb1e7a11e7
3
+ metadata.gz: 831f887d91a8519dc968d3f612eb08059100e99d717db2a8ce6f0c13684d4714
4
+ data.tar.gz: f8da112789be789c8f1be7c7e11b27c94c5e8166e7096381cdfa726140fb3df4
5
5
  SHA512:
6
- metadata.gz: 1a30823d47f9e0cab719b7ee6e750da28c751f4dc20d21756f7f3a633c07dd6390397e09502300cfcf9185184a9e00af83de40f2fd9b12a6319a6ade31ccb26f
7
- data.tar.gz: f01d58920638949122f26a74857cdab232168b274aee2d28d180eed09ea60a48ace036aa3ba772dc8ce41893d6e4a4397255167bc5ccf699a181c7205438ed93
6
+ metadata.gz: 152d6244f1e32d32c3f98510b7316b224cc22c9e3a40ea84ce130e109335adf222f3e43391285dfd3e8c8ab51285a0b0933fe9529fabc2c4344ab2831b08bcbf
7
+ data.tar.gz: 51d26d67deaa392f3c8055f55cf6c0ac0e54dfa284eaf9445b59cb49ad14b7a47a0f2e0e057858bde2a1bace4309bd6aa17389b5804b8daf2cd0dba8e3506683
data/README.md CHANGED
@@ -51,7 +51,7 @@ You should see the similar line in the output:
51
51
  RailsPgExtras.add_extensions
52
52
  ```
53
53
 
54
- By deafult a primary ActiveRecord database connection is used for running metadata queries, rake tasks and web UI. To connect to a different database you can specify an `ENV['RAILS_PG_EXTRAS_DATABASE_URL']` value in the following format:
54
+ By default a primary ActiveRecord database connection is used for running metadata queries, rake tasks and web UI. To connect to a different database you can specify an `ENV['RAILS_PG_EXTRAS_DATABASE_URL']` value in the following format:
55
55
 
56
56
  ```ruby
57
57
  ENV["RAILS_PG_EXTRAS_DATABASE_URL"] = "postgresql://postgres:secret@localhost:5432/database_name"
@@ -152,18 +152,18 @@ RailsPgExtras.measure_queries { User.limit(10).map(&:team) }
152
152
  :queries=>
153
153
  {"SELECT \"users\".* FROM \"users\" LIMIT $1"=>
154
154
  {:count=>1,
155
- :total_duration=>3.452000004472211,
156
- :min_duration=>3.452000004472211,
157
- :max_duration=>3.452000004472211,
158
- :avg_duration=>3.452000004472211},
155
+ :total_duration=>1.9,
156
+ :min_duration=>1.9,
157
+ :max_duration=>1.9,
158
+ :avg_duration=>1.9},
159
159
  "SELECT \"teams\".* FROM \"teams\" WHERE \"teams\".\"id\" = $1 LIMIT $2"=>
160
160
  {:count=>10,
161
- :total_duration=>14.487000000372063,
162
- :min_duration=>0.778000001446344,
163
- :max_duration=>1.985000002605375,
164
- :avg_duration=>1.4487000000372063}},
165
- :total_duration=>24.812000003294088,
166
- :sql_duration=>17.939000004844274}
161
+ :total_duration=>0.94,
162
+ :min_duration=>0.62,
163
+ :max_duration=>1.37,
164
+ :avg_duration=>0.94}},
165
+ :total_duration=>13.35,
166
+ :sql_duration=>11.34}
167
167
 
168
168
  RailsPgExtras.measure_queries { User.limit(10).includes(:team).map(&:team) }
169
169
 
@@ -171,21 +171,36 @@ RailsPgExtras.measure_queries { User.limit(10).includes(:team).map(&:team) }
171
171
  :queries=>
172
172
  {"SELECT \"users\".* FROM \"users\" LIMIT $1"=>
173
173
  {:count=>1,
174
- :total_duration=>3.7079999965499155,
175
- :min_duration=>3.7079999965499155,
176
- :max_duration=>3.7079999965499155,
177
- :avg_duration=>3.7079999965499155},
174
+ :total_duration=>3.43,
175
+ :min_duration=>3.43,
176
+ :max_duration=>3.43,
177
+ :avg_duration=>3.43},
178
178
  "SELECT \"teams\".* FROM \"teams\" WHERE \"teams\".\"id\" IN ($1, $2, $3, $4, $5, $6, $7, $8)"=>
179
179
  {:count=>1,
180
- :total_duration=>2.422000005026348,
181
- :min_duration=>2.422000005026348,
182
- :max_duration=>2.422000005026348,
183
- :avg_duration=>2.422000005026348}},
184
- :total_duration=>9.905999999318738,
185
- :sql_duration=>6.1300000015762635}
180
+ :total_duration=>2.59,
181
+ :min_duration=>2.59,
182
+ :max_duration=>2.59,
183
+ :avg_duration=>2.59}},
184
+ :total_duration=>9.75,
185
+ :sql_duration=>6.02}
186
186
 
187
187
  ```
188
188
 
189
+ Optionally, by including [Marginalia gem](https://github.com/basecamp/marginalia) and configuring it to display query backtraces:
190
+
191
+ `config/development.rb`
192
+
193
+ ```ruby
194
+
195
+ Marginalia::Comment.components = [:line]
196
+
197
+ ```
198
+
199
+ you can add this info to the output:
200
+
201
+ ![Marginalia logs](https://github.com/pawurb/rails-pg-extras/raw/master/marginalia-logs.png)
202
+
203
+
189
204
  ### `table_info`
190
205
 
191
206
  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.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsPgExtras
4
- VERSION = "5.2.1"
4
+ VERSION = "5.2.2"
5
5
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-pg-extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.1
4
+ version: 5.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-pg-extras
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.1
19
+ version: 5.2.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.1
26
+ version: 5.2.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -106,6 +106,7 @@ files:
106
106
  - lib/rails_pg_extras/version.rb
107
107
  - lib/rails_pg_extras/web.rb
108
108
  - lib/rails_pg_extras/web/engine.rb
109
+ - marginalia-logs.png
109
110
  - pg-extras-ui.png
110
111
  - rails-pg-extras-diagnose.png
111
112
  - rails-pg-extras.gemspec