ruby-pg-extras 5.2.5 → 5.3.0
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/.github/workflows/ci.yml +128 -0
- data/README.md +20 -20
- data/lib/ruby_pg_extras/queries/index_size.sql +3 -2
- data/lib/ruby_pg_extras/queries/null_indexes.sql +3 -1
- data/lib/ruby_pg_extras/queries/table_size.sql +2 -1
- data/lib/ruby_pg_extras/version.rb +1 -1
- metadata +3 -3
- data/.circleci/config.yml +0 -71
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4db68e685bfd403720469ba3b28c3f0c8eeac489dd8c2ec030a7cc2b12a45f8c
|
4
|
+
data.tar.gz: 39097e6d101eff027ce4ac09b4c04a89eca69c697c3b9bd270123a2052cf3b26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8fb4fe982ee57b2641625a598488c870b5c45d3ac06a380c98139c8c20cfc27e5d139ce029902fe7ee509fbcbcfb3764c4b12823252ec3e47dbad31a07cb2bb
|
7
|
+
data.tar.gz: a4751fe92639df23050110e6359b8dc1a6d3ec9746893d0c0a248fc007723a24eea146ee82d013347e7a69c5d76ad79f0fe834548eff9c18a9d2dbfed3d95dce
|
@@ -0,0 +1,128 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
ruby-version: ['3.2', '3.1', '3.0', '2.7', '2.6']
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v3
|
18
|
+
- name: Run PostgreSQL 11
|
19
|
+
run: |
|
20
|
+
docker run --env POSTGRES_USER=postgres \
|
21
|
+
--env POSTGRES_DB=ruby-pg-extras-test \
|
22
|
+
--env POSTGRES_PASSWORD=secret \
|
23
|
+
-d -p 5432:5432 postgres:11.18-alpine \
|
24
|
+
postgres -c shared_preload_libraries=pg_stat_statements
|
25
|
+
- name: Run PostgreSQL 12
|
26
|
+
run: |
|
27
|
+
docker run --env POSTGRES_USER=postgres \
|
28
|
+
--env POSTGRES_DB=ruby-pg-extras-test \
|
29
|
+
--env POSTGRES_PASSWORD=secret \
|
30
|
+
-d -p 5433:5432 postgres:12.13-alpine \
|
31
|
+
postgres -c shared_preload_libraries=pg_stat_statements
|
32
|
+
- name: Run PostgreSQL 13
|
33
|
+
run: |
|
34
|
+
docker run --env POSTGRES_USER=postgres \
|
35
|
+
--env POSTGRES_DB=ruby-pg-extras-test \
|
36
|
+
--env POSTGRES_PASSWORD=secret \
|
37
|
+
-d -p 5434:5432 postgres:13.9-alpine \
|
38
|
+
postgres -c shared_preload_libraries=pg_stat_statements
|
39
|
+
- name: Run PostgreSQL 14
|
40
|
+
run: |
|
41
|
+
docker run --env POSTGRES_USER=postgres \
|
42
|
+
--env POSTGRES_DB=ruby-pg-extras-test \
|
43
|
+
--env POSTGRES_PASSWORD=secret \
|
44
|
+
-d -p 5435:5432 postgres:14.6-alpine \
|
45
|
+
postgres -c shared_preload_libraries=pg_stat_statements
|
46
|
+
- name: Run PostgreSQL 15
|
47
|
+
run: |
|
48
|
+
docker run --env POSTGRES_USER=postgres \
|
49
|
+
--env POSTGRES_DB=ruby-pg-extras-test \
|
50
|
+
--env POSTGRES_PASSWORD=secret \
|
51
|
+
-d -p 5436:5432 postgres:15.1-alpine \
|
52
|
+
postgres -c shared_preload_libraries=pg_stat_statements
|
53
|
+
sleep 15
|
54
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
55
|
+
uses: ruby/setup-ruby@v1
|
56
|
+
with:
|
57
|
+
ruby-version: ${{ matrix.ruby-version }}
|
58
|
+
- name: Setup dependencies
|
59
|
+
run: |
|
60
|
+
gem update --system
|
61
|
+
gem install bundler
|
62
|
+
sudo apt-get update --allow-releaseinfo-change
|
63
|
+
sudo apt install postgresql-client
|
64
|
+
sudo apt install libpq-dev
|
65
|
+
bundle config set --local path 'vendor/bundle'
|
66
|
+
bundle install
|
67
|
+
sleep 10
|
68
|
+
- name: Run tests for PG 11
|
69
|
+
env:
|
70
|
+
PG_VERSION: 11
|
71
|
+
POSTGRES_HOST: localhost
|
72
|
+
POSTGRES_USER: postgres
|
73
|
+
POSTGRES_DB: ruby-pg-extras-test
|
74
|
+
POSTGRES_PASSWORD: secret
|
75
|
+
DATABASE_URL: postgresql://postgres:secret@localhost:5432/ruby-pg-extras-test
|
76
|
+
run: |
|
77
|
+
bundle exec rspec spec/
|
78
|
+
- name: Run tests for PG 11
|
79
|
+
env:
|
80
|
+
PG_VERSION: 11
|
81
|
+
POSTGRES_HOST: localhost
|
82
|
+
POSTGRES_USER: postgres
|
83
|
+
POSTGRES_DB: ruby-pg-extras-test
|
84
|
+
POSTGRES_PASSWORD: secret
|
85
|
+
DATABASE_URL: postgresql://postgres:secret@localhost:5432/ruby-pg-extras-test
|
86
|
+
run: |
|
87
|
+
bundle exec rspec spec/
|
88
|
+
- name: Run tests for PG 12
|
89
|
+
env:
|
90
|
+
PG_VERSION: 12
|
91
|
+
POSTGRES_HOST: localhost
|
92
|
+
POSTGRES_USER: postgres
|
93
|
+
POSTGRES_DB: ruby-pg-extras-test
|
94
|
+
POSTGRES_PASSWORD: secret
|
95
|
+
DATABASE_URL: postgresql://postgres:secret@localhost:5433/ruby-pg-extras-test
|
96
|
+
run: |
|
97
|
+
bundle exec rspec spec/
|
98
|
+
- name: Run tests for PG 13
|
99
|
+
env:
|
100
|
+
PG_VERSION: 13
|
101
|
+
POSTGRES_HOST: localhost
|
102
|
+
POSTGRES_USER: postgres
|
103
|
+
POSTGRES_DB: ruby-pg-extras-test
|
104
|
+
POSTGRES_PASSWORD: secret
|
105
|
+
DATABASE_URL: postgresql://postgres:secret@localhost:5434/ruby-pg-extras-test
|
106
|
+
run: |
|
107
|
+
bundle exec rspec spec/
|
108
|
+
- name: Run tests for PG 14
|
109
|
+
env:
|
110
|
+
PG_VERSION: 14
|
111
|
+
POSTGRES_HOST: localhost
|
112
|
+
POSTGRES_USER: postgres
|
113
|
+
POSTGRES_DB: ruby-pg-extras-test
|
114
|
+
POSTGRES_PASSWORD: secret
|
115
|
+
DATABASE_URL: postgresql://postgres:secret@localhost:5435/ruby-pg-extras-test
|
116
|
+
run: |
|
117
|
+
bundle exec rspec spec/
|
118
|
+
- name: Run tests for PG 15
|
119
|
+
env:
|
120
|
+
PG_VERSION: 15
|
121
|
+
POSTGRES_HOST: localhost
|
122
|
+
POSTGRES_USER: postgres
|
123
|
+
POSTGRES_DB: ruby-pg-extras-test
|
124
|
+
POSTGRES_PASSWORD: secret
|
125
|
+
DATABASE_URL: postgresql://postgres:secret@localhost:5436/ruby-pg-extras-test
|
126
|
+
run: |
|
127
|
+
bundle exec rspec spec/
|
128
|
+
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Ruby PG Extras [](https://badge.fury.io/rb/ruby-pg-extras) [](https://badge.fury.io/rb/ruby-pg-extras) [](https://github.com/pawurb/ruby-pg-extras/actions)
|
2
2
|
|
3
3
|
Ruby port of [Heroku PG Extras](https://github.com/heroku/heroku-pg-extras) with several additions and improvements. The goal of this project is to provide powerful insights into the PostgreSQL database for Ruby apps that are not using the Heroku PostgreSQL plugin.
|
4
4
|
|
@@ -362,18 +362,18 @@ This command displays the total size of all indexes on the database, in MB. It i
|
|
362
362
|
|
363
363
|
RubyPgExtras.index_size
|
364
364
|
|
365
|
-
name | size
|
366
|
-
|
367
|
-
idx_activity_attemptable_and_type_lesson_enrollment | 5196 MB
|
368
|
-
index_enrollment_attemptables_by_attempt_and_last_in_group | 4045 MB
|
369
|
-
index_attempts_on_student_id | 2611 MB
|
370
|
-
enrollment_activity_attemptables_pkey | 2513 MB
|
371
|
-
index_attempts_on_student_id_final_attemptable_type | 2466 MB
|
372
|
-
attempts_pkey | 2466 MB
|
373
|
-
index_attempts_on_response_id | 2404 MB
|
374
|
-
index_attempts_on_enrollment_id | 1957 MB
|
375
|
-
index_enrollment_attemptables_by_enrollment_activity_id | 1789 MB
|
376
|
-
enrollment_activities_pkey | 458 MB
|
365
|
+
name | size | schema |
|
366
|
+
---------------------------------------------------------------+-------------------
|
367
|
+
idx_activity_attemptable_and_type_lesson_enrollment | 5196 MB | public |
|
368
|
+
index_enrollment_attemptables_by_attempt_and_last_in_group | 4045 MB | public |
|
369
|
+
index_attempts_on_student_id | 2611 MB | custom |
|
370
|
+
enrollment_activity_attemptables_pkey | 2513 MB | custom |
|
371
|
+
index_attempts_on_student_id_final_attemptable_type | 2466 MB | custom |
|
372
|
+
attempts_pkey | 2466 MB | custom |
|
373
|
+
index_attempts_on_response_id | 2404 MB | public |
|
374
|
+
index_attempts_on_enrollment_id | 1957 MB | public |
|
375
|
+
index_enrollment_attemptables_by_enrollment_activity_id | 1789 MB | public |
|
376
|
+
enrollment_activities_pkey | 458 MB | public |
|
377
377
|
(truncated results for brevity)
|
378
378
|
```
|
379
379
|
|
@@ -385,13 +385,13 @@ This command displays the size of each each index in the database, in MB. It is
|
|
385
385
|
|
386
386
|
RubyPgExtras.table_size
|
387
387
|
|
388
|
-
name | size
|
389
|
-
|
390
|
-
learning_coaches | 196 MB
|
391
|
-
states | 145 MB
|
392
|
-
grade_levels | 111 MB
|
393
|
-
charities_customers | 73 MB
|
394
|
-
charities | 66 MB
|
388
|
+
name | size | schema |
|
389
|
+
---------------------------------------------------------------+-------------------
|
390
|
+
learning_coaches | 196 MB | public |
|
391
|
+
states | 145 MB | public |
|
392
|
+
grade_levels | 111 MB | custom |
|
393
|
+
charities_customers | 73 MB | public |
|
394
|
+
charities | 66 MB | public |
|
395
395
|
(truncated results for brevity)
|
396
396
|
```
|
397
397
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
/* The size of indexes, descending by size */
|
2
2
|
|
3
3
|
SELECT c.relname AS name,
|
4
|
-
pg_size_pretty(sum(c.relpages::bigint*8192)::bigint) AS size
|
4
|
+
pg_size_pretty(sum(c.relpages::bigint*8192)::bigint) AS size,
|
5
|
+
n.nspname as schema
|
5
6
|
FROM pg_class c
|
6
7
|
LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace)
|
7
8
|
WHERE n.nspname NOT IN ('pg_catalog', 'information_schema')
|
8
9
|
AND n.nspname !~ '^pg_toast'
|
9
10
|
AND c.relkind='i'
|
10
|
-
GROUP BY c.relname
|
11
|
+
GROUP BY c.relname, n.nspname
|
11
12
|
ORDER BY sum(c.relpages) DESC;
|
@@ -10,13 +10,15 @@ SELECT
|
|
10
10
|
WHEN 0 THEN ''
|
11
11
|
ELSE to_char(s.null_frac * 100, '999.00%%')
|
12
12
|
END AS null_frac,
|
13
|
-
pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving
|
13
|
+
pg_size_pretty((pg_relation_size(c.oid) * s.null_frac)::bigint) AS expected_saving,
|
14
|
+
n.nspname as schema
|
14
15
|
FROM
|
15
16
|
pg_class c
|
16
17
|
JOIN pg_index i ON i.indexrelid = c.oid
|
17
18
|
JOIN pg_attribute a ON a.attrelid = c.oid
|
18
19
|
JOIN pg_class c_table ON c_table.oid = i.indrelid
|
19
20
|
JOIN pg_indexes ixs ON c.relname = ixs.indexname
|
21
|
+
LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace)
|
20
22
|
LEFT JOIN pg_stats s ON s.tablename = c_table.relname AND a.attname = s.attname
|
21
23
|
WHERE
|
22
24
|
-- Primary key cannot be partial
|
@@ -1,7 +1,8 @@
|
|
1
1
|
/* Size of the tables (excluding indexes), descending by size */
|
2
2
|
|
3
3
|
SELECT c.relname AS name,
|
4
|
-
pg_size_pretty(pg_table_size(c.oid)) AS size
|
4
|
+
pg_size_pretty(pg_table_size(c.oid)) AS size,
|
5
|
+
n.nspname as schema
|
5
6
|
FROM pg_class c
|
6
7
|
LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace)
|
7
8
|
WHERE n.nspname NOT IN ('pg_catalog', 'information_schema')
|
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: 5.
|
4
|
+
version: 5.3.0
|
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-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -75,7 +75,7 @@ executables: []
|
|
75
75
|
extensions: []
|
76
76
|
extra_rdoc_files: []
|
77
77
|
files:
|
78
|
-
- ".
|
78
|
+
- ".github/workflows/ci.yml"
|
79
79
|
- ".gitignore"
|
80
80
|
- Gemfile
|
81
81
|
- LICENSE.txt
|
data/.circleci/config.yml
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
version: 2
|
2
|
-
jobs:
|
3
|
-
test:
|
4
|
-
docker:
|
5
|
-
- image: cimg/ruby:2.7.6
|
6
|
-
environment:
|
7
|
-
DATABASE_URL: postgresql://postgres:secret@localhost:5432/ruby-pg-extras-test
|
8
|
-
- image: cimg/postgres:11.15
|
9
|
-
command: postgres -c shared_preload_libraries=pg_stat_statements
|
10
|
-
name: postgres11
|
11
|
-
environment:
|
12
|
-
POSTGRES_USER: postgres
|
13
|
-
POSTGRES_DB: ruby-pg-extras-test
|
14
|
-
POSTGRES_PASSWORD: secret
|
15
|
-
- image: cimg/postgres:12.10
|
16
|
-
command: postgres -c shared_preload_libraries=pg_stat_statements
|
17
|
-
name: postgres12
|
18
|
-
environment:
|
19
|
-
POSTGRES_USER: postgres
|
20
|
-
POSTGRES_DB: ruby-pg-extras-test
|
21
|
-
POSTGRES_PASSWORD: secret
|
22
|
-
- image: cimg/postgres:13.6
|
23
|
-
command: postgres -c shared_preload_libraries=pg_stat_statements
|
24
|
-
name: postgres13
|
25
|
-
environment:
|
26
|
-
POSTGRES_USER: postgres
|
27
|
-
POSTGRES_DB: ruby-pg-extras-test
|
28
|
-
POSTGRES_PASSWORD: secret
|
29
|
-
- image: cimg/postgres:14.2
|
30
|
-
command: postgres -c shared_preload_libraries=pg_stat_statements
|
31
|
-
name: postgres14
|
32
|
-
environment:
|
33
|
-
POSTGRES_USER: postgres
|
34
|
-
POSTGRES_DB: ruby-pg-extras-test
|
35
|
-
POSTGRES_PASSWORD: secret
|
36
|
-
parallelism: 1
|
37
|
-
steps:
|
38
|
-
- checkout
|
39
|
-
- run: gem update --system
|
40
|
-
- run: gem install bundler
|
41
|
-
- run: sudo apt-get update --allow-releaseinfo-change
|
42
|
-
- run: sudo apt install postgresql-client
|
43
|
-
- run: sudo apt install libpq-dev
|
44
|
-
- run: bundle config set --local path 'vendor/bundle'
|
45
|
-
- run: bundle install
|
46
|
-
- run: dockerize -wait tcp://postgres11:5432 -timeout 1m
|
47
|
-
- run:
|
48
|
-
name: Run specs for PG 11
|
49
|
-
environment:
|
50
|
-
DATABASE_URL: postgresql://postgres:secret@postgres11:5432/ruby-pg-extras-test
|
51
|
-
command: bundle exec rspec spec/
|
52
|
-
- run:
|
53
|
-
name: Run specs for PG 12
|
54
|
-
environment:
|
55
|
-
DATABASE_URL: postgresql://postgres:secret@postgres12:5432/ruby-pg-extras-test
|
56
|
-
command: bundle exec rspec spec/
|
57
|
-
- run:
|
58
|
-
name: Run specs for PG 13
|
59
|
-
environment:
|
60
|
-
DATABASE_URL: postgresql://postgres:secret@postgres13:5432/ruby-pg-extras-test
|
61
|
-
command: bundle exec rspec spec/
|
62
|
-
- run:
|
63
|
-
name: Run specs for PG 14
|
64
|
-
environment:
|
65
|
-
DATABASE_URL: postgresql://postgres:secret@postgres14:5432/ruby-pg-extras-test
|
66
|
-
command: bundle exec rspec spec/
|
67
|
-
workflows:
|
68
|
-
version: 2
|
69
|
-
test:
|
70
|
-
jobs:
|
71
|
-
- test
|