ruby-pg-extras 4.10.0 → 4.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -10
- data/lib/ruby-pg-extras.rb +3 -2
- data/lib/ruby_pg_extras/queries/connections.sql +1 -2
- data/lib/ruby_pg_extras/queries/kill_pid.sql +6 -0
- data/lib/ruby_pg_extras/version.rb +1 -1
- data/spec/smoke_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 590c13bb6d9fbe7f695f36c0ec57f17b1433cd25553bb76d3ad3ed9504548585
|
4
|
+
data.tar.gz: 3296dfa11f564deb6a7246353e6318d5cb3b739b5e20588ebf40e74b155e5575
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0c223ece061a82885e671164d4ff071f67f4bc6093b8674a9325e62dac3e067b4131178a4ea409844bea3f78e1fceb54d3f10b26d4a59b5d69ccc8a85370418
|
7
|
+
data.tar.gz: ec765d5fe63261619bcb826b089f00d5167fc784f6b496fb528ceccef960f451ac605a89220a9aed1d42c78efa64113517741316319c67a51a4cc514fb2e22e2
|
data/README.md
CHANGED
@@ -591,6 +591,16 @@ RubyPgExtras.kill_all
|
|
591
591
|
|
592
592
|
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.
|
593
593
|
|
594
|
+
### `kill_pid`
|
595
|
+
|
596
|
+
```ruby
|
597
|
+
|
598
|
+
RubyPgExtras.kill_pid(args: { pid: 4657 })
|
599
|
+
|
600
|
+
```
|
601
|
+
|
602
|
+
This commands kills currently active database connection by its `pid` number. You can use `connections` method to find the correct `pid` values.
|
603
|
+
|
594
604
|
### `pg_stat_statements_reset`
|
595
605
|
|
596
606
|
```ruby
|
@@ -625,16 +635,6 @@ RubyPgExtras.extensions
|
|
625
635
|
|
626
636
|
This command lists all the currently installed and available PostgreSQL extensions.
|
627
637
|
|
628
|
-
### `mandelbrot`
|
629
|
-
|
630
|
-
```ruby
|
631
|
-
|
632
|
-
RubyPgExtras.mandelbrot
|
633
|
-
|
634
|
-
```
|
635
|
-
|
636
|
-
This command outputs the Mandelbrot set, calculated through SQL.
|
637
|
-
|
638
638
|
### `connections`
|
639
639
|
|
640
640
|
```ruby
|
@@ -653,6 +653,16 @@ RubyPgExtras.connections
|
|
653
653
|
|
654
654
|
This command returns the list of all active database connections.
|
655
655
|
|
656
|
+
### `mandelbrot`
|
657
|
+
|
658
|
+
```ruby
|
659
|
+
|
660
|
+
RubyPgExtras.mandelbrot
|
661
|
+
|
662
|
+
```
|
663
|
+
|
664
|
+
This command outputs the Mandelbrot set, calculated through SQL.
|
665
|
+
|
656
666
|
## Testing
|
657
667
|
|
658
668
|
```bash
|
data/lib/ruby-pg-extras.rb
CHANGED
@@ -22,7 +22,7 @@ module RubyPgExtras
|
|
22
22
|
long_running_queries mandelbrot outliers
|
23
23
|
records_rank seq_scans table_index_scans table_indexes_size
|
24
24
|
table_size total_index_size total_table_size
|
25
|
-
unused_indexes duplicate_indexes vacuum_stats kill_all
|
25
|
+
unused_indexes duplicate_indexes vacuum_stats kill_all kill_pid
|
26
26
|
pg_stat_statements_reset buffercache_stats
|
27
27
|
buffercache_usage ssl_used connections
|
28
28
|
)
|
@@ -45,7 +45,8 @@ module RubyPgExtras
|
|
45
45
|
seq_scans: { schema: "public" },
|
46
46
|
table_index_scans: { schema: "public" },
|
47
47
|
records_rank: { schema: "public" },
|
48
|
-
tables: { schema: "public" }
|
48
|
+
tables: { schema: "public" },
|
49
|
+
kill_pid: { pid: 0 }
|
49
50
|
})
|
50
51
|
|
51
52
|
QUERIES.each do |query_name|
|
@@ -1,4 +1,3 @@
|
|
1
1
|
/* Returns the list of all active database connections */
|
2
2
|
|
3
|
-
SELECT usename as username, client_addr::text as client_address, application_name FROM pg_stat_activity
|
4
|
-
WHERE datname = current_database();
|
3
|
+
SELECT usename as username, pid, client_addr::text as client_address, application_name FROM pg_stat_activity WHERE datname = current_database();
|
data/spec/smoke_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-pg-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/ruby_pg_extras/queries/index_usage.sql
|
107
107
|
- lib/ruby_pg_extras/queries/indexes.sql
|
108
108
|
- lib/ruby_pg_extras/queries/kill_all.sql
|
109
|
+
- lib/ruby_pg_extras/queries/kill_pid.sql
|
109
110
|
- lib/ruby_pg_extras/queries/locks.sql
|
110
111
|
- lib/ruby_pg_extras/queries/long_running_queries.sql
|
111
112
|
- lib/ruby_pg_extras/queries/mandelbrot.sql
|