active_record-postgresql_analyzer 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +8 -0
- data/README.md +1 -0
- data/lib/active_record/postgresql_analyzer.rb +4 -2
- data/lib/active_record/postgresql_analyzer/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee6e9a0c0ea12fec81e8ae197746efec6dc45629
|
|
4
|
+
data.tar.gz: 89734ff80f31998cee14c22b6a73917f858c573d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 699c8126954a4998cea8d9f6d680c7334cfa13b0760c576c971e426fa886e596d6f60194b7e9dfae2fb01e10f66cde316f1ad28066ec487dde2468033b96bcb4
|
|
7
|
+
data.tar.gz: 84188c59aa2d5dd8c35f1867ff29264365b22df1afe7cea96a2bab9d2b5decbe592537c01d44d840ef57dcfc1da7574f5336f91be4ddfda90af2207d8766e9ed
|
data/.travis.yml
CHANGED
|
@@ -2,3 +2,11 @@ language: ruby
|
|
|
2
2
|
rvm:
|
|
3
3
|
- 2.1.3
|
|
4
4
|
before_install: gem install bundler -v 1.10.5
|
|
5
|
+
before_script:
|
|
6
|
+
- psql -c 'create database travis_ci_test;' -U postgres
|
|
7
|
+
env:
|
|
8
|
+
- DB_NAME=travis_ci_test DB_USER=postgres
|
|
9
|
+
gemfile:
|
|
10
|
+
- gemfiles/3.2.gemfile
|
|
11
|
+
- gemfiles/4.1.gemfile
|
|
12
|
+
- gemfiles/4.2.gemfile
|
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# ActiveRecord::PostgreSQLAnalyzer
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/active_record-postgresql_analyzer)
|
|
4
|
+
[](https://travis-ci.org/m3dev/active_record-postgresql_analyzer)
|
|
4
5
|
|
|
5
6
|
Analyze the execution plan and write log if sequential scan is detected.
|
|
6
7
|
|
|
@@ -15,11 +15,13 @@ module ActiveRecord
|
|
|
15
15
|
|
|
16
16
|
return if ignore_payload?(payload)
|
|
17
17
|
|
|
18
|
+
connection = ObjectSpace._id2ref(payload[:connection_id])
|
|
19
|
+
|
|
18
20
|
# disable SeqScan when index exists
|
|
19
21
|
# SEE ALSO: http://www.postgresql.org/docs/9.4/static/indexes-examine.html
|
|
20
|
-
|
|
22
|
+
connection.execute("SET enable_seqscan TO off", "SCHEMA")
|
|
21
23
|
|
|
22
|
-
explain_result =
|
|
24
|
+
explain_result = connection.explain(payload[:sql], payload[:binds])
|
|
23
25
|
if seq_scan?(explain_result)
|
|
24
26
|
debug '------------ find Seq Scan query ------------'
|
|
25
27
|
debug payload[:sql]
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_record-postgresql_analyzer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Takayuki Matsubara
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-09-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
123
123
|
version: '0'
|
|
124
124
|
requirements: []
|
|
125
125
|
rubyforge_project:
|
|
126
|
-
rubygems_version: 2.
|
|
126
|
+
rubygems_version: 2.6.13
|
|
127
127
|
signing_key:
|
|
128
128
|
specification_version: 4
|
|
129
129
|
summary: Analyze the execution plan and write log if sequential scan is detected
|