rails-pg-extras 1.2.1 → 1.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: 712194068d7f8212044ed27c5321dab52ef7a42905842d85f662e36b2924fe72
4
- data.tar.gz: 83dbc962cdc9c2f3e59ab7554f18bfb56945b1b559444638581804f92c55b643
3
+ metadata.gz: 5cf36789c8d7210dd1512d3d7ef8de0d0bcf88ca3d339e1ee5e89daf82264c32
4
+ data.tar.gz: 5054854e791db2e53408c53fd30d11e907b7caed8549fccaecedd98b10469ce4
5
5
  SHA512:
6
- metadata.gz: 17418e862bd124674f0601dba910c136017b915df44cdd3f76c0ba95a796a38347fcf7b46e07718ea40dbc0c39bfef3b329804c595ce4b8a0ea751fb90e547c3
7
- data.tar.gz: 0bf1430a297b058970decec4865abfeb21cef512fb5b7c189d54140627a24871a51f976066e43da499228ddb56380e42dbb5226f7d5435f7218ecd8e95d5ba7d
6
+ metadata.gz: 3fe6766ddb5896202a408ae95e6a4fc91edf42149d15b348c731bfdda153225ae7949cbc6eab2cb266ffa0ebf4daf1eb3d497cb06807b64fe66c0fad28eb17d1
7
+ data.tar.gz: 3c8d26e07807c15df4af9a8fb785bc9cc78fc52f55baae6c46db0911edc2e13a7cdd0b882560ba363c9c89b46a8fb7b48d350ec63bb3b1258fd335fe8816f1ad
data/README.md CHANGED
@@ -4,7 +4,17 @@ Rails port of [Heroku PG Extras](https://github.com/heroku/heroku-pg-extras) wit
4
4
 
5
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.
6
6
 
7
- Not using Rails? Check out the core dependency [pure Ruby version](https://github.com/pawurb/ruby-pg-extras).
7
+ You can check out this blog post for detailed step by step tutorial on how to [optimize PostgreSQL using PG Extras library](https://pawelurbanek.com/postgresql-fix-performance).
8
+
9
+ Alternative versions:
10
+
11
+ - Core dependency - [Ruby](https://github.com/pawurb/ruby-pg-extras)
12
+
13
+ - [NodeJS](https://github.com/pawurb/node-postgres-extras)
14
+
15
+ - [Elixir](https://github.com/pawurb/ecto_psql_extras)
16
+
17
+ - [Python](https://github.com/pawurb/ecto_psql_extras)
8
18
 
9
19
  ## Installation
10
20
 
@@ -14,6 +24,19 @@ In your Gemfile
14
24
  gem "rails-pg-extras"
15
25
  ```
16
26
 
27
+ Some of the queries (e.g., `calls` and `outliers`) require [pg_stat_statements](https://www.postgresql.org/docs/current/pgstatstatements.html) extension enabled.
28
+
29
+ You can check if it is enabled in your database by running:
30
+
31
+ ```ruby
32
+ RailsPGExtras.extensions
33
+ ```
34
+ You should see the similar line in the output:
35
+
36
+ ```bash
37
+ | pg_stat_statements | 1.7 | 1.7 | track execution statistics of all SQL statements executed |
38
+ ```
39
+
17
40
  ## Usage
18
41
 
19
42
  Each command can be used as a rake task, or a directly from the Ruby code.
@@ -398,6 +421,16 @@ RailsPGExtras.kill_all
398
421
 
399
422
  This commands kills all the currently active connections to the database. It can be useful as a last resort when your database is stuck in a deadlock.
400
423
 
424
+ ### `extensions`
425
+
426
+ ```ruby
427
+
428
+ RailsPGExtras.extensions
429
+
430
+ ```
431
+
432
+ This command lists all the currently installed and available PostgreSQL extensions.
433
+
401
434
  ### mandelbrot
402
435
 
403
436
  ```
@@ -405,9 +438,3 @@ $ rake pg_extras:mandelbrot
405
438
  ```
406
439
 
407
440
  This command outputs the Mandelbrot set, calculated through SQL.
408
-
409
- ## FAQ
410
-
411
- * Does is not violate the Heroku PG Extras license?
412
-
413
- The original plugin is MIT based so it means that copying and redistribution in any format is permitted.
@@ -3,9 +3,16 @@
3
3
  require 'rails-pg-extras'
4
4
 
5
5
  namespace :pg_extras do
6
+ desc "Establish connection"
7
+ task :establish_connection do
8
+ db_config_file = File.open('config/database.yml')
9
+ db_config = YAML::load(db_config_file)
10
+ ActiveRecord::Base.establish_connection(db_config[Rails.env])
11
+ end
12
+
6
13
  RailsPGExtras::QUERIES.each do |query_name|
7
14
  desc RubyPGExtras.description_for(query_name: query_name)
8
- task query_name.to_sym => :environment do
15
+ task query_name.to_sym => :establish_connection do
9
16
  RailsPGExtras.public_send(query_name)
10
17
  end
11
18
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RailsPGExtras
2
- VERSION = "1.2.1"
4
+ VERSION = "1.2.2"
3
5
  end
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: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-13 00:00:00.000000000 Z
11
+ date: 2020-10-08 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: 1.2.1
19
+ version: 1.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: 1.2.1
26
+ version: 1.2.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -93,7 +93,7 @@ homepage: http://github.com/pawurb/rails-pg-extras
93
93
  licenses:
94
94
  - MIT
95
95
  metadata: {}
96
- post_install_message:
96
+ post_install_message:
97
97
  rdoc_options: []
98
98
  require_paths:
99
99
  - lib
@@ -108,8 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.0.6
112
- signing_key:
111
+ rubygems_version: 3.1.2
112
+ signing_key:
113
113
  specification_version: 4
114
114
  summary: Rails PostgreSQL performance database insights
115
115
  test_files: