rails-pg-extras 5.2.1 → 5.2.3

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: 4bcee4d55bf01b44d36cb44ddd18e2cb4e1332f279e1d64e24459ba699822b35
4
+ data.tar.gz: 1f11135781de014d57e8f9b2d78a9bebc686e7c4266fdb072d30d0551e1f4ca7
5
5
  SHA512:
6
- metadata.gz: 1a30823d47f9e0cab719b7ee6e750da28c751f4dc20d21756f7f3a633c07dd6390397e09502300cfcf9185184a9e00af83de40f2fd9b12a6319a6ade31ccb26f
7
- data.tar.gz: f01d58920638949122f26a74857cdab232168b274aee2d28d180eed09ea60a48ace036aa3ba772dc8ce41893d6e4a4397255167bc5ccf699a181c7205438ed93
6
+ metadata.gz: 915f068aa1146196e7a7e6e7fd7b53164995aef312d4bb4fce2865ed59328d50ecd398f8f1201a0ae179a8d4e14ee69fce4c9fe1e406c24d54bf1e2f5ee3d656
7
+ data.tar.gz: 626ffcd65d992f73ac75c8da877563d0e618add2259e6fda22a153ef9c671f067ca8bdfa63c7d517df57b77e2a2ffd464c60cadbc4c02ddb9532c6044ca22b0c
data/README.md CHANGED
@@ -10,7 +10,7 @@ You can read this blog post for detailed step by step tutorial on how to [optimi
10
10
 
11
11
  Optionally you can enable a visual interface:
12
12
 
13
- ![Web interface](https://github.com/pawurb/rails-pg-extras/raw/master/pg-extras-ui.png)
13
+ ![Web interface](https://github.com/pawurb/rails-pg-extras/raw/main/pg-extras-ui.png)
14
14
 
15
15
  Alternative versions:
16
16
 
@@ -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"
@@ -113,7 +113,7 @@ RailsPgExtras.diagnose
113
113
  $ rake pg_extras:diagnose
114
114
  ```
115
115
 
116
- ![Diagnose report](https://github.com/pawurb/rails-pg-extras/raw/master/rails-pg-extras-diagnose.png)
116
+ ![Diagnose report](https://github.com/pawurb/rails-pg-extras/raw/main/rails-pg-extras-diagnose.png)
117
117
 
118
118
  Keep reading to learn about methods that `diagnose` uses under the hood.
119
119
 
@@ -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/main/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.3"
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.3
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-06-05 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.3
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.3
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