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 +4 -4
- data/README.md +36 -21
- data/lib/rails_pg_extras/version.rb +1 -1
- data/marginalia-logs.png +0 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 831f887d91a8519dc968d3f612eb08059100e99d717db2a8ce6f0c13684d4714
|
4
|
+
data.tar.gz: f8da112789be789c8f1be7c7e11b27c94c5e8166e7096381cdfa726140fb3df4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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=>
|
156
|
-
:min_duration=>
|
157
|
-
:max_duration=>
|
158
|
-
:avg_duration=>
|
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=>
|
162
|
-
:min_duration=>0.
|
163
|
-
:max_duration=>1.
|
164
|
-
:avg_duration=>
|
165
|
-
:total_duration=>
|
166
|
-
:sql_duration=>
|
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.
|
175
|
-
:min_duration=>3.
|
176
|
-
:max_duration=>3.
|
177
|
-
|
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.
|
181
|
-
:min_duration=>2.
|
182
|
-
:max_duration=>2.
|
183
|
-
:avg_duration=>2.
|
184
|
-
:total_duration=>9.
|
185
|
-
:sql_duration=>6.
|
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.
|
data/marginalia-logs.png
ADDED
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.
|
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-
|
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.
|
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.
|
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
|