pgdexter 0.6.1 → 0.6.3
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/CHANGELOG.md +9 -0
- data/README.md +3 -3
- data/lib/dexter/client.rb +3 -2
- data/lib/dexter/index_creator.rb +7 -2
- data/lib/dexter/indexer.rb +3 -2
- data/lib/dexter/parsers/stderr_log_parser.rb +2 -2
- data/lib/dexter/sources/statement_source.rb +5 -3
- data/lib/dexter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e926f9a4b3e7f95a7e1d95813901d689795efa42edf9690872f3caf04477020
|
|
4
|
+
data.tar.gz: 1039ccc8c6184a5f09899dd8243f3852aae738a8ecc317c8302ea10db66b1d5d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9cb24cb4005250306fee1e6c20003e3a922d72b21bd91bb1d5ea0a00a3fefee46baf51e2d48d58085783993c0a5ce405c589af0140865d87c0e54de353d2baea
|
|
7
|
+
data.tar.gz: adcce320a6c5713ead81f0d18d6d8332f4392854ed9eac086e58e50f3f4af18e4f411a922ce3cbc6d8c2ae3595662e6ed1c7d32d064c25672f55a5b75d2b1a69
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 0.6.3 (2025-10-15)
|
|
2
|
+
|
|
3
|
+
- Added `--non-concurrently` option
|
|
4
|
+
- Added support for multiple `--statement` options
|
|
5
|
+
|
|
6
|
+
## 0.6.2 (2025-07-27)
|
|
7
|
+
|
|
8
|
+
- Fixed error with utility statements
|
|
9
|
+
|
|
1
10
|
## 0.6.1 (2025-06-08)
|
|
2
11
|
|
|
3
12
|
- Fixed error with column types without `btree` support
|
data/README.md
CHANGED
|
@@ -12,8 +12,8 @@ First, install [HypoPG](https://github.com/HypoPG/hypopg) on your database serve
|
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
14
|
cd /tmp
|
|
15
|
-
curl -L https://github.com/HypoPG/hypopg/archive/1.4.
|
|
16
|
-
cd hypopg-1.4.
|
|
15
|
+
curl -L https://github.com/HypoPG/hypopg/archive/1.4.2.tar.gz | tar xz
|
|
16
|
+
cd hypopg-1.4.2
|
|
17
17
|
make
|
|
18
18
|
make install # may need sudo
|
|
19
19
|
```
|
|
@@ -253,7 +253,7 @@ And run it with:
|
|
|
253
253
|
docker run -ti ankane/dexter <connection-options>
|
|
254
254
|
```
|
|
255
255
|
|
|
256
|
-
For databases on the host machine, use `host.docker.internal` as the hostname (on Linux, this requires
|
|
256
|
+
For databases on the host machine, use `host.docker.internal` as the hostname (on Linux, this requires `--add-host=host.docker.internal:host-gateway`).
|
|
257
257
|
|
|
258
258
|
### Homebrew
|
|
259
259
|
|
data/lib/dexter/client.rb
CHANGED
|
@@ -23,7 +23,7 @@ module Dexter
|
|
|
23
23
|
connection.setup(options[:enable_hypopg])
|
|
24
24
|
|
|
25
25
|
source =
|
|
26
|
-
if options[:statement]
|
|
26
|
+
if options[:statement].any?
|
|
27
27
|
# TODO raise error for --interval, --min-calls, --min-time
|
|
28
28
|
StatementSource.new(options[:statement])
|
|
29
29
|
elsif options[:pg_stat_statements]
|
|
@@ -63,7 +63,7 @@ module Dexter
|
|
|
63
63
|
o.boolean "--pg-stat-activity", "use pg_stat_activity", default: false
|
|
64
64
|
o.boolean "--pg-stat-statements", "use pg_stat_statements", default: false, help: false
|
|
65
65
|
o.boolean "--stdin", "use stdin", default: false
|
|
66
|
-
o.
|
|
66
|
+
o.array "-s", "--statement", "process a single statement", delimiter: nil
|
|
67
67
|
o.separator ""
|
|
68
68
|
|
|
69
69
|
o.separator "Connection options:"
|
|
@@ -88,6 +88,7 @@ module Dexter
|
|
|
88
88
|
o.integer "--min-cost", default: 100, help: false
|
|
89
89
|
o.integer "--min-cost-savings-pct", default: 50, help: false
|
|
90
90
|
o.string "--tablespace", "tablespace to create indexes"
|
|
91
|
+
o.boolean "--non-concurrently", "use non-concurrent index creation", default: false
|
|
91
92
|
o.separator ""
|
|
92
93
|
|
|
93
94
|
o.separator "Logging options:"
|
data/lib/dexter/index_creator.rb
CHANGED
|
@@ -2,11 +2,12 @@ module Dexter
|
|
|
2
2
|
class IndexCreator
|
|
3
3
|
include Logging
|
|
4
4
|
|
|
5
|
-
def initialize(connection, indexer, new_indexes, tablespace)
|
|
5
|
+
def initialize(connection, indexer, new_indexes, tablespace, concurrently)
|
|
6
6
|
@connection = connection
|
|
7
7
|
@indexer = indexer
|
|
8
8
|
@new_indexes = new_indexes
|
|
9
9
|
@tablespace = tablespace
|
|
10
|
+
@concurrently = concurrently
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
# 1. create lock
|
|
@@ -17,7 +18,9 @@ module Dexter
|
|
|
17
18
|
with_advisory_lock do
|
|
18
19
|
@new_indexes.each do |index|
|
|
19
20
|
unless index_exists?(index)
|
|
20
|
-
statement = String.new("CREATE INDEX
|
|
21
|
+
statement = String.new("CREATE INDEX")
|
|
22
|
+
statement << " CONCURRENTLY" if @concurrently
|
|
23
|
+
statement << " ON #{@connection.quote_ident(index[:table])} (#{index[:columns].map { |c| @connection.quote_ident(c) }.join(", ")})"
|
|
21
24
|
statement << " TABLESPACE #{@connection.quote_ident(@tablespace)}" if @tablespace
|
|
22
25
|
log "Creating index: #{statement}"
|
|
23
26
|
started_at = monotonic_time
|
|
@@ -26,6 +29,8 @@ module Dexter
|
|
|
26
29
|
log "Index created: #{((monotonic_time - started_at) * 1000).to_i} ms"
|
|
27
30
|
rescue PG::LockNotAvailable
|
|
28
31
|
log "Could not acquire lock: #{index[:table]}"
|
|
32
|
+
rescue PG::FeatureNotSupported => e
|
|
33
|
+
raise Error, e.message
|
|
29
34
|
end
|
|
30
35
|
end
|
|
31
36
|
end
|
data/lib/dexter/indexer.rb
CHANGED
|
@@ -61,7 +61,7 @@ module Dexter
|
|
|
61
61
|
show_debug_info(new_indexes, queries) if @log_level.start_with?("debug")
|
|
62
62
|
|
|
63
63
|
# create new indexes
|
|
64
|
-
IndexCreator.new(@connection, self, new_indexes, @tablespace).perform if @create && new_indexes.any?
|
|
64
|
+
IndexCreator.new(@connection, self, new_indexes, @tablespace, !@options[:non_concurrently]).perform if @create && new_indexes.any?
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
private
|
|
@@ -136,7 +136,8 @@ module Dexter
|
|
|
136
136
|
puts
|
|
137
137
|
end
|
|
138
138
|
begin
|
|
139
|
-
|
|
139
|
+
plan = self.plan(query.statement)
|
|
140
|
+
query.plans << plan if plan && plan["Total Cost"]
|
|
140
141
|
rescue PG::Error, JSON::NestingError => e
|
|
141
142
|
if @log_explain
|
|
142
143
|
log e.message
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Dexter
|
|
2
2
|
class StderrLogParser < LogParser
|
|
3
|
-
|
|
3
|
+
LINE_SEPARATOR = ": ".freeze
|
|
4
4
|
DETAIL_LINE = "DETAIL: ".freeze
|
|
5
5
|
|
|
6
6
|
def perform(collector)
|
|
@@ -11,7 +11,7 @@ module Dexter
|
|
|
11
11
|
if active_line
|
|
12
12
|
if line.include?(DETAIL_LINE)
|
|
13
13
|
add_parameters(active_line, line.chomp.split(DETAIL_LINE)[1])
|
|
14
|
-
elsif line.include?(
|
|
14
|
+
elsif line.include?(LINE_SEPARATOR)
|
|
15
15
|
collector.add(active_line, duration)
|
|
16
16
|
active_line = nil
|
|
17
17
|
else
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
module Dexter
|
|
2
2
|
class StatementSource
|
|
3
|
-
def initialize(
|
|
4
|
-
@
|
|
3
|
+
def initialize(statements)
|
|
4
|
+
@statements = statements
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
def perform(collector)
|
|
8
|
-
|
|
8
|
+
@statements.each do |statement|
|
|
9
|
+
collector.add(statement, 0, 0, true)
|
|
10
|
+
end
|
|
9
11
|
end
|
|
10
12
|
end
|
|
11
13
|
end
|
data/lib/dexter/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pgdexter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
116
|
version: '0'
|
|
117
117
|
requirements: []
|
|
118
|
-
rubygems_version: 3.6.
|
|
118
|
+
rubygems_version: 3.6.9
|
|
119
119
|
specification_version: 4
|
|
120
120
|
summary: The automatic indexer for Postgres
|
|
121
121
|
test_files: []
|