Compare commits
81 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
f813a1ec74 | |
|
|
55b6a3de88 | |
|
|
71b045b3a4 | |
|
|
133432ed92 | |
|
|
ff4c134e2a | |
|
|
e01e159a7d | |
|
|
bcd345a873 | |
|
|
2235e8bf44 | |
|
|
d2c1842fde | |
|
|
b00caafb68 | |
|
|
4aa3751e6a | |
|
|
5f8b716ef6 | |
|
|
aa24b90c66 | |
|
|
4ac02b2443 | |
|
|
7aeb2508d1 | |
|
|
58c9e734d8 | |
|
|
2c2c1f518d | |
|
|
10418688cd | |
|
|
6d58b1e1d7 | |
|
|
0780b675bb | |
|
|
830e06d13d | |
|
|
cd0feaf215 | |
|
|
57529ecfa7 | |
|
|
4a7f1b73e4 | |
|
|
8f7868f73e | |
|
|
bd0546b7c9 | |
|
|
9496937c9f | |
|
|
9dad93b770 | |
|
|
bdd3329298 | |
|
|
874a3b438a | |
|
|
ba02dc1f64 | |
|
|
f5003d3000 | |
|
|
e032dfaa6d | |
|
|
d16d7fe6dd | |
|
|
182bf40c34 | |
|
|
d74e927adb | |
|
|
9ea39fcb52 | |
|
|
f491096189 | |
|
|
642a2e1c7c | |
|
|
1e32b52a3f | |
|
|
2ec31f69ee | |
|
|
d0f1172476 | |
|
|
2cc0b576bd | |
|
|
c204fb0a12 | |
|
|
5e36a66d80 | |
|
|
f88167d569 | |
|
|
db4b6c6e07 | |
|
|
f774d5acbd | |
|
|
f61935cacb | |
|
|
7d3d5afbbc | |
|
|
ce21b22bf2 | |
|
|
c613f071b1 | |
|
|
f334af03a6 | |
|
|
804059ce75 | |
|
|
65d65ccd05 | |
|
|
298a8e08a2 | |
|
|
1f3754f046 | |
|
|
660190b2a0 | |
|
|
9e0a252873 | |
|
|
3653dd6041 | |
|
|
76b0802142 | |
|
|
61662cc58f | |
|
|
f7dc7fb5fe | |
|
|
38f13e893f | |
|
|
9d2f2cd8cc | |
|
|
d0237f8d83 | |
|
|
d116dd47fe | |
|
|
9c72c2e73d | |
|
|
76424b6c64 | |
|
|
f76b1860e3 | |
|
|
a7edd766e3 | |
|
|
24c1c59416 | |
|
|
b860effd97 | |
|
|
64b08e422c | |
|
|
acd559842f | |
|
|
8bbb49e409 | |
|
|
7bddd5a033 | |
|
|
5312f6f8a7 | |
|
|
c305b8a086 | |
|
|
8dcf24a879 | |
|
|
32b1beb6ff |
|
|
@ -1,4 +1,4 @@
|
||||||
# https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
|
# https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
|
||||||
# Order is important; the last matching pattern takes the most precedence.
|
# Order is important; the last matching pattern takes the most precedence.
|
||||||
|
|
||||||
* @artemgavrilov @darkfronza
|
* @artemgavrilov @dutow
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ description: File a bug report
|
||||||
labels: ["bug"]
|
labels: ["bug"]
|
||||||
assignees:
|
assignees:
|
||||||
- artemgavrilov
|
- artemgavrilov
|
||||||
- darkfronza
|
- dutow
|
||||||
|
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ description: Suggest an idea for this project
|
||||||
labels: ["feature"]
|
labels: ["feature"]
|
||||||
assignees:
|
assignees:
|
||||||
- artemgavrilov
|
- artemgavrilov
|
||||||
- darkfronza
|
- dutow
|
||||||
|
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,12 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: src/pg_stat_monitor
|
path: src/pg_stat_monitor
|
||||||
|
|
||||||
- name: Checkout cppcheck sources
|
- name: Checkout cppcheck sources
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
repository: "danmar/cppcheck"
|
repository: "danmar/cppcheck"
|
||||||
ref: "2.13.4"
|
ref: "2.13.4"
|
||||||
|
|
@ -43,13 +43,13 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone postgres repository
|
- name: Clone postgres repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
repository: 'postgres/postgres'
|
repository: 'postgres/postgres'
|
||||||
ref: 'REL_17_STABLE'
|
ref: 'REL_17_STABLE'
|
||||||
|
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'contrib/pg_stat_monitor'
|
path: 'contrib/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -87,9 +87,9 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
|
|
||||||
- name: Check license headers
|
- name: Check license headers
|
||||||
uses: apache/skywalking-eyes/header@5c5b974209f0de5d905f37deb69369068ebfc15c # v0.7.0
|
uses: apache/skywalking-eyes/header@61275cc80d0798a405cb070f7d3a8aaf7cf2c2c1 # v0.8.0
|
||||||
with:
|
with:
|
||||||
token: "" # Prevent comments
|
token: "" # Prevent comments
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone postgres repository
|
- name: Clone postgres repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
repository: 'postgres/postgres'
|
repository: 'postgres/postgres'
|
||||||
ref: 'REL_15_STABLE'
|
ref: 'REL_15_STABLE'
|
||||||
|
|
@ -83,7 +83,7 @@ jobs:
|
||||||
pg_ctl -D /opt/pgsql/data -l logfile start
|
pg_ctl -D /opt/pgsql/data -l logfile start
|
||||||
|
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ jobs:
|
||||||
working-directory: src/pg_stat_monitor
|
working-directory: src/pg_stat_monitor
|
||||||
|
|
||||||
- name: Upload
|
- name: Upload
|
||||||
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
|
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
|
||||||
with:
|
with:
|
||||||
verbose: true
|
verbose: true
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
@ -130,7 +130,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Check out
|
- name: Check out
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
ref: '${{ inputs.version }}'
|
ref: '${{ inputs.version }}'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
name: postgresql-12-pmm-integration
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- '[0-9]+.[0-9]+.[0-9]+*'
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: pg-12-pgsm-pmm-integration-test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 30
|
|
||||||
steps:
|
|
||||||
- name: Clone QA Integration repository
|
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
||||||
with:
|
|
||||||
repository: 'Percona-Lab/qa-integration'
|
|
||||||
ref: 'main'
|
|
||||||
|
|
||||||
# print branch and Repo name
|
|
||||||
- name: Get branch and Repo Name
|
|
||||||
run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor
|
|
||||||
|
|
||||||
- name: "Set TARGET_BRANCH variable for a PR run"
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
run: echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: "Set TARGET_BRANCH variable for a PUSH run"
|
|
||||||
if: github.event_name == 'push'
|
|
||||||
run: echo "TARGET_BRANCH=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Run PMM & PGSM Setup, E2E Tests
|
|
||||||
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=12 --pgstat-monitor-branch=${{ env.TARGET_BRANCH }}
|
|
||||||
|
|
||||||
- name: Get PMM-Agent Logs from the Container
|
|
||||||
if: success() || failure() # run this step even if previous step failed
|
|
||||||
run: docker exec pgsql_pgsm_12 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log
|
|
||||||
|
|
||||||
- name: Upload Tests Artifacts
|
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
|
||||||
if: success() || failure() # run this step even if previous step failed
|
|
||||||
with:
|
|
||||||
name: tests-artifact
|
|
||||||
path: ./pmm-ui-tests/tests/output/
|
|
||||||
if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn`
|
|
||||||
|
|
@ -1,114 +0,0 @@
|
||||||
name: postgresql-12-ppg-package
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- '[0-9]+.[0-9]+.[0-9]+*'
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: pg-12-ppg-package-test
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
timeout-minutes: 30
|
|
||||||
steps:
|
|
||||||
- name: Clone pg_stat_monitor repository
|
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
||||||
with:
|
|
||||||
path: 'src/pg_stat_monitor'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt purge postgresql-client-common postgresql-common \
|
|
||||||
postgresql postgresql*
|
|
||||||
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
|
|
||||||
zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \
|
|
||||||
libipc-run-perl wget
|
|
||||||
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
|
|
||||||
zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \
|
|
||||||
libipc-run-perl wget
|
|
||||||
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
|
|
||||||
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
|
|
||||||
/etc/postgresql
|
|
||||||
sudo rm -f /usr/bin/pg_config
|
|
||||||
sudo /usr/bin/perl -MCPAN -e 'install IPC::Run'
|
|
||||||
sudo /usr/bin/perl -MCPAN -e 'install Text::Trim'
|
|
||||||
|
|
||||||
- name: Install percona-release script
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y update
|
|
||||||
sudo apt-get -y upgrade
|
|
||||||
sudo apt-get install -y wget gnupg2 curl lsb-release
|
|
||||||
sudo wget \
|
|
||||||
https://repo.percona.com/apt/percona-release_latest.generic_all.deb
|
|
||||||
sudo dpkg -i percona-release_latest.generic_all.deb
|
|
||||||
|
|
||||||
- name: Install Percona Distribution Postgresql 12 & Extensions
|
|
||||||
run: |
|
|
||||||
sudo percona-release setup ppg-12
|
|
||||||
sudo apt-get update -y
|
|
||||||
sudo apt-get install -y percona-postgresql-12 \
|
|
||||||
percona-postgresql-contrib percona-postgresql-server-dev-all \
|
|
||||||
percona-pgpool2 libpgpool2 percona-postgresql-12-pgaudit \
|
|
||||||
percona-postgresql-12-pgaudit-dbgsym percona-postgresql-12-repack \
|
|
||||||
percona-postgresql-12-repack-dbgsym percona-pgaudit12-set-user \
|
|
||||||
percona-pgaudit12-set-user-dbgsym percona-postgresql-12-postgis-3 \
|
|
||||||
percona-postgresql-12-postgis-3-scripts \
|
|
||||||
percona-postgresql-postgis-scripts percona-postgresql-postgis \
|
|
||||||
percona-postgis
|
|
||||||
|
|
||||||
- name: Change src owner to postgres
|
|
||||||
run: |
|
|
||||||
sudo chmod o+rx ~
|
|
||||||
sudo chown -R postgres:postgres src
|
|
||||||
|
|
||||||
- name: Build pg_stat_monitor
|
|
||||||
run: |
|
|
||||||
sudo -u postgres bash -c 'make USE_PGXS=1'
|
|
||||||
sudo make USE_PGXS=1 install
|
|
||||||
working-directory: src/pg_stat_monitor
|
|
||||||
|
|
||||||
- name: Start pg_stat_monitor_tests
|
|
||||||
run: |
|
|
||||||
sudo service postgresql stop
|
|
||||||
echo "shared_preload_libraries = 'pg_stat_monitor'" |
|
|
||||||
sudo tee -a /etc/postgresql/12/main/postgresql.conf
|
|
||||||
sudo service postgresql start
|
|
||||||
sudo psql -V
|
|
||||||
export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor
|
|
||||||
echo $PG_TEST_PORT_DIR
|
|
||||||
sudo -E -u postgres bash -c 'make installcheck USE_PGXS=1'
|
|
||||||
working-directory: src/pg_stat_monitor
|
|
||||||
|
|
||||||
- name: Change dir permissions on fail
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: |
|
|
||||||
sudo chmod -R ugo+rwx t
|
|
||||||
sudo chmod -R ugo+rwx tmp_check
|
|
||||||
exit 2 # regenerate error so that we can upload files in next step
|
|
||||||
working-directory: src/pg_stat_monitor
|
|
||||||
|
|
||||||
- name: Upload logs on fail
|
|
||||||
if: ${{ failure() }}
|
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
|
||||||
with:
|
|
||||||
name: Regressions diff and postgresql log
|
|
||||||
path: |
|
|
||||||
src/pg_stat_monitor/regression.diffs
|
|
||||||
src/pg_stat_monitor/regression.out
|
|
||||||
src/pg_stat_monitor/logfile
|
|
||||||
src/pg_stat_monitor/t/results/
|
|
||||||
src/pg_stat_monitor/tmp_check/log/
|
|
||||||
!src/pg_stat_monitor/tmp_check/**/archives/*
|
|
||||||
!src/pg_stat_monitor/tmp_check/**/backup/*
|
|
||||||
!src/pg_stat_monitor/tmp_check/**/pgdata/*
|
|
||||||
!src/pg_stat_monitor/tmp_check/**/archives/
|
|
||||||
!src/pg_stat_monitor/tmp_check/**/backup/
|
|
||||||
!src/pg_stat_monitor/tmp_check/**/pgdata/
|
|
||||||
if-no-files-found: warn
|
|
||||||
retention-days: 3
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone postgres repository
|
- name: Clone postgres repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
repository: 'postgres/postgres'
|
repository: 'postgres/postgres'
|
||||||
ref: 'REL_13_STABLE'
|
ref: 'REL_13_STABLE'
|
||||||
|
|
@ -83,7 +83,7 @@ jobs:
|
||||||
pg_ctl -D /opt/pgsql/data -l logfile start
|
pg_ctl -D /opt/pgsql/data -l logfile start
|
||||||
|
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -117,7 +117,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
@ -140,7 +140,7 @@ jobs:
|
||||||
make installcheck-world
|
make installcheck-world
|
||||||
|
|
||||||
- name: Report on installcheck-world test suites fail
|
- name: Report on installcheck-world test suites fail
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
with:
|
with:
|
||||||
name: Regressions output files of failed testsuite, and pg log
|
name: Regressions output files of failed testsuite, and pg log
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone QA Integration repository
|
- name: Clone QA Integration repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
repository: 'Percona-Lab/qa-integration'
|
repository: 'Percona-Lab/qa-integration'
|
||||||
ref: 'main'
|
ref: 'main'
|
||||||
|
|
@ -42,7 +42,7 @@ jobs:
|
||||||
run: docker exec pgsql_pgsm_13 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log
|
run: docker exec pgsql_pgsm_13 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log
|
||||||
|
|
||||||
- name: Upload Tests Artifacts
|
- name: Upload Tests Artifacts
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
if: success() || failure() # run this step even if previous step failed
|
if: success() || failure() # run this step even if previous step failed
|
||||||
with:
|
with:
|
||||||
name: tests-artifact
|
name: tests-artifact
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone postgres repository
|
- name: Clone postgres repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
repository: 'postgres/postgres'
|
repository: 'postgres/postgres'
|
||||||
ref: 'REL_14_STABLE'
|
ref: 'REL_14_STABLE'
|
||||||
|
|
@ -83,7 +83,7 @@ jobs:
|
||||||
pg_ctl -D /opt/pgsql/data -l logfile start
|
pg_ctl -D /opt/pgsql/data -l logfile start
|
||||||
|
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
@ -140,7 +140,7 @@ jobs:
|
||||||
run: make installcheck-world
|
run: make installcheck-world
|
||||||
|
|
||||||
- name: Report on installcheck-world test suites fail
|
- name: Report on installcheck-world test suites fail
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
with:
|
with:
|
||||||
name: Regressions output files of failed testsuite, and pg log
|
name: Regressions output files of failed testsuite, and pg log
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone QA Integration repository
|
- name: Clone QA Integration repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
repository: 'Percona-Lab/qa-integration'
|
repository: 'Percona-Lab/qa-integration'
|
||||||
ref: 'main'
|
ref: 'main'
|
||||||
|
|
@ -42,7 +42,7 @@ jobs:
|
||||||
run: docker exec pgsql_pgsm_14 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log
|
run: docker exec pgsql_pgsm_14 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log
|
||||||
|
|
||||||
- name: Upload Tests Artifacts
|
- name: Upload Tests Artifacts
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
if: success() || failure() # run this step even if previous step failed
|
if: success() || failure() # run this step even if previous step failed
|
||||||
with:
|
with:
|
||||||
name: tests-artifact
|
name: tests-artifact
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone postgres repository
|
- name: Clone postgres repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
repository: 'postgres/postgres'
|
repository: 'postgres/postgres'
|
||||||
ref: 'REL_15_STABLE'
|
ref: 'REL_15_STABLE'
|
||||||
|
|
@ -83,7 +83,7 @@ jobs:
|
||||||
pg_ctl -D /opt/pgsql/data -l logfile start
|
pg_ctl -D /opt/pgsql/data -l logfile start
|
||||||
|
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
@ -140,7 +140,7 @@ jobs:
|
||||||
run: make installcheck-world
|
run: make installcheck-world
|
||||||
|
|
||||||
- name: Report on installcheck-world test suites fail
|
- name: Report on installcheck-world test suites fail
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
with:
|
with:
|
||||||
name: Regressions output files of failed testsuite, and pg log
|
name: Regressions output files of failed testsuite, and pg log
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone QA Integration repository
|
- name: Clone QA Integration repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
repository: 'Percona-Lab/qa-integration'
|
repository: 'Percona-Lab/qa-integration'
|
||||||
ref: 'main'
|
ref: 'main'
|
||||||
|
|
@ -42,7 +42,7 @@ jobs:
|
||||||
run: docker exec pgsql_pgsm_15 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log
|
run: docker exec pgsql_pgsm_15 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log
|
||||||
|
|
||||||
- name: Upload Tests Artifacts
|
- name: Upload Tests Artifacts
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
if: success() || failure() # run this step even if previous step failed
|
if: success() || failure() # run this step even if previous step failed
|
||||||
with:
|
with:
|
||||||
name: tests-artifact
|
name: tests-artifact
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone postgres repository
|
- name: Clone postgres repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
repository: 'postgres/postgres'
|
repository: 'postgres/postgres'
|
||||||
ref: 'REL_16_STABLE'
|
ref: 'REL_16_STABLE'
|
||||||
|
|
@ -83,7 +83,7 @@ jobs:
|
||||||
pg_ctl -D /opt/pgsql/data -l logfile start
|
pg_ctl -D /opt/pgsql/data -l logfile start
|
||||||
|
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
@ -140,7 +140,7 @@ jobs:
|
||||||
run: make installcheck-world
|
run: make installcheck-world
|
||||||
|
|
||||||
- name: Report on installcheck-world test suites fail
|
- name: Report on installcheck-world test suites fail
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
with:
|
with:
|
||||||
name: Regressions output files of failed testsuite, and pg log
|
name: Regressions output files of failed testsuite, and pg log
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone postgres repository
|
- name: Clone postgres repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
repository: 'postgres/postgres'
|
repository: 'postgres/postgres'
|
||||||
ref: 'REL_17_STABLE'
|
ref: 'REL_17_STABLE'
|
||||||
|
|
@ -83,7 +83,7 @@ jobs:
|
||||||
pg_ctl -D /opt/pgsql/data -l logfile start
|
pg_ctl -D /opt/pgsql/data -l logfile start
|
||||||
|
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
@ -140,7 +140,7 @@ jobs:
|
||||||
run: make installcheck-world
|
run: make installcheck-world
|
||||||
|
|
||||||
- name: Report on installcheck-world test suites fail
|
- name: Report on installcheck-world test suites fail
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
with:
|
with:
|
||||||
name: Regressions output files of failed testsuite, and pg log
|
name: Regressions output files of failed testsuite, and pg log
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
name: postgresql-12-build
|
name: postgresql-18-build
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
|
|
@ -12,28 +12,28 @@ permissions:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: pg-12-build-test
|
name: pg-18-build-test
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone postgres repository
|
- name: Clone postgres repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
repository: 'postgres/postgres'
|
repository: 'postgres/postgres'
|
||||||
ref: 'REL_12_STABLE'
|
ref: 'REL_18_STABLE'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt purge postgresql-client-common postgresql-common \
|
sudo apt purge postgresql-client-common postgresql-common \
|
||||||
postgresql postgresql*
|
postgresql postgresql*
|
||||||
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
|
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
|
||||||
zlib1g-dev libssl-dev libpam0g-dev bison flex \
|
zlib1g-dev libssl-dev libpam0g-dev bison flex \
|
||||||
libipc-run-perl docbook-xsl docbook-xsl libxml2 libxml2-utils \
|
libipc-run-perl -y docbook-xsl docbook-xsl libxml2 libxml2-utils \
|
||||||
libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \
|
libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \
|
||||||
libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \
|
libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-14 \
|
||||||
llvm-11 llvm-11-dev libselinux1-dev python3-dev uuid-dev liblz4-dev
|
llvm-14 llvm-14-dev libselinux1-dev python3-dev \
|
||||||
|
uuid-dev liblz4-dev
|
||||||
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
|
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
|
||||||
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
|
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
|
||||||
/etc/postgresql
|
/etc/postgresql
|
||||||
|
|
@ -48,29 +48,28 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
export PATH="/opt/pgsql/bin:$PATH"
|
export PATH="/opt/pgsql/bin:$PATH"
|
||||||
./configure '--build=x86_64-linux-gnu' '--prefix=/usr' \
|
./configure '--build=x86_64-linux-gnu' '--prefix=/usr' \
|
||||||
'--includedir=/usr/include' '--mandir=/usr/share/man' \
|
'--includedir=${prefix}/include' '--mandir=${prefix}/share/man' \
|
||||||
'--infodir=/usr/share/info' '--sysconfdir=/etc' '--with-gnu-ld' \
|
'--infodir=${prefix}/share/info' '--sysconfdir=/etc' \
|
||||||
'--localstatedir=/var' '--libdir=/usr/lib/x86_64-linux-gnu' \
|
'--localstatedir=/var' '--libdir=${prefix}/lib/x86_64-linux-gnu' \
|
||||||
'runstatedir=/run' '--with-icu' '--with-tcl' '--with-perl' \
|
'--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--with-icu' \
|
||||||
'--with-python' '--with-pam' '--with-openssl' '--with-libxml' \
|
'--with-tcl' '--with-perl' '--with-python' '--with-pam' \
|
||||||
'--with-libxslt' 'PYTHON=/usr/bin/python3' '--enable-tap-tests' \
|
'--with-openssl' '--with-libxml' '--with-libxslt' '--with-ldap' \
|
||||||
'--mandir=/usr/share/postgresql/12/man' '--enable-thread-safety' \
|
'PYTHON=/usr/bin/python3' '--mandir=/usr/share/postgresql/18/man' \
|
||||||
'--docdir=/usr/share/doc/postgresql-doc-12' '--enable-debug' \
|
'--docdir=/usr/share/doc/postgresql-doc-18' '--with-pgport=5432' \
|
||||||
'--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share' \
|
'--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share' \
|
||||||
'--datadir=/usr/share/postgresql/12' '--enable-dtrace' \
|
'--datadir=/usr/share/postgresql/18' '--with-uuid=e2fs' \
|
||||||
'--bindir=/usr/lib/postgresql/12/bin' '--disable-rpath' \
|
'--bindir=/usr/lib/postgresql/18/bin' '--enable-tap-tests' \
|
||||||
'--libdir=/usr/lib/x86_64-linux-gnu' '--with-pgport=5432' \
|
'--libdir=/usr/lib/x86_64-linux-gnu' '--enable-debug' \
|
||||||
'--libexecdir=/usr/lib/postgresql' '--with-uuid=e2fs' \
|
'--libexecdir=/usr/lib/postgresql' '--with-gnu-ld' \
|
||||||
'--includedir=/usr/include/postgresql' 'TAR=/bin/tar' \
|
'--includedir=/usr/include/postgresql' '--enable-dtrace' \
|
||||||
|
'--enable-nls' '--enable-thread-safety' '--disable-rpath' \
|
||||||
'--with-system-tzdata=/usr/share/zoneinfo' '--with-llvm' \
|
'--with-system-tzdata=/usr/share/zoneinfo' '--with-llvm' \
|
||||||
'LLVM_CONFIG=/usr/bin/llvm-config-11' 'CLANG=/usr/bin/clang-11' \
|
'LLVM_CONFIG=/usr/bin/llvm-config-14' 'CLANG=/usr/bin/clang-14' \
|
||||||
'--with-systemd' '--with-selinux' 'MKDIR_P=/bin/mkdir -p' \
|
'--with-systemd' '--with-selinux' 'MKDIR_P=/bin/mkdir -p' \
|
||||||
'PROVE=/usr/bin/prove' '--with-gssapi' '--with-ldap' \
|
'PROVE=/usr/bin/prove' 'TAR=/bin/tar' 'XSLTPROC=xsltproc --nonet' \
|
||||||
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' \
|
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' \
|
||||||
'--with-includes=/usr/include/mit-krb5' '--with-libs=/usr/lib/mit-krb5' \
|
'build_alias=x86_64-linux-gnu' '--with-gssapi' \
|
||||||
'--with-libs=/usr/lib/x86_64-linux-gnu/mit-krb5' \
|
'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' \
|
||||||
'build_alias=x86_64-linux-gnu' \
|
|
||||||
'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' '--enable-nls' \
|
|
||||||
'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' \
|
'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' \
|
||||||
'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security'
|
'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security'
|
||||||
make world
|
make world
|
||||||
|
|
@ -78,13 +77,13 @@ jobs:
|
||||||
|
|
||||||
- name: Start postgresql cluster
|
- name: Start postgresql cluster
|
||||||
run: |
|
run: |
|
||||||
export PATH="/usr/lib/postgresql/12/bin:$PATH"
|
export PATH="/usr/lib/postgresql/18/bin:$PATH"
|
||||||
sudo cp /usr/lib/postgresql/12/bin/pg_config /usr/bin
|
sudo cp /usr/lib/postgresql/18/bin/pg_config /usr/bin
|
||||||
initdb -D /opt/pgsql/data
|
initdb -D /opt/pgsql/data
|
||||||
pg_ctl -D /opt/pgsql/data -l logfile start
|
pg_ctl -D /opt/pgsql/data -l logfile start
|
||||||
|
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -94,19 +93,20 @@ jobs:
|
||||||
sudo make USE_PGXS=1 install
|
sudo make USE_PGXS=1 install
|
||||||
working-directory: src/pg_stat_monitor
|
working-directory: src/pg_stat_monitor
|
||||||
|
|
||||||
- name: Load pg_stat_monitor library and Restart Server
|
- name: Configure and Restart Server
|
||||||
run: |
|
run: |
|
||||||
export PATH="/usr/lib/postgresql/12/bin:$PATH"
|
export PATH="/usr/lib/postgresql/18/bin:$PATH"
|
||||||
pg_ctl -D /opt/pgsql/data -l logfile stop
|
pg_ctl -D /opt/pgsql/data -l logfile stop
|
||||||
echo "shared_preload_libraries = 'pg_stat_monitor'" >> \
|
echo "shared_preload_libraries = 'pg_stat_monitor'" >> \
|
||||||
/opt/pgsql/data/postgresql.conf
|
/opt/pgsql/data/postgresql.conf
|
||||||
|
echo "compute_query_id = regress" >> /opt/pgsql/data/postgresql.conf
|
||||||
pg_ctl -D /opt/pgsql/data -l logfile start
|
pg_ctl -D /opt/pgsql/data -l logfile start
|
||||||
working-directory: src/pg_stat_monitor
|
working-directory: src/pg_stat_monitor
|
||||||
|
|
||||||
- name: Start pg_stat_monitor_tests
|
- name: Start pg_stat_monitor_tests
|
||||||
run: |
|
run: |
|
||||||
make installcheck
|
make installcheck
|
||||||
working-directory: src/pg_stat_monitor
|
working-directory: src/pg_stat_monitor/
|
||||||
|
|
||||||
- name: Change dir permissions on fail
|
- name: Change dir permissions on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
|
|
@ -118,7 +118,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
@ -137,11 +137,10 @@ jobs:
|
||||||
retention-days: 3
|
retention-days: 3
|
||||||
|
|
||||||
- name: Start Server installcheck-world tests
|
- name: Start Server installcheck-world tests
|
||||||
run: |
|
run: make installcheck-world
|
||||||
make installcheck-world
|
|
||||||
|
|
||||||
- name: Report on installcheck-world test suites fail
|
- name: Report on installcheck-world test suites fail
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
with:
|
with:
|
||||||
name: Regressions output files of failed testsuite, and pg log
|
name: Regressions output files of failed testsuite, and pg log
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
name: postgresql-12-pgdg-package
|
name: postgresql-18-pgdg-package
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
|
|
@ -12,13 +12,12 @@ permissions:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: pg-12-pgdg-package-test
|
name: pg-18-pgdg-package-test
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone pg_stat_monitor repository
|
- name: Clone pg_stat_monitor repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
path: 'src/pg_stat_monitor'
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
|
@ -27,9 +26,8 @@ jobs:
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt purge postgresql-client-common postgresql-common \
|
sudo apt purge postgresql-client-common postgresql-common \
|
||||||
postgresql postgresql*
|
postgresql postgresql*
|
||||||
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \
|
sudo apt-get install -y libreadline6-dev systemtap-sdt-dev wget \
|
||||||
zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \
|
zlib1g-dev libssl-dev libpam0g-dev bison flex libipc-run-perl
|
||||||
libipc-run-perl wget -y
|
|
||||||
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
|
sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \
|
||||||
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
|
/usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \
|
||||||
/etc/postgresql
|
/etc/postgresql
|
||||||
|
|
@ -37,15 +35,15 @@ jobs:
|
||||||
sudo /usr/bin/perl -MCPAN -e 'install IPC::Run'
|
sudo /usr/bin/perl -MCPAN -e 'install IPC::Run'
|
||||||
sudo /usr/bin/perl -MCPAN -e 'install Text::Trim'
|
sudo /usr/bin/perl -MCPAN -e 'install Text::Trim'
|
||||||
|
|
||||||
- name: Install PG Distribution Postgresql 12
|
- name: Install PG Distribution Postgresql 18
|
||||||
run: |
|
run: |
|
||||||
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt \
|
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt \
|
||||||
$(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
$(lsb_release -cs)-pgdg main 18" > /etc/apt/sources.list.d/pgdg.list'
|
||||||
sudo wget --quiet -O - \
|
sudo wget --quiet -O - \
|
||||||
https://www.postgresql.org/media/keys/ACCC4CF8.asc |
|
https://www.postgresql.org/media/keys/ACCC4CF8.asc |
|
||||||
sudo apt-key add -
|
sudo apt-key add -
|
||||||
sudo apt-get -y update
|
sudo apt update
|
||||||
sudo apt-get -y install postgresql-12 postgresql-server-dev-12
|
sudo apt -y install postgresql-18 postgresql-server-dev-18
|
||||||
|
|
||||||
- name: Change src owner to postgres
|
- name: Change src owner to postgres
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -61,8 +59,8 @@ jobs:
|
||||||
- name: Start pg_stat_monitor_tests
|
- name: Start pg_stat_monitor_tests
|
||||||
run: |
|
run: |
|
||||||
sudo service postgresql stop
|
sudo service postgresql stop
|
||||||
echo "shared_preload_libraries = 'pg_stat_monitor'" |
|
echo "shared_preload_libraries = 'pg_stat_monitor'" |
|
||||||
sudo tee -a /etc/postgresql/12/main/postgresql.conf
|
sudo tee -a /etc/postgresql/18/main/postgresql.conf
|
||||||
sudo service postgresql start
|
sudo service postgresql start
|
||||||
sudo psql -V
|
sudo psql -V
|
||||||
export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor
|
export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor
|
||||||
|
|
@ -80,7 +78,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload logs on fail
|
- name: Upload logs on fail
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: Regressions diff and postgresql log
|
name: Regressions diff and postgresql log
|
||||||
path: |
|
path: |
|
||||||
|
|
@ -23,19 +23,19 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Run analysis
|
- name: Run analysis
|
||||||
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
|
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
|
||||||
with:
|
with:
|
||||||
results_file: results.sarif
|
results_file: results.sarif
|
||||||
results_format: sarif
|
results_format: sarif
|
||||||
publish_results: true
|
publish_results: true
|
||||||
|
|
||||||
- name: Upload results
|
- name: Upload results
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||||
with:
|
with:
|
||||||
name: SARIF file
|
name: SARIF file
|
||||||
path: results.sarif
|
path: results.sarif
|
||||||
|
|
@ -43,6 +43,6 @@ jobs:
|
||||||
|
|
||||||
# Upload the results to GitHub's code scanning dashboard (optional).
|
# Upload the results to GitHub's code scanning dashboard (optional).
|
||||||
- name: "Upload to code-scanning"
|
- name: "Upload to code-scanning"
|
||||||
uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
|
uses: github/codeql-action/upload-sarif@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4.31.7
|
||||||
with:
|
with:
|
||||||
sarif_file: results.sarif
|
sarif_file: results.sarif
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ header:
|
||||||
.*\.(c|h)
|
.*\.(c|h)
|
||||||
.*
|
.*
|
||||||
|
|
||||||
Portions Copyright © 2018-2024, Percona LLC and/or its affiliates
|
Portions Copyright © 2018-2025, Percona LLC and/or its affiliates
|
||||||
|
|
||||||
Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
|
Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
|
||||||
|
|
||||||
Portions Copyright (c) 1994, The Regents of the University of California
|
Portions Copyright (c) 1994, The Regents of the University of California
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "pg_stat_monitor",
|
"name": "pg_stat_monitor",
|
||||||
"abstract": "PostgreSQL Query Performance Monitoring Tool",
|
"abstract": "PostgreSQL Query Performance Monitoring Tool",
|
||||||
"description": "pg_stat_monitor is a PostgreSQL Query Performance Monitoring tool, based on PostgreSQL's contrib module pg_stat_statements. PostgreSQL’s pg_stat_statements provides the basic statistics, which is sometimes not enough. The major shortcoming in pg_stat_statements is that it accumulates all the queries and their statistics and does not provide aggregated statistics nor histogram information. In this case, a user would need to calculate the aggregates, which is quite an expensive operation.",
|
"description": "pg_stat_monitor is a PostgreSQL Query Performance Monitoring tool, based on PostgreSQL's contrib module pg_stat_statements. PostgreSQL’s pg_stat_statements provides the basic statistics, which is sometimes not enough. The major shortcoming in pg_stat_statements is that it accumulates all the queries and their statistics and does not provide aggregated statistics nor histogram information. In this case, a user would need to calculate the aggregates, which is quite an expensive operation.",
|
||||||
"version": "2.1.0",
|
"version": "2.3.1",
|
||||||
"maintainer": [
|
"maintainer": [
|
||||||
"Artem Gavrilov <artem.gavrilov@percona.com>",
|
"Artem Gavrilov <artem.gavrilov@percona.com>",
|
||||||
"Diego dos Santos Fronza <diego.fronza@percona.com>"
|
"Diego dos Santos Fronza <diego.fronza@percona.com>"
|
||||||
|
|
@ -13,9 +13,9 @@
|
||||||
"provides": {
|
"provides": {
|
||||||
"pg_stat_monitor": {
|
"pg_stat_monitor": {
|
||||||
"abstract": "PostgreSQL Query Performance Monitoring Tool",
|
"abstract": "PostgreSQL Query Performance Monitoring Tool",
|
||||||
"file": "pg_stat_monitor--2.0--2.1.sql",
|
"file": "pg_stat_monitor--2.2--2.3.sql",
|
||||||
"docfile": "README.md",
|
"docfile": "README.md",
|
||||||
"version": "2.1.0"
|
"version": "2.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prereqs": {
|
"prereqs": {
|
||||||
|
|
|
||||||
25
Makefile
25
Makefile
|
|
@ -4,7 +4,7 @@ MODULE_big = pg_stat_monitor
|
||||||
OBJS = hash_query.o guc.o pg_stat_monitor.o $(WIN32RES)
|
OBJS = hash_query.o guc.o pg_stat_monitor.o $(WIN32RES)
|
||||||
|
|
||||||
EXTENSION = pg_stat_monitor
|
EXTENSION = pg_stat_monitor
|
||||||
DATA = pg_stat_monitor--2.0.sql pg_stat_monitor--1.0--2.0.sql pg_stat_monitor--2.0--2.1.sql
|
DATA = pg_stat_monitor--2.0.sql pg_stat_monitor--1.0--2.0.sql pg_stat_monitor--2.0--2.1.sql pg_stat_monitor--2.1--2.2.sql pg_stat_monitor--2.2--2.3.sql
|
||||||
|
|
||||||
PGFILEDESC = "pg_stat_monitor - execution statistics of SQL statements"
|
PGFILEDESC = "pg_stat_monitor - execution statistics of SQL statements"
|
||||||
|
|
||||||
|
|
@ -12,7 +12,28 @@ LDFLAGS_SL += $(filter -lm, $(LIBS))
|
||||||
|
|
||||||
TAP_TESTS = 1
|
TAP_TESTS = 1
|
||||||
REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/pg_stat_monitor/pg_stat_monitor.conf --inputdir=regression
|
REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/pg_stat_monitor/pg_stat_monitor.conf --inputdir=regression
|
||||||
REGRESS = basic version guc pgsm_query_id functions counters relations database error_insert application_name application_name_unique top_query different_parent_queries cmd_type error rows tags user level_tracking
|
REGRESS = basic \
|
||||||
|
version \
|
||||||
|
guc \
|
||||||
|
pgsm_query_id \
|
||||||
|
functions \
|
||||||
|
counters \
|
||||||
|
relations \
|
||||||
|
database \
|
||||||
|
error_insert \
|
||||||
|
application_name \
|
||||||
|
application_name_unique \
|
||||||
|
top_query \
|
||||||
|
different_parent_queries \
|
||||||
|
cmd_type \
|
||||||
|
error \
|
||||||
|
rows \
|
||||||
|
squashing \
|
||||||
|
tags \
|
||||||
|
user \
|
||||||
|
level_tracking \
|
||||||
|
decode_error_level \
|
||||||
|
parallel
|
||||||
|
|
||||||
# Disabled because these tests require "shared_preload_libraries=pg_stat_statements",
|
# Disabled because these tests require "shared_preload_libraries=pg_stat_statements",
|
||||||
# which typical installcheck users do not have (e.g. buildfarm clients).
|
# which typical installcheck users do not have (e.g. buildfarm clients).
|
||||||
|
|
|
||||||
28
README.md
28
README.md
|
|
@ -1,9 +1,9 @@
|
||||||
[](https://github.com/percona/pg_stat_monitor/actions/workflows/postgresql-12-pgdg-package.yml)
|
|
||||||
[](https://github.com/percona/pg_stat_monitor/actions/workflows/postgresql-13-pgdg-package.yml)
|
[](https://github.com/percona/pg_stat_monitor/actions/workflows/postgresql-13-pgdg-package.yml)
|
||||||
[](https://github.com/percona/pg_stat_monitor/actions/workflows/postgresql-14-pgdg-package.yml)
|
[](https://github.com/percona/pg_stat_monitor/actions/workflows/postgresql-14-pgdg-package.yml)
|
||||||
[](https://github.com/percona/pg_stat_monitor/actions/workflows/postgresql-15-pgdg-package.yml)
|
[](https://github.com/percona/pg_stat_monitor/actions/workflows/postgresql-15-pgdg-package.yml)
|
||||||
[](https://github.com/percona/pg_stat_monitor/actions/workflows/postgresql-16-pgdg-package.yml)
|
[](https://github.com/percona/pg_stat_monitor/actions/workflows/postgresql-16-pgdg-package.yml)
|
||||||
[](https://github.com/percona/pg_stat_monitor/actions/workflows/postgresql-17-pgdg-package.yml)
|
[](https://github.com/percona/pg_stat_monitor/actions/workflows/postgresql-17-pgdg-package.yml)
|
||||||
|
[](https://github.com/percona/pg_stat_monitor/actions/workflows/postgresql-18-pgdg-package.yml)
|
||||||
|
|
||||||
[](https://badge.fury.io/pg/pg_stat_monitor)
|
[](https://badge.fury.io/pg/pg_stat_monitor)
|
||||||
[](https://scorecard.dev/viewer/?uri=github.com/percona/pg_stat_monitor)
|
[](https://scorecard.dev/viewer/?uri=github.com/percona/pg_stat_monitor)
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
- [Installing from Percona repositories](#installing-from-percona-repositories)
|
- [Installing from Percona repositories](#installing-from-percona-repositories)
|
||||||
- [Installing from PostgreSQL `yum` repositories](#installing-from-postgresql-yum-repositories)
|
- [Installing from PostgreSQL `yum` repositories](#installing-from-postgresql-yum-repositories)
|
||||||
- [Installing from PGXN](#installing-from-pgxn)
|
- [Installing from PGXN](#installing-from-pgxn)
|
||||||
- [Installing from Trunk](#installing-from-trunk)
|
|
||||||
- [Installing from sources](#building-from-source)
|
- [Installing from sources](#building-from-source)
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Setup](#setup)
|
- [Setup](#setup)
|
||||||
|
|
@ -52,9 +51,9 @@ While `pg_stat_statements` provides ever-increasing metrics, `pg_stat_monitor` a
|
||||||
|
|
||||||
To learn about other features, available in `pg_stat_monitor`, see the [Features](#pg_stat_monitor-features) section and the [User Guide](https://docs.percona.com/pg-stat-monitor/user_guide.html).
|
To learn about other features, available in `pg_stat_monitor`, see the [Features](#pg_stat_monitor-features) section and the [User Guide](https://docs.percona.com/pg-stat-monitor/user_guide.html).
|
||||||
|
|
||||||
`pg_stat_monitor` supports PostgreSQL versions 11 and above. It is compatible with both PostgreSQL provided by PostgreSQL Global Development Group (PGDG) and [Percona Distribution for PostgreSQL](https://www.percona.com/software/postgresql-distribution).
|
`pg_stat_monitor` supports PostgreSQL versions 13 and above. It is compatible with both PostgreSQL provided by PostgreSQL Global Development Group (PGDG) and [Percona Distribution for PostgreSQL](https://www.percona.com/software/postgresql-distribution).
|
||||||
|
|
||||||
The `RPM` (for RHEL and CentOS) and the `DEB` (for Debian and Ubuntu) packages are available from Percona repositories for PostgreSQL versions [12](https://www.percona.com/downloads/postgresql-distribution-12/LATEST/), [13](https://www.percona.com/downloads/postgresql-distribution-13/LATEST/), [14](https://www.percona.com/downloads/postgresql-distribution-14/LATEST/), [15](https://www.percona.com/downloads/postgresql-distribution-15/LATEST/), [16](https://www.percona.com/downloads/postgresql-distribution-16/LATEST/) and [17](https://www.percona.com/downloads/postgresql-distribution-17/LATEST/).
|
The `RPM` (for RHEL and CentOS) and the `DEB` (for Debian and Ubuntu) packages are available from Percona repositories for PostgreSQL versions [13](https://www.percona.com/downloads/postgresql-distribution-13/LATEST/), [14](https://www.percona.com/downloads/postgresql-distribution-14/LATEST/), [15](https://www.percona.com/downloads/postgresql-distribution-15/LATEST/), [16](https://www.percona.com/downloads/postgresql-distribution-16/LATEST/), [17](https://www.percona.com/downloads/postgresql-distribution-17/LATEST/) and [18](https://www.percona.com/downloads/postgresql-distribution-18/LATEST/).
|
||||||
|
|
||||||
The RPM packages are also available in the official PostgreSQL (PGDG) yum repositories.
|
The RPM packages are also available in the official PostgreSQL (PGDG) yum repositories.
|
||||||
|
|
||||||
|
|
@ -64,8 +63,8 @@ The `pg_stat_monitor` should work on the latest version of both [Percona Distrib
|
||||||
|
|
||||||
| **Distribution** | **Version** | **Provider** |
|
| **Distribution** | **Version** | **Provider** |
|
||||||
| ---------------- | --------------- | ------------ |
|
| ---------------- | --------------- | ------------ |
|
||||||
|[Percona Distribution for PostgreSQL](https://www.percona.com/software/postgresql-distribution)| [12](https://www.percona.com/downloads/postgresql-distribution-12/LATEST/), [13](https://www.percona.com/downloads/postgresql-distribution-13/LATEST/), [14](https://www.percona.com/downloads/postgresql-distribution-14/LATEST/), [15](https://www.percona.com/downloads/postgresql-distribution-15/LATEST/), [16](https://www.percona.com/downloads/postgresql-distribution-16/LATEST/) and [17](https://www.percona.com/downloads/postgresql-distribution-17/LATEST/)| Percona|
|
|[Percona Distribution for PostgreSQL](https://www.percona.com/software/postgresql-distribution)| [13](https://www.percona.com/downloads/postgresql-distribution-13/LATEST/), [14](https://www.percona.com/downloads/postgresql-distribution-14/LATEST/), [15](https://www.percona.com/downloads/postgresql-distribution-15/LATEST/), [16](https://www.percona.com/downloads/postgresql-distribution-16/LATEST/), [17](https://www.percona.com/downloads/postgresql-distribution-17/LATEST/) and [18](https://www.percona.com/downloads/postgresql-distribution-18/LATEST/)| Percona|
|
||||||
| PostgreSQL | 12, 13, 14, 15, 16 and 17 | PostgreSQL Global Development Group (PGDG) |
|
| PostgreSQL | 13, 14, 15, 16, 17 and 18 | PostgreSQL Global Development Group (PGDG) |
|
||||||
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
@ -109,7 +108,6 @@ You can install `pg_stat_monitor` from the following sources:
|
||||||
* [Percona repositories](#installing-from-percona-repositories)
|
* [Percona repositories](#installing-from-percona-repositories)
|
||||||
* [PostgreSQL PGDG yum repositories](#installing-from-postgresql-yum-repositories)
|
* [PostgreSQL PGDG yum repositories](#installing-from-postgresql-yum-repositories)
|
||||||
* [PGXN](#installing-from-pgxn)
|
* [PGXN](#installing-from-pgxn)
|
||||||
* [Trunk](#installing-from-trunk)
|
|
||||||
* [source code](#building-from-source)
|
* [source code](#building-from-source)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -159,16 +157,6 @@ Use the following command:
|
||||||
pgxn install pg_stat_monitor
|
pgxn install pg_stat_monitor
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Installing from Trunk
|
|
||||||
|
|
||||||
You can install `pg_stat_monitor` from [Trunk (A PostgreSQL Extensions Registry)](https://pgt.dev/) using the [Trunk CLI](https://github.com/tembo-io/trunk?tab=readme-ov-file#installation).
|
|
||||||
|
|
||||||
Use the following command:
|
|
||||||
|
|
||||||
```
|
|
||||||
trunk install pg_stat_monitor
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
You can find the configuration parameters of the `pg_stat_monitor` extension in the `pg_settings` view. To change the default configuration, specify new values for the desired parameters using the GUC (Grant Unified Configuration) system. To learn more, refer to the [Configuration parameters](https://docs.percona.com/pg-stat-monitor/configuration.html) section of the documentation.
|
You can find the configuration parameters of the `pg_stat_monitor` extension in the `pg_settings` view. To change the default configuration, specify new values for the desired parameters using the GUC (Grant Unified Configuration) system. To learn more, refer to the [Configuration parameters](https://docs.percona.com/pg-stat-monitor/configuration.html) section of the documentation.
|
||||||
|
|
@ -188,7 +176,7 @@ ALTER SYSTEM SET shared_preload_libraries = 'pg_stat_monitor';
|
||||||
|
|
||||||
> **NOTE**: If you’ve added other modules to the `shared_preload_libraries` parameter (for example, `pg_stat_statements`), list all of them separated by commas for the `ALTER SYSTEM` command.
|
> **NOTE**: If you’ve added other modules to the `shared_preload_libraries` parameter (for example, `pg_stat_statements`), list all of them separated by commas for the `ALTER SYSTEM` command.
|
||||||
>
|
>
|
||||||
>:warning: For PostgreSQL 13 and earlier versions,`pg_stat_monitor` **must** follow `pg_stat_statements`. For example, `ALTER SYSTEM SET shared_preload_libraries = 'foo, pg_stat_statements, pg_stat_monitor'`.
|
>:warning: For PostgreSQL 13 `pg_stat_monitor` **must** follow `pg_stat_statements`. For example, `ALTER SYSTEM SET shared_preload_libraries = 'foo, pg_stat_statements, pg_stat_monitor'`.
|
||||||
>
|
>
|
||||||
>In PostgreSQL 14, you can specify `pg_stat_statements` and `pg_stat_monitor` in any order. However, due to the extensions' architecture, if both `pg_stat_statements` and `pg_stat_monitor` are loaded, only the last listed extension captures utility queries, CREATE TABLE, Analyze, etc. The first listed extension captures most common queries like SELECT, UPDATE, INSERT, but does not capture utility queries.
|
>In PostgreSQL 14, you can specify `pg_stat_statements` and `pg_stat_monitor` in any order. However, due to the extensions' architecture, if both `pg_stat_statements` and `pg_stat_monitor` are loaded, only the last listed extension captures utility queries, CREATE TABLE, Analyze, etc. The first listed extension captures most common queries like SELECT, UPDATE, INSERT, but does not capture utility queries.
|
||||||
>
|
>
|
||||||
|
|
@ -335,6 +323,6 @@ This project is licensed under the same open liberal terms and conditions as the
|
||||||
|
|
||||||
### Copyright notice
|
### Copyright notice
|
||||||
|
|
||||||
* Portions Copyright © 2018-2024, Percona LLC and/or its affiliates
|
* Portions Copyright © 2018-2025, Percona LLC and/or its affiliates
|
||||||
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, The Regents of the University of California
|
* Portions Copyright (c) 1994, The Regents of the University of California
|
||||||
|
|
|
||||||
6
guc.c
6
guc.c
|
|
@ -3,9 +3,9 @@
|
||||||
* guc.c
|
* guc.c
|
||||||
* guc variable handling of pg_stat_monitor
|
* guc variable handling of pg_stat_monitor
|
||||||
*
|
*
|
||||||
* Portions Copyright © 2018-2024, Percona LLC and/or its affiliates
|
* Portions Copyright © 2018-2025, Percona LLC and/or its affiliates
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1994, The Regents of the University of California
|
* Portions Copyright (c) 1994, The Regents of the University of California
|
||||||
*
|
*
|
||||||
|
|
@ -275,7 +275,6 @@ init_guc(void)
|
||||||
NULL, /* assign_hook */
|
NULL, /* assign_hook */
|
||||||
NULL /* show_hook */
|
NULL /* show_hook */
|
||||||
);
|
);
|
||||||
#if PG_VERSION_NUM >= 130000
|
|
||||||
DefineCustomBoolVariable("pg_stat_monitor.pgsm_track_planning", /* name */
|
DefineCustomBoolVariable("pg_stat_monitor.pgsm_track_planning", /* name */
|
||||||
"Selects whether planning statistics are tracked.", /* short_desc */
|
"Selects whether planning statistics are tracked.", /* short_desc */
|
||||||
NULL, /* long_desc */
|
NULL, /* long_desc */
|
||||||
|
|
@ -287,7 +286,6 @@ init_guc(void)
|
||||||
NULL, /* assign_hook */
|
NULL, /* assign_hook */
|
||||||
NULL /* show_hook */
|
NULL /* show_hook */
|
||||||
);
|
);
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
* hash_query.c
|
* hash_query.c
|
||||||
* Track statement execution times across a whole database cluster.
|
* Track statement execution times across a whole database cluster.
|
||||||
*
|
*
|
||||||
* Portions Copyright © 2018-2024, Percona LLC and/or its affiliates
|
* Portions Copyright © 2018-2025, Percona LLC and/or its affiliates
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1994, The Regents of the University of California
|
* Portions Copyright (c) 1994, The Regents of the University of California
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ install_data(
|
||||||
'pg_stat_monitor--2.0.sql',
|
'pg_stat_monitor--2.0.sql',
|
||||||
'pg_stat_monitor--1.0--2.0.sql',
|
'pg_stat_monitor--1.0--2.0.sql',
|
||||||
'pg_stat_monitor--2.0--2.1.sql',
|
'pg_stat_monitor--2.0--2.1.sql',
|
||||||
|
'pg_stat_monitor--2.1--2.2.sql',
|
||||||
|
'pg_stat_monitor--2.2--2.3.sql',
|
||||||
kwargs: contrib_data_args,
|
kwargs: contrib_data_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -39,9 +41,11 @@ tests += {
|
||||||
'guc',
|
'guc',
|
||||||
'histogram',
|
'histogram',
|
||||||
'level_tracking'
|
'level_tracking'
|
||||||
|
'parallel',
|
||||||
'pgsqm_query_id',
|
'pgsqm_query_id',
|
||||||
'relations',
|
'relations',
|
||||||
'rows',
|
'rows',
|
||||||
|
'squashing',
|
||||||
'state',
|
'state',
|
||||||
'tags',
|
'tags',
|
||||||
'top_query',
|
'top_query',
|
||||||
|
|
|
||||||
|
|
@ -117,9 +117,13 @@ get_sources(){
|
||||||
echo "Sources will not be downloaded"
|
echo "Sources will not be downloaded"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
IS_RELEASE_BRANCH=$(echo ${VERSION} | grep -c release)
|
||||||
|
if [ ${IS_RELEASE_BRANCH} != 0 ]; then
|
||||||
|
VERSION=$(echo $VERSION | awk -F'-' '{print $2}')
|
||||||
|
fi
|
||||||
PRODUCT=percona-pg-stat-monitor${PG_RELEASE}
|
PRODUCT=percona-pg-stat-monitor${PG_RELEASE}
|
||||||
PRODUCT_FULL=${PRODUCT}-${VERSION}
|
PRODUCT_FULL=${PRODUCT}-${VERSION}
|
||||||
|
|
||||||
echo "PRODUCT=${PRODUCT}" > pg-stat-monitor.properties
|
echo "PRODUCT=${PRODUCT}" > pg-stat-monitor.properties
|
||||||
echo "PRODUCT_FULL=${PRODUCT_FULL}" >> pg-stat-monitor.properties
|
echo "PRODUCT_FULL=${PRODUCT_FULL}" >> pg-stat-monitor.properties
|
||||||
echo "VERSION=${VERSION}" >> pg-stat-monitor.properties
|
echo "VERSION=${VERSION}" >> pg-stat-monitor.properties
|
||||||
|
|
@ -162,7 +166,8 @@ get_sources(){
|
||||||
source pg-stat-monitor.properties
|
source pg-stat-monitor.properties
|
||||||
#
|
#
|
||||||
tar --owner=0 --group=0 --exclude=.* -czf ${PRODUCT_FULL}.tar.gz ${PRODUCT_FULL}
|
tar --owner=0 --group=0 --exclude=.* -czf ${PRODUCT_FULL}.tar.gz ${PRODUCT_FULL}
|
||||||
echo "UPLOAD=UPLOAD/experimental/BUILDS/${PRODUCT}/${PRODUCT_FULL}/${BRANCH}/${REVISION}/${BUILD_ID}" >> pg-stat-monitor.properties
|
DATE_TIMESTAMP=$(date +%F_%H-%M-%S)
|
||||||
|
echo "UPLOAD=UPLOAD/experimental/BUILDS/${PRODUCT}/${PRODUCT_FULL}/${BRANCH}/${REVISION}/${DATE_TIMESTAMP}/${BUILD_ID}" >> pg-stat-monitor.properties
|
||||||
mkdir $WORKDIR/source_tarball
|
mkdir $WORKDIR/source_tarball
|
||||||
mkdir $CURDIR/source_tarball
|
mkdir $CURDIR/source_tarball
|
||||||
cp ${PRODUCT_FULL}.tar.gz $WORKDIR/source_tarball
|
cp ${PRODUCT_FULL}.tar.gz $WORKDIR/source_tarball
|
||||||
|
|
@ -204,19 +209,16 @@ install_deps() {
|
||||||
then
|
then
|
||||||
yum -y install git wget
|
yum -y install git wget
|
||||||
yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm
|
yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm
|
||||||
wget https://raw.githubusercontent.com/percona/percona-repositories/release-1.0-28/scripts/percona-release.sh
|
|
||||||
mv percona-release.sh /usr/bin/percona-release
|
|
||||||
chmod 777 /usr/bin/percona-release
|
|
||||||
percona-release enable ${PPG_REPO_NAME} testing
|
percona-release enable ${PPG_REPO_NAME} testing
|
||||||
|
|
||||||
if [ x"$RHEL" = x8 ];
|
if [ x"$RHEL" = x8 ];
|
||||||
then
|
then
|
||||||
clang_version=$(yum list --showduplicates clang-devel | grep "17.0" | grep clang | awk '{print $2}' | head -n 1)
|
clang_version=$(yum list --showduplicates clang-devel | grep "20.1" | grep clang | awk '{print $2}' | head -n 1)
|
||||||
llvm_version=$(yum list --showduplicates llvm-devel | grep "17.0" | grep llvm | awk '{print $2}' | head -n 1)
|
llvm_version=$(yum list --showduplicates llvm-devel | grep "20.1" | grep llvm | awk '{print $2}' | head -n 1)
|
||||||
yum install -y clang-devel-${clang_version} clang-${clang_version} llvm-devel-${llvm_version}
|
yum install -y clang-devel-${clang_version} clang-${clang_version} llvm-devel-${llvm_version}
|
||||||
dnf module -y disable llvm-toolset
|
dnf module disable -y rust-toolset llvm-toolset
|
||||||
else
|
else
|
||||||
yum install -y clang-devel clang llvm-devel
|
yum install -y clang-devel clang llvm-devel
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PKGLIST="percona-postgresql${PG_RELEASE}-devel"
|
PKGLIST="percona-postgresql${PG_RELEASE}-devel"
|
||||||
|
|
@ -246,32 +248,26 @@ install_deps() {
|
||||||
else
|
else
|
||||||
apt-get update
|
apt-get update
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install lsb-release gnupg git wget curl
|
DEBIAN_FRONTEND=noninteractive apt-get -y install lsb-release gnupg git wget curl
|
||||||
|
export DEBIAN=$(lsb_release -sc)
|
||||||
|
|
||||||
wget https://repo.percona.com/apt/percona-release_latest.generic_all.deb
|
wget https://repo.percona.com/apt/percona-release_latest.generic_all.deb
|
||||||
dpkg -i percona-release_latest.generic_all.deb
|
dpkg -i percona-release_latest.generic_all.deb
|
||||||
rm -f percona-release_latest.generic_all.deb
|
rm -f percona-release_latest.generic_all.deb
|
||||||
percona-release enable ${PPG_REPO_NAME} testing
|
percona-release enable ${PPG_REPO_NAME} testing
|
||||||
|
|
||||||
|
|
||||||
PKGLIST="percona-postgresql-${PG_RELEASE} percona-postgresql-common percona-postgresql-server-dev-all"
|
PKGLIST="percona-postgresql-${PG_RELEASE} percona-postgresql-common percona-postgresql-server-dev-all"
|
||||||
|
|
||||||
# ---- using a community version of postgresql
|
|
||||||
#wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
|
||||||
#echo "deb http://apt.postgresql.org/pub/repos/apt/ ${PG_RELEASE}"-pgdg main | sudo tee /etc/apt/sources.list.d/pgdg.list
|
|
||||||
#PKGLIST="postgresql-${PG_RELEASE} postgresql-common postgresql-server-dev-all"
|
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|
||||||
if [[ "${OS_NAME}" != "focal" ]]; then
|
if [[ "x${DEBIAN}" == "xbullseye" ]]; then
|
||||||
LLVM_EXISTS=$(grep -c "apt.llvm.org" /etc/apt/sources.list)
|
DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common
|
||||||
if [ "${LLVM_EXISTS}" == 0 ]; then
|
wget https://apt.llvm.org/llvm.sh
|
||||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
|
chmod +x llvm.sh
|
||||||
echo "deb http://apt.llvm.org/${OS_NAME}/ llvm-toolchain-${OS_NAME}-7 main" >> /etc/apt/sources.list
|
./llvm.sh 14 bullseye
|
||||||
echo "deb-src http://apt.llvm.org/${OS_NAME}/ llvm-toolchain-${OS_NAME}-7 main" >> /etc/apt/sources.list
|
else
|
||||||
apt-get update
|
wget http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7_7.0.1-12_amd64.deb http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/libllvm7_7.0.1-12_amd64.deb http://mirrors.kernel.org/ubuntu/pool/universe/l/llvm-toolchain-7/llvm-7-runtime_7.0.1-12_amd64.deb
|
||||||
fi
|
apt install ./libllvm7_7.0.1-12_amd64.deb ./llvm-7_7.0.1-12_amd64.deb ./llvm-7-runtime_7.0.1-12_amd64.deb
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PKGLIST+=" debconf debhelper clang devscripts dh-exec git wget libkrb5-dev libssl-dev"
|
PKGLIST+=" debconf debhelper clang devscripts dh-exec git wget libkrb5-dev libssl-dev"
|
||||||
PKGLIST+=" build-essential debconf debhelper devscripts dh-exec git wget libxml-checker-perl"
|
PKGLIST+=" build-essential debconf debhelper devscripts dh-exec git wget libxml-checker-perl"
|
||||||
PKGLIST+=" libxml-libxml-perl libio-socket-ssl-perl libperl-dev libssl-dev libxml2-dev txt2man zlib1g-dev libpq-dev"
|
PKGLIST+=" libxml-libxml-perl libio-socket-ssl-perl libperl-dev libssl-dev libxml2-dev txt2man zlib1g-dev libpq-dev"
|
||||||
|
|
@ -400,6 +396,9 @@ build_rpm(){
|
||||||
fi
|
fi
|
||||||
export LIBPQ_DIR=/usr/pgsql-${PG_RELEASE}/
|
export LIBPQ_DIR=/usr/pgsql-${PG_RELEASE}/
|
||||||
export LIBRARY_PATH=/usr/pgsql-${PG_RELEASE}/lib/:/usr/pgsql-${PG_RELEASE}/include/
|
export LIBRARY_PATH=/usr/pgsql-${PG_RELEASE}/lib/:/usr/pgsql-${PG_RELEASE}/include/
|
||||||
|
if [[ "${RHEL}" -eq 10 ]]; then
|
||||||
|
export QA_RPATHS=0x0002
|
||||||
|
fi
|
||||||
rpmbuild --define "_topdir ${WORKDIR}/rpmbuild" --define "dist .$OS_NAME" --define "version ${VERSION}" --rebuild rpmbuild/SRPMS/$SRC_RPM
|
rpmbuild --define "_topdir ${WORKDIR}/rpmbuild" --define "dist .$OS_NAME" --define "version ${VERSION}" --rebuild rpmbuild/SRPMS/$SRC_RPM
|
||||||
|
|
||||||
return_code=$?
|
return_code=$?
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
/* contrib/pg_stat_monitor/pg_stat_monitor--2.1--2.2.sql */
|
||||||
|
|
||||||
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
||||||
|
\echo Use "ALTER EXTENSION pg_stat_monitor" to load this file. \quit
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION get_cmd_type (cmd_type INTEGER) RETURNS TEXT AS
|
||||||
|
$$
|
||||||
|
SELECT
|
||||||
|
CASE
|
||||||
|
WHEN cmd_type = 0 THEN ''
|
||||||
|
WHEN cmd_type = 1 THEN 'SELECT'
|
||||||
|
WHEN cmd_type = 2 THEN 'UPDATE'
|
||||||
|
WHEN cmd_type = 3 THEN 'INSERT'
|
||||||
|
WHEN cmd_type = 4 THEN 'DELETE'
|
||||||
|
WHEN cmd_type = 5 AND current_setting('server_version_num')::int >= 150000 THEN 'MERGE'
|
||||||
|
WHEN cmd_type = 5 AND current_setting('server_version_num')::int < 150000 THEN 'UTILITY'
|
||||||
|
WHEN cmd_type = 6 AND current_setting('server_version_num')::int >= 150000 THEN 'UTILITY'
|
||||||
|
WHEN cmd_type = 6 AND current_setting('server_version_num')::int < 150000 THEN 'NOTHING'
|
||||||
|
WHEN cmd_type = 7 THEN 'NOTHING'
|
||||||
|
END
|
||||||
|
$$
|
||||||
|
LANGUAGE SQL PARALLEL SAFE;
|
||||||
|
|
||||||
|
-- Create new function that handles error levels across PostgreSQL versions 12-17
|
||||||
|
CREATE OR REPLACE FUNCTION decode_error_level(elevel int)
|
||||||
|
RETURNS text
|
||||||
|
AS $$
|
||||||
|
SELECT CASE
|
||||||
|
WHEN elevel = 0 THEN ''
|
||||||
|
WHEN elevel = 10 THEN 'DEBUG5'
|
||||||
|
WHEN elevel = 11 THEN 'DEBUG4'
|
||||||
|
WHEN elevel = 12 THEN 'DEBUG3'
|
||||||
|
WHEN elevel = 13 THEN 'DEBUG2'
|
||||||
|
WHEN elevel = 14 THEN 'DEBUG1'
|
||||||
|
WHEN elevel = 15 THEN 'LOG'
|
||||||
|
WHEN elevel = 16 THEN 'LOG_SERVER_ONLY'
|
||||||
|
WHEN elevel = 17 THEN 'INFO'
|
||||||
|
WHEN elevel = 18 THEN 'NOTICE'
|
||||||
|
WHEN elevel = 19 THEN 'WARNING'
|
||||||
|
WHEN elevel = 20 AND current_setting('server_version_num')::int < 140000 THEN 'ERROR'
|
||||||
|
WHEN elevel = 20 AND current_setting('server_version_num')::int >= 140000 THEN 'WARNING_CLIENT_ONLY'
|
||||||
|
WHEN elevel = 21 AND current_setting('server_version_num')::int < 140000 THEN 'FATAL'
|
||||||
|
WHEN elevel = 21 AND current_setting('server_version_num')::int >= 140000 THEN 'ERROR'
|
||||||
|
WHEN elevel = 22 AND current_setting('server_version_num')::int < 140000 THEN 'PANIC'
|
||||||
|
WHEN elevel = 22 AND current_setting('server_version_num')::int >= 140000 THEN 'FATAL'
|
||||||
|
WHEN elevel = 23 AND current_setting('server_version_num')::int >= 140000 THEN 'PANIC'
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE SQL PARALLEL SAFE;
|
||||||
|
|
@ -0,0 +1,221 @@
|
||||||
|
/* contrib/pg_stat_monitor/pg_stat_monitor--2.2--2.3.sql */
|
||||||
|
|
||||||
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
||||||
|
\echo Use "ALTER EXTENSION pg_stat_monitor" to load this file. \quit
|
||||||
|
|
||||||
|
DROP FUNCTION pgsm_create_11_view();
|
||||||
|
DROP VIEW pg_stat_monitor;
|
||||||
|
DROP FUNCTION pg_stat_monitor_internal;
|
||||||
|
|
||||||
|
CREATE FUNCTION pg_stat_monitor_internal(
|
||||||
|
IN showtext boolean,
|
||||||
|
OUT bucket int8, -- 0
|
||||||
|
OUT userid oid,
|
||||||
|
OUT username text,
|
||||||
|
OUT dbid oid,
|
||||||
|
OUT datname text,
|
||||||
|
OUT client_ip int8,
|
||||||
|
|
||||||
|
OUT queryid int8, -- 6
|
||||||
|
OUT planid int8,
|
||||||
|
OUT query text,
|
||||||
|
OUT query_plan text,
|
||||||
|
OUT pgsm_query_id int8,
|
||||||
|
OUT top_queryid int8,
|
||||||
|
OUT top_query text,
|
||||||
|
OUT application_name text,
|
||||||
|
|
||||||
|
OUT relations text, -- 14
|
||||||
|
OUT cmd_type int,
|
||||||
|
OUT elevel int,
|
||||||
|
OUT sqlcode TEXT,
|
||||||
|
OUT message text,
|
||||||
|
OUT bucket_start_time timestamptz,
|
||||||
|
|
||||||
|
OUT calls int8, -- 20
|
||||||
|
|
||||||
|
OUT total_exec_time float8, -- 21
|
||||||
|
OUT min_exec_time float8,
|
||||||
|
OUT max_exec_time float8,
|
||||||
|
OUT mean_exec_time float8,
|
||||||
|
OUT stddev_exec_time float8,
|
||||||
|
|
||||||
|
OUT rows int8, -- 26
|
||||||
|
|
||||||
|
OUT plans int8, -- 27
|
||||||
|
|
||||||
|
OUT total_plan_time float8, -- 28
|
||||||
|
OUT min_plan_time float8,
|
||||||
|
OUT max_plan_time float8,
|
||||||
|
OUT mean_plan_time float8,
|
||||||
|
OUT stddev_plan_time float8,
|
||||||
|
|
||||||
|
OUT shared_blks_hit int8, -- 33
|
||||||
|
OUT shared_blks_read int8,
|
||||||
|
OUT shared_blks_dirtied int8,
|
||||||
|
OUT shared_blks_written int8,
|
||||||
|
OUT local_blks_hit int8,
|
||||||
|
OUT local_blks_read int8,
|
||||||
|
OUT local_blks_dirtied int8,
|
||||||
|
OUT local_blks_written int8,
|
||||||
|
OUT temp_blks_read int8,
|
||||||
|
OUT temp_blks_written int8,
|
||||||
|
OUT shared_blk_read_time float8,
|
||||||
|
OUT shared_blk_write_time float8,
|
||||||
|
OUT local_blk_read_time float8,
|
||||||
|
OUT local_blk_write_time float8,
|
||||||
|
OUT temp_blk_read_time float8,
|
||||||
|
OUT temp_blk_write_time float8,
|
||||||
|
|
||||||
|
OUT resp_calls text, -- 49
|
||||||
|
OUT cpu_user_time float8,
|
||||||
|
OUT cpu_sys_time float8,
|
||||||
|
OUT wal_records int8,
|
||||||
|
OUT wal_fpi int8,
|
||||||
|
OUT wal_bytes numeric,
|
||||||
|
OUT wal_buffers_full int8,
|
||||||
|
OUT comments TEXT,
|
||||||
|
|
||||||
|
OUT jit_functions int8, -- 57
|
||||||
|
OUT jit_generation_time float8,
|
||||||
|
OUT jit_inlining_count int8,
|
||||||
|
OUT jit_inlining_time float8,
|
||||||
|
OUT jit_optimization_count int8,
|
||||||
|
OUT jit_optimization_time float8,
|
||||||
|
OUT jit_emission_count int8,
|
||||||
|
OUT jit_emission_time float8,
|
||||||
|
OUT jit_deform_count int8,
|
||||||
|
OUT jit_deform_time float8,
|
||||||
|
|
||||||
|
OUT parallel_workers_to_launch int, -- 67
|
||||||
|
OUT parallel_workers_launched int,
|
||||||
|
|
||||||
|
OUT stats_since timestamp with time zone, -- 69
|
||||||
|
OUT minmax_stats_since timestamp with time zone,
|
||||||
|
|
||||||
|
OUT toplevel BOOLEAN, -- 71
|
||||||
|
OUT bucket_done BOOLEAN
|
||||||
|
)
|
||||||
|
RETURNS SETOF record
|
||||||
|
AS 'MODULE_PATHNAME', 'pg_stat_monitor_2_3'
|
||||||
|
LANGUAGE C STRICT VOLATILE PARALLEL SAFE;
|
||||||
|
|
||||||
|
CREATE FUNCTION pgsm_create_18_view() RETURNS INT AS
|
||||||
|
$$
|
||||||
|
BEGIN
|
||||||
|
CREATE VIEW pg_stat_monitor AS SELECT
|
||||||
|
bucket,
|
||||||
|
bucket_start_time,
|
||||||
|
userid,
|
||||||
|
username,
|
||||||
|
dbid,
|
||||||
|
datname,
|
||||||
|
'0.0.0.0'::inet + client_ip AS client_ip,
|
||||||
|
pgsm_query_id,
|
||||||
|
queryid,
|
||||||
|
toplevel,
|
||||||
|
top_queryid,
|
||||||
|
query,
|
||||||
|
comments,
|
||||||
|
planid,
|
||||||
|
query_plan,
|
||||||
|
top_query,
|
||||||
|
application_name,
|
||||||
|
string_to_array(relations, ',') AS relations,
|
||||||
|
cmd_type,
|
||||||
|
get_cmd_type(cmd_type) AS cmd_type_text,
|
||||||
|
elevel,
|
||||||
|
sqlcode,
|
||||||
|
message,
|
||||||
|
calls,
|
||||||
|
total_exec_time,
|
||||||
|
min_exec_time,
|
||||||
|
max_exec_time,
|
||||||
|
mean_exec_time,
|
||||||
|
stddev_exec_time,
|
||||||
|
rows,
|
||||||
|
shared_blks_hit,
|
||||||
|
shared_blks_read,
|
||||||
|
shared_blks_dirtied,
|
||||||
|
shared_blks_written,
|
||||||
|
local_blks_hit,
|
||||||
|
local_blks_read,
|
||||||
|
local_blks_dirtied,
|
||||||
|
local_blks_written,
|
||||||
|
temp_blks_read,
|
||||||
|
temp_blks_written,
|
||||||
|
shared_blk_read_time,
|
||||||
|
shared_blk_write_time,
|
||||||
|
local_blk_read_time,
|
||||||
|
local_blk_write_time,
|
||||||
|
temp_blk_read_time,
|
||||||
|
temp_blk_write_time,
|
||||||
|
|
||||||
|
(string_to_array(resp_calls, ',')) resp_calls,
|
||||||
|
cpu_user_time,
|
||||||
|
cpu_sys_time,
|
||||||
|
wal_records,
|
||||||
|
wal_fpi,
|
||||||
|
wal_bytes,
|
||||||
|
wal_buffers_full,
|
||||||
|
bucket_done,
|
||||||
|
|
||||||
|
plans,
|
||||||
|
total_plan_time,
|
||||||
|
min_plan_time,
|
||||||
|
max_plan_time,
|
||||||
|
mean_plan_time,
|
||||||
|
stddev_plan_time,
|
||||||
|
|
||||||
|
jit_functions,
|
||||||
|
jit_generation_time,
|
||||||
|
jit_inlining_count,
|
||||||
|
jit_inlining_time,
|
||||||
|
jit_optimization_count,
|
||||||
|
jit_optimization_time,
|
||||||
|
jit_emission_count,
|
||||||
|
jit_emission_time,
|
||||||
|
jit_deform_count,
|
||||||
|
jit_deform_time,
|
||||||
|
|
||||||
|
parallel_workers_to_launch,
|
||||||
|
parallel_workers_launched,
|
||||||
|
|
||||||
|
stats_since,
|
||||||
|
minmax_stats_since
|
||||||
|
|
||||||
|
FROM pg_stat_monitor_internal(TRUE)
|
||||||
|
ORDER BY bucket_start_time;
|
||||||
|
RETURN 0;
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION pgsm_create_view() RETURNS INT AS
|
||||||
|
$$
|
||||||
|
DECLARE ver integer;
|
||||||
|
BEGIN
|
||||||
|
SELECT current_setting('server_version_num') INTO ver;
|
||||||
|
IF (ver >= 180000) THEN
|
||||||
|
return pgsm_create_18_view();
|
||||||
|
END IF;
|
||||||
|
IF (ver >= 170000) THEN
|
||||||
|
return pgsm_create_17_view();
|
||||||
|
END IF;
|
||||||
|
IF (ver >= 150000) THEN
|
||||||
|
return pgsm_create_15_view();
|
||||||
|
END IF;
|
||||||
|
IF (ver >= 140000) THEN
|
||||||
|
return pgsm_create_14_view();
|
||||||
|
END IF;
|
||||||
|
IF (ver >= 130000) THEN
|
||||||
|
return pgsm_create_13_view();
|
||||||
|
END IF;
|
||||||
|
RETURN 0;
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
SELECT pgsm_create_view();
|
||||||
|
REVOKE ALL ON FUNCTION pgsm_create_view FROM PUBLIC;
|
||||||
|
REVOKE ALL ON FUNCTION pgsm_create_18_view FROM PUBLIC;
|
||||||
|
|
||||||
|
GRANT SELECT ON pg_stat_monitor TO PUBLIC;
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,5 @@
|
||||||
# pg_stat_monitor extension
|
# pg_stat_monitor extension
|
||||||
comment = 'The pg_stat_monitor is a PostgreSQL Query Performance Monitoring tool, based on PostgreSQL contrib module pg_stat_statements. pg_stat_monitor provides aggregated statistics, client information, plan details including plan, and histogram information.'
|
comment = 'The pg_stat_monitor is a PostgreSQL Query Performance Monitoring tool, based on PostgreSQL contrib module pg_stat_statements. pg_stat_monitor provides aggregated statistics, client information, plan details including plan, and histogram information.'
|
||||||
default_version = '2.1'
|
default_version = '2.3'
|
||||||
module_pathname = '$libdir/pg_stat_monitor'
|
module_pathname = '$libdir/pg_stat_monitor'
|
||||||
relocatable = true
|
relocatable = true
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
* pg_stat_monitor.h
|
* pg_stat_monitor.h
|
||||||
* Track statement execution times across a whole database cluster.
|
* Track statement execution times across a whole database cluster.
|
||||||
*
|
*
|
||||||
* Portions Copyright © 2018-2024, Percona LLC and/or its affiliates
|
* Portions Copyright © 2018-2025, Percona LLC and/or its affiliates
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1994, The Regents of the University of California
|
* Portions Copyright (c) 1994, The Regents of the University of California
|
||||||
*
|
*
|
||||||
|
|
@ -102,12 +102,7 @@
|
||||||
#define MIN_QUERY_LEN 10
|
#define MIN_QUERY_LEN 10
|
||||||
#define SQLCODE_LEN 20
|
#define SQLCODE_LEN 20
|
||||||
#define TOTAL_RELS_LENGTH (REL_LST * REL_LEN)
|
#define TOTAL_RELS_LENGTH (REL_LST * REL_LEN)
|
||||||
|
|
||||||
#if PG_VERSION_NUM >= 130000
|
|
||||||
#define MAX_SETTINGS 15
|
#define MAX_SETTINGS 15
|
||||||
#else
|
|
||||||
#define MAX_SETTINGS 14
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Update this if need a enum GUC with more options. */
|
/* Update this if need a enum GUC with more options. */
|
||||||
#define MAX_ENUM_OPTIONS 6
|
#define MAX_ENUM_OPTIONS 6
|
||||||
|
|
@ -143,17 +138,6 @@
|
||||||
#define PGSM_HASH_SEQ_STATUS HASH_SEQ_STATUS
|
#define PGSM_HASH_SEQ_STATUS HASH_SEQ_STATUS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if PG_VERSION_NUM < 130000
|
|
||||||
typedef struct WalUsage
|
|
||||||
{
|
|
||||||
long wal_records; /* # of WAL records produced */
|
|
||||||
long wal_fpi; /* # of WAL full page images produced */
|
|
||||||
uint64 wal_bytes; /* size of WAL records produced */
|
|
||||||
} WalUsage;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum pgsmStoreKind
|
typedef enum pgsmStoreKind
|
||||||
{
|
{
|
||||||
PGSM_INVALID = -1,
|
PGSM_INVALID = -1,
|
||||||
|
|
@ -168,10 +152,10 @@ typedef enum pgsmStoreKind
|
||||||
PGSM_EXEC,
|
PGSM_EXEC,
|
||||||
PGSM_STORE,
|
PGSM_STORE,
|
||||||
PGSM_ERROR,
|
PGSM_ERROR,
|
||||||
|
|
||||||
PGSM_NUMKIND /* Must be last value of this enum */
|
|
||||||
} pgsmStoreKind;
|
} pgsmStoreKind;
|
||||||
|
|
||||||
|
#define PGSM_NUMKIND (PGSM_ERROR + 1)
|
||||||
|
|
||||||
/* the assumption of query max nested level */
|
/* the assumption of query max nested level */
|
||||||
#define DEFAULT_MAX_NESTED_LEVEL 10
|
#define DEFAULT_MAX_NESTED_LEVEL 10
|
||||||
|
|
||||||
|
|
@ -200,7 +184,7 @@ typedef struct CallTime
|
||||||
|
|
||||||
typedef struct PlanInfo
|
typedef struct PlanInfo
|
||||||
{
|
{
|
||||||
uint64 planid; /* plan identifier */
|
int64 planid; /* plan identifier */
|
||||||
char plan_text[PLAN_TEXT_LEN]; /* plan text */
|
char plan_text[PLAN_TEXT_LEN]; /* plan text */
|
||||||
size_t plan_len; /* strlen(plan_text) */
|
size_t plan_len; /* strlen(plan_text) */
|
||||||
} PlanInfo;
|
} PlanInfo;
|
||||||
|
|
@ -208,14 +192,14 @@ typedef struct PlanInfo
|
||||||
typedef struct pgsmHashKey
|
typedef struct pgsmHashKey
|
||||||
{
|
{
|
||||||
uint64 bucket_id; /* bucket number */
|
uint64 bucket_id; /* bucket number */
|
||||||
uint64 queryid; /* query identifier */
|
int64 queryid; /* query identifier */
|
||||||
uint64 planid; /* plan identifier */
|
int64 planid; /* plan identifier */
|
||||||
uint64 appid; /* hash of application name */
|
int64 appid; /* hash of application name */
|
||||||
Oid userid; /* user OID */
|
Oid userid; /* user OID */
|
||||||
Oid dbid; /* database OID */
|
Oid dbid; /* database OID */
|
||||||
uint32 ip; /* client ip address */
|
uint32 ip; /* client ip address */
|
||||||
bool toplevel; /* query executed at top level */
|
bool toplevel; /* query executed at top level */
|
||||||
uint64 parentid; /* parent queryid of current query */
|
int64 parentid; /* parent queryId of current query */
|
||||||
} pgsmHashKey;
|
} pgsmHashKey;
|
||||||
|
|
||||||
typedef struct QueryInfo
|
typedef struct QueryInfo
|
||||||
|
|
@ -324,6 +308,7 @@ typedef struct Wal_Usage
|
||||||
int64 wal_records; /* # of WAL records generated */
|
int64 wal_records; /* # of WAL records generated */
|
||||||
int64 wal_fpi; /* # of WAL full page images generated */
|
int64 wal_fpi; /* # of WAL full page images generated */
|
||||||
uint64 wal_bytes; /* total amount of WAL bytes generated */
|
uint64 wal_bytes; /* total amount of WAL bytes generated */
|
||||||
|
int64 wal_buffers_full; /* # of times the WAL buffers became full */
|
||||||
} Wal_Usage;
|
} Wal_Usage;
|
||||||
|
|
||||||
typedef struct Counters
|
typedef struct Counters
|
||||||
|
|
@ -343,6 +328,10 @@ typedef struct Counters
|
||||||
Wal_Usage walusage;
|
Wal_Usage walusage;
|
||||||
int resp_calls[MAX_RESPONSE_BUCKET]; /* execution time's in
|
int resp_calls[MAX_RESPONSE_BUCKET]; /* execution time's in
|
||||||
* msec */
|
* msec */
|
||||||
|
int64 parallel_workers_to_launch; /* # of parallel workers planned
|
||||||
|
* to be launched */
|
||||||
|
int64 parallel_workers_launched; /* # of parallel workers actually
|
||||||
|
* launched */
|
||||||
} Counters;
|
} Counters;
|
||||||
|
|
||||||
/* Some global structure to get the cpu usage, really don't like the idea of global variable */
|
/* Some global structure to get the cpu usage, really don't like the idea of global variable */
|
||||||
|
|
@ -353,7 +342,7 @@ typedef struct Counters
|
||||||
typedef struct pgsmEntry
|
typedef struct pgsmEntry
|
||||||
{
|
{
|
||||||
pgsmHashKey key; /* hash key of entry - MUST BE FIRST */
|
pgsmHashKey key; /* hash key of entry - MUST BE FIRST */
|
||||||
uint64 pgsm_query_id; /* pgsm generate normalized query hash */
|
int64 pgsm_query_id; /* pgsm generate normalized query hash */
|
||||||
char datname[NAMEDATALEN]; /* database name */
|
char datname[NAMEDATALEN]; /* database name */
|
||||||
char username[NAMEDATALEN]; /* user name */
|
char username[NAMEDATALEN]; /* user name */
|
||||||
Counters counters; /* the statistics for this query */
|
Counters counters; /* the statistics for this query */
|
||||||
|
|
|
||||||
|
|
@ -27,16 +27,16 @@ DROP TABLE t2;
|
||||||
SELECT query, cmd_type, cmd_type_text FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
SELECT query, cmd_type, cmd_type_text FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
query | cmd_type | cmd_type_text
|
query | cmd_type | cmd_type_text
|
||||||
--------------------------------+----------+---------------
|
--------------------------------+----------+---------------
|
||||||
CREATE TABLE t1 (a INTEGER) | 0 |
|
CREATE TABLE t1 (a INTEGER) | 5 | UTILITY
|
||||||
CREATE TABLE t2 (b INTEGER) | 0 |
|
CREATE TABLE t2 (b INTEGER) | 5 | UTILITY
|
||||||
DELETE FROM t1 | 4 | DELETE
|
DELETE FROM t1 | 4 | DELETE
|
||||||
DROP TABLE t1 | 0 |
|
DROP TABLE t1 | 5 | UTILITY
|
||||||
DROP TABLE t2 | 0 |
|
DROP TABLE t2 | 5 | UTILITY
|
||||||
INSERT INTO t1 VALUES(1) | 3 | INSERT
|
INSERT INTO t1 VALUES(1) | 3 | INSERT
|
||||||
SELECT a FROM t1 | 1 | SELECT
|
SELECT a FROM t1 | 1 | SELECT
|
||||||
SELECT b FROM t2 FOR UPDATE | 1 | SELECT
|
SELECT b FROM t2 FOR UPDATE | 1 | SELECT
|
||||||
SELECT pg_stat_monitor_reset() | 1 | SELECT
|
SELECT pg_stat_monitor_reset() | 1 | SELECT
|
||||||
TRUNCATE t1 | 0 |
|
TRUNCATE t1 | 5 | UTILITY
|
||||||
UPDATE t1 SET a = 2 | 2 | UPDATE
|
UPDATE t1 SET a = 2 | 2 | UPDATE
|
||||||
(11 rows)
|
(11 rows)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,16 +23,22 @@ SELECT b FROM t2 FOR UPDATE;
|
||||||
|
|
||||||
TRUNCATE t1;
|
TRUNCATE t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
DROP TABLE t2;
|
||||||
SELECT query, cmd_type, cmd_type_text FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
SELECT query, cmd_type, cmd_type_text FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
query | cmd_type | cmd_type_text
|
query | cmd_type | cmd_type_text
|
||||||
--------------------------------+----------+---------------
|
--------------------------------+----------+---------------
|
||||||
|
CREATE TABLE t1 (a INTEGER) | 6 | UTILITY
|
||||||
|
CREATE TABLE t2 (b INTEGER) | 6 | UTILITY
|
||||||
DELETE FROM t1 | 4 | DELETE
|
DELETE FROM t1 | 4 | DELETE
|
||||||
|
DROP TABLE t1 | 6 | UTILITY
|
||||||
|
DROP TABLE t2 | 6 | UTILITY
|
||||||
INSERT INTO t1 VALUES(1) | 3 | INSERT
|
INSERT INTO t1 VALUES(1) | 3 | INSERT
|
||||||
SELECT a FROM t1 | 1 | SELECT
|
SELECT a FROM t1 | 1 | SELECT
|
||||||
SELECT b FROM t2 FOR UPDATE | 1 | SELECT
|
SELECT b FROM t2 FOR UPDATE | 1 | SELECT
|
||||||
SELECT pg_stat_monitor_reset() | 1 | SELECT
|
SELECT pg_stat_monitor_reset() | 1 | SELECT
|
||||||
|
TRUNCATE t1 | 6 | UTILITY
|
||||||
UPDATE t1 SET a = 2 | 2 | UPDATE
|
UPDATE t1 SET a = 2 | 2 | UPDATE
|
||||||
(6 rows)
|
(11 rows)
|
||||||
|
|
||||||
SELECT pg_stat_monitor_reset();
|
SELECT pg_stat_monitor_reset();
|
||||||
pg_stat_monitor_reset
|
pg_stat_monitor_reset
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
CREATE EXTENSION pg_stat_monitor;
|
||||||
|
DO $$
|
||||||
|
DECLARE
|
||||||
|
i integer;
|
||||||
|
BEGIN
|
||||||
|
FOR i IN 10..24 LOOP
|
||||||
|
RAISE NOTICE 'error_code: %, error_level: %', i, decode_error_level(i);
|
||||||
|
END LOOP;
|
||||||
|
END $$;
|
||||||
|
NOTICE: error_code: 10, error_level: DEBUG5
|
||||||
|
NOTICE: error_code: 11, error_level: DEBUG4
|
||||||
|
NOTICE: error_code: 12, error_level: DEBUG3
|
||||||
|
NOTICE: error_code: 13, error_level: DEBUG2
|
||||||
|
NOTICE: error_code: 14, error_level: DEBUG1
|
||||||
|
NOTICE: error_code: 15, error_level: LOG
|
||||||
|
NOTICE: error_code: 16, error_level: LOG_SERVER_ONLY
|
||||||
|
NOTICE: error_code: 17, error_level: INFO
|
||||||
|
NOTICE: error_code: 18, error_level: NOTICE
|
||||||
|
NOTICE: error_code: 19, error_level: WARNING
|
||||||
|
NOTICE: error_code: 20, error_level: WARNING_CLIENT_ONLY
|
||||||
|
NOTICE: error_code: 21, error_level: ERROR
|
||||||
|
NOTICE: error_code: 22, error_level: FATAL
|
||||||
|
NOTICE: error_code: 23, error_level: PANIC
|
||||||
|
NOTICE: error_code: 24, error_level: <NULL>
|
||||||
|
DROP EXTENSION pg_stat_monitor;
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
CREATE EXTENSION pg_stat_monitor;
|
||||||
|
DO $$
|
||||||
|
DECLARE
|
||||||
|
i integer;
|
||||||
|
BEGIN
|
||||||
|
FOR i IN 10..24 LOOP
|
||||||
|
RAISE NOTICE 'error_code: %, error_level: %', i, decode_error_level(i);
|
||||||
|
END LOOP;
|
||||||
|
END $$;
|
||||||
|
NOTICE: error_code: 10, error_level: DEBUG5
|
||||||
|
NOTICE: error_code: 11, error_level: DEBUG4
|
||||||
|
NOTICE: error_code: 12, error_level: DEBUG3
|
||||||
|
NOTICE: error_code: 13, error_level: DEBUG2
|
||||||
|
NOTICE: error_code: 14, error_level: DEBUG1
|
||||||
|
NOTICE: error_code: 15, error_level: LOG
|
||||||
|
NOTICE: error_code: 16, error_level: LOG_SERVER_ONLY
|
||||||
|
NOTICE: error_code: 17, error_level: INFO
|
||||||
|
NOTICE: error_code: 18, error_level: NOTICE
|
||||||
|
NOTICE: error_code: 19, error_level: WARNING
|
||||||
|
NOTICE: error_code: 20, error_level: ERROR
|
||||||
|
NOTICE: error_code: 21, error_level: FATAL
|
||||||
|
NOTICE: error_code: 22, error_level: PANIC
|
||||||
|
NOTICE: error_code: 23, error_level: <NULL>
|
||||||
|
NOTICE: error_code: 24, error_level: <NULL>
|
||||||
|
DROP EXTENSION pg_stat_monitor;
|
||||||
|
|
@ -20,11 +20,11 @@ SELECT routine_schema, routine_name, routine_type, data_type FROM information_sc
|
||||||
public | pg_stat_monitor_internal | FUNCTION | record
|
public | pg_stat_monitor_internal | FUNCTION | record
|
||||||
public | pg_stat_monitor_reset | FUNCTION | void
|
public | pg_stat_monitor_reset | FUNCTION | void
|
||||||
public | pg_stat_monitor_version | FUNCTION | text
|
public | pg_stat_monitor_version | FUNCTION | text
|
||||||
public | pgsm_create_11_view | FUNCTION | integer
|
|
||||||
public | pgsm_create_13_view | FUNCTION | integer
|
public | pgsm_create_13_view | FUNCTION | integer
|
||||||
public | pgsm_create_14_view | FUNCTION | integer
|
public | pgsm_create_14_view | FUNCTION | integer
|
||||||
public | pgsm_create_15_view | FUNCTION | integer
|
public | pgsm_create_15_view | FUNCTION | integer
|
||||||
public | pgsm_create_17_view | FUNCTION | integer
|
public | pgsm_create_17_view | FUNCTION | integer
|
||||||
|
public | pgsm_create_18_view | FUNCTION | integer
|
||||||
public | pgsm_create_view | FUNCTION | integer
|
public | pgsm_create_view | FUNCTION | integer
|
||||||
public | range | FUNCTION | ARRAY
|
public | range | FUNCTION | ARRAY
|
||||||
(14 rows)
|
(14 rows)
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,11 @@ SELECT routine_schema, routine_name, routine_type, data_type FROM information_sc
|
||||||
public | pg_stat_monitor_internal | FUNCTION | record
|
public | pg_stat_monitor_internal | FUNCTION | record
|
||||||
public | pg_stat_monitor_reset | FUNCTION | void
|
public | pg_stat_monitor_reset | FUNCTION | void
|
||||||
public | pg_stat_monitor_version | FUNCTION | text
|
public | pg_stat_monitor_version | FUNCTION | text
|
||||||
public | pgsm_create_11_view | FUNCTION | integer
|
|
||||||
public | pgsm_create_13_view | FUNCTION | integer
|
public | pgsm_create_13_view | FUNCTION | integer
|
||||||
public | pgsm_create_14_view | FUNCTION | integer
|
public | pgsm_create_14_view | FUNCTION | integer
|
||||||
public | pgsm_create_15_view | FUNCTION | integer
|
public | pgsm_create_15_view | FUNCTION | integer
|
||||||
public | pgsm_create_17_view | FUNCTION | integer
|
public | pgsm_create_17_view | FUNCTION | integer
|
||||||
|
public | pgsm_create_18_view | FUNCTION | integer
|
||||||
public | pgsm_create_view | FUNCTION | integer
|
public | pgsm_create_view | FUNCTION | integer
|
||||||
public | range | FUNCTION | ARRAY
|
public | range | FUNCTION | ARRAY
|
||||||
(14 rows)
|
(14 rows)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
--
|
||||||
|
-- Tests for parallel statistics
|
||||||
|
--
|
||||||
|
SELECT setting::integer < 180000 AS skip_test FROM pg_settings where name = 'server_version_num' \gset
|
||||||
|
\if :skip_test
|
||||||
|
\quit
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
--
|
||||||
|
-- Tests for parallel statistics
|
||||||
|
--
|
||||||
|
SELECT setting::integer < 180000 AS skip_test FROM pg_settings where name = 'server_version_num' \gset
|
||||||
|
\if :skip_test
|
||||||
|
\quit
|
||||||
|
\endif
|
||||||
|
CREATE EXTENSION pg_stat_monitor;
|
||||||
|
SET pgsm.track_utility = FALSE;
|
||||||
|
-- encourage use of parallel plans
|
||||||
|
SET parallel_setup_cost = 0;
|
||||||
|
SET parallel_tuple_cost = 0;
|
||||||
|
SET min_parallel_table_scan_size = 0;
|
||||||
|
SET max_parallel_workers_per_gather = 2;
|
||||||
|
CREATE TABLE pgsm_parallel_tab (a int);
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT count(*) FROM pgsm_parallel_tab;
|
||||||
|
count
|
||||||
|
-------
|
||||||
|
0
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT query,
|
||||||
|
parallel_workers_to_launch > 0 AS has_workers_to_launch,
|
||||||
|
parallel_workers_launched > 0 AS has_workers_launched
|
||||||
|
FROM pg_stat_monitor
|
||||||
|
WHERE query ~ 'SELECT count'
|
||||||
|
ORDER BY query COLLATE "C";
|
||||||
|
query | has_workers_to_launch | has_workers_launched
|
||||||
|
----------------------------------------+-----------------------+----------------------
|
||||||
|
SELECT count(*) FROM pgsm_parallel_tab | t | t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
DROP TABLE pgsm_parallel_tab;
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
CREATE EXTENSION pg_stat_monitor;
|
||||||
|
CREATE DATABASE db1;
|
||||||
|
CREATE DATABASE db2;
|
||||||
|
\c db1
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
CREATE TABLE t2 (b int);
|
||||||
|
CREATE FUNCTION add(integer, integer) RETURNS integer
|
||||||
|
AS 'select $1 + $2;'
|
||||||
|
LANGUAGE SQL
|
||||||
|
IMMUTABLE
|
||||||
|
RETURNS NULL ON NULL INPUT;
|
||||||
|
\c db2
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
CREATE TABLE t3 (c int);
|
||||||
|
CREATE FUNCTION add(integer, integer) RETURNS integer
|
||||||
|
AS 'select $1 + $2;'
|
||||||
|
LANGUAGE SQL
|
||||||
|
IMMUTABLE
|
||||||
|
RETURNS NULL ON NULL INPUT;
|
||||||
|
\c contrib_regression
|
||||||
|
SELECT pg_stat_monitor_reset();
|
||||||
|
pg_stat_monitor_reset
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
\c db1
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a
|
||||||
|
---
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT *, ADD(1, 2) FROM t1;
|
||||||
|
a | add
|
||||||
|
---+-----
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM t2;
|
||||||
|
b
|
||||||
|
---
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
-- Check that spaces and comments do not generate a different pgsm_query_id
|
||||||
|
SELECT * FROM t2 --WHATEVER;
|
||||||
|
;
|
||||||
|
b
|
||||||
|
---
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM t2 /* ...
|
||||||
|
...
|
||||||
|
More comments to check for spaces.
|
||||||
|
*/
|
||||||
|
;
|
||||||
|
b
|
||||||
|
---
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
\c db2
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a
|
||||||
|
---
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT *, ADD(1, 2) FROM t1;
|
||||||
|
a | add
|
||||||
|
---+-----
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
set pg_stat_monitor.pgsm_enable_pgsm_query_id = off;
|
||||||
|
SELECT * FROM t3;
|
||||||
|
c
|
||||||
|
---
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
set pg_stat_monitor.pgsm_enable_pgsm_query_id = on;
|
||||||
|
SELECT * FROM t3 where c = 20;
|
||||||
|
c
|
||||||
|
---
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
\c contrib_regression
|
||||||
|
SELECT datname, pgsm_query_id, query, calls FROM pg_stat_monitor ORDER BY pgsm_query_id, query, datname;
|
||||||
|
datname | pgsm_query_id | query | calls
|
||||||
|
--------------------+---------------------+-----------------------------------------------------+-------
|
||||||
|
contrib_regression | 689150021118383254 | SELECT pg_stat_monitor_reset() | 1
|
||||||
|
db1 | 1897482803466821995 | SELECT * FROM t2 | 3
|
||||||
|
db1 | 1988437669671417938 | SELECT * FROM t1 | 1
|
||||||
|
db2 | 1988437669671417938 | SELECT * FROM t1 | 1
|
||||||
|
db2 | 6633979598391393345 | SELECT * FROM t3 where c = 20 | 1
|
||||||
|
db1 | 8140395000078788481 | SELECT *, ADD(1, 2) FROM t1 | 1
|
||||||
|
db2 | 8140395000078788481 | SELECT *, ADD(1, 2) FROM t1 | 1
|
||||||
|
db2 | | SELECT * FROM t3 | 1
|
||||||
|
db2 | | set pg_stat_monitor.pgsm_enable_pgsm_query_id = off | 2
|
||||||
|
(9 rows)
|
||||||
|
|
||||||
|
SELECT pg_stat_monitor_reset();
|
||||||
|
pg_stat_monitor_reset
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
\c db1
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP TABLE t2;
|
||||||
|
DROP FUNCTION ADD;
|
||||||
|
\c db2
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP TABLE t3;
|
||||||
|
DROP FUNCTION ADD;
|
||||||
|
\c contrib_regression
|
||||||
|
DROP DATABASE db1;
|
||||||
|
DROP DATABASE db2;
|
||||||
|
DROP EXTENSION pg_stat_monitor;
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
--
|
||||||
|
-- Const squashing functionality
|
||||||
|
--
|
||||||
|
SELECT setting::integer < 180000 AS skip_test FROM pg_settings where name = 'server_version_num' \gset
|
||||||
|
\if :skip_test
|
||||||
|
\quit
|
||||||
|
|
@ -0,0 +1,792 @@
|
||||||
|
--
|
||||||
|
-- Const squashing functionality
|
||||||
|
--
|
||||||
|
SELECT setting::integer < 180000 AS skip_test FROM pg_settings where name = 'server_version_num' \gset
|
||||||
|
\if :skip_test
|
||||||
|
\quit
|
||||||
|
\endif
|
||||||
|
CREATE EXTENSION pg_stat_monitor;
|
||||||
|
SET pg_stat_monitor.pgsm_normalized_query = TRUE;
|
||||||
|
--
|
||||||
|
-- Simple Lists
|
||||||
|
--
|
||||||
|
CREATE TABLE test_squash (id int, data int);
|
||||||
|
-- single element will not be squashed
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT ARRAY[1];
|
||||||
|
array
|
||||||
|
-------
|
||||||
|
{1}
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash WHERE id IN ($1) | 1
|
||||||
|
SELECT ARRAY[$1] | 1
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
-- more than 1 element in a list will be squashed
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT ARRAY[1, 2, 3];
|
||||||
|
array
|
||||||
|
---------
|
||||||
|
{1,2,3}
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT ARRAY[1, 2, 3, 4];
|
||||||
|
array
|
||||||
|
-----------
|
||||||
|
{1,2,3,4}
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT ARRAY[1, 2, 3, 4, 5];
|
||||||
|
array
|
||||||
|
-------------
|
||||||
|
{1,2,3,4,5}
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash WHERE id IN ($1 /*, ... */) | 3
|
||||||
|
SELECT ARRAY[$1 /*, ... */] | 3
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
-- built-in functions will be squashed
|
||||||
|
-- the IN and ARRAY forms of this statement will have the same queryId
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT WHERE 1 IN (1, int4(1), int4(2), 2);
|
||||||
|
--
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT WHERE 1 = ANY (ARRAY[1, int4(1), int4(2), 2]);
|
||||||
|
--
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------+-------
|
||||||
|
SELECT WHERE $1 IN ($2 /*, ... */) | 2
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
-- This tests are disabled due bug in PGSM, see: https://perconadev.atlassian.net/browse/PG-1936
|
||||||
|
-- -- external parameters will be squashed
|
||||||
|
-- SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
-- SELECT * FROM test_squash WHERE id IN ($1, $2, $3, $4, $5) \bind 1 2 3 4 5
|
||||||
|
-- ;
|
||||||
|
-- SELECT * FROM test_squash WHERE id::text = ANY(ARRAY[$1, $2, $3, $4, $5]) \bind 1 2 3 4 5
|
||||||
|
-- ;
|
||||||
|
-- SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
-- -- prepared statements will also be squashed
|
||||||
|
-- -- the IN and ARRAY forms of this statement will have the same queryId
|
||||||
|
-- SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
-- PREPARE p1(int, int, int, int, int) AS
|
||||||
|
-- SELECT * FROM test_squash WHERE id IN ($1, $2, $3, $4, $5);
|
||||||
|
-- EXECUTE p1(1, 2, 3, 4, 5);
|
||||||
|
-- DEALLOCATE p1;
|
||||||
|
-- PREPARE p1(int, int, int, int, int) AS
|
||||||
|
-- SELECT * FROM test_squash WHERE id = ANY(ARRAY[$1, $2, $3, $4, $5]);
|
||||||
|
-- EXECUTE p1(1, 2, 3, 4, 5);
|
||||||
|
-- DEALLOCATE p1;
|
||||||
|
-- SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
-- More conditions in the query
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9) AND data = 2;
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) AND data = 2;
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) AND data = 2;
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9]) AND data = 2;
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) AND data = 2;
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) AND data = 2;
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
---------------------------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash WHERE id IN ($1 /*, ... */) AND data = $2 | 6
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
-- Multiple squashed intervals
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9)
|
||||||
|
AND data IN (1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||||
|
AND data IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
|
||||||
|
AND data IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9])
|
||||||
|
AND data = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
||||||
|
AND data = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
|
||||||
|
AND data = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash WHERE id IN ($1 /*, ... */)+| 6
|
||||||
|
AND data IN ($2 /*, ... */) |
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- No constants squashing for OpExpr
|
||||||
|
-- The IN and ARRAY forms of this statement will have the same queryId
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN
|
||||||
|
(1 + 1, 2 + 2, 3 + 3, 4 + 4, 5 + 5, 6 + 6, 7 + 7, 8 + 8, 9 + 9);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN
|
||||||
|
(@ '-1', @ '-2', @ '-3', @ '-4', @ '-5', @ '-6', @ '-7', @ '-8', @ '-9');
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY(ARRAY
|
||||||
|
[1 + 1, 2 + 2, 3 + 3, 4 + 4, 5 + 5, 6 + 6, 7 + 7, 8 + 8, 9 + 9]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY(ARRAY
|
||||||
|
[@ '-1', @ '-2', @ '-3', @ '-4', @ '-5', @ '-6', @ '-7', @ '-8', @ '-9']);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
----------------------------------------------------------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash WHERE id IN +| 2
|
||||||
|
($1 + $2, $3 + $4, $5 + $6, $7 + $8, $9 + $10, $11 + $12, $13 + $14, $15 + $16, $17 + $18) |
|
||||||
|
SELECT * FROM test_squash WHERE id IN +| 2
|
||||||
|
(@ $1, @ $2, @ $3, @ $4, @ $5, @ $6, @ $7, @ $8, @ $9) |
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- FuncExpr
|
||||||
|
--
|
||||||
|
-- Verify multiple type representation end up with the same query_id
|
||||||
|
CREATE TABLE test_float (data float);
|
||||||
|
-- The casted ARRAY expressions will have the same queryId as the IN clause
|
||||||
|
-- form of the query
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT data FROM test_float WHERE data IN (1, 2);
|
||||||
|
data
|
||||||
|
------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT data FROM test_float WHERE data IN (1, '2');
|
||||||
|
data
|
||||||
|
------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT data FROM test_float WHERE data IN ('1', 2);
|
||||||
|
data
|
||||||
|
------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT data FROM test_float WHERE data IN ('1', '2');
|
||||||
|
data
|
||||||
|
------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT data FROM test_float WHERE data IN (1.0, 1.0);
|
||||||
|
data
|
||||||
|
------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT data FROM test_float WHERE data = ANY(ARRAY['1'::double precision, '2'::double precision]);
|
||||||
|
data
|
||||||
|
------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT data FROM test_float WHERE data = ANY(ARRAY[1.0::double precision, 1.0::double precision]);
|
||||||
|
data
|
||||||
|
------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT data FROM test_float WHERE data = ANY(ARRAY[1, 2]);
|
||||||
|
data
|
||||||
|
------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT data FROM test_float WHERE data = ANY(ARRAY[1, '2']);
|
||||||
|
data
|
||||||
|
------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT data FROM test_float WHERE data = ANY(ARRAY['1', 2]);
|
||||||
|
data
|
||||||
|
------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
--------------------------------------------------------------------+-------
|
||||||
|
SELECT data FROM test_float WHERE data = ANY(ARRAY[$1 /*, ... */]) | 3
|
||||||
|
SELECT data FROM test_float WHERE data IN ($1 /*, ... */) | 7
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
-- Numeric type, implicit cast is squashed
|
||||||
|
CREATE TABLE test_squash_numeric (id int, data numeric(5, 2));
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_numeric WHERE data IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_numeric WHERE data = ANY(ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
--------------------------------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash_numeric WHERE data = ANY(ARRAY[$1 /*, ... */]) | 1
|
||||||
|
SELECT * FROM test_squash_numeric WHERE data IN ($1 /*, ... */) | 1
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
-- Bigint, implicit cast is squashed
|
||||||
|
CREATE TABLE test_squash_bigint (id int, data bigint);
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_bigint WHERE data IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_bigint WHERE data = ANY(ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash_bigint WHERE data = ANY(ARRAY[$1 /*, ... */]) | 1
|
||||||
|
SELECT * FROM test_squash_bigint WHERE data IN ($1 /*, ... */) | 1
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
-- Bigint, explicit cast is squashed
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_bigint WHERE data IN
|
||||||
|
(1::bigint, 2::bigint, 3::bigint, 4::bigint, 5::bigint, 6::bigint,
|
||||||
|
7::bigint, 8::bigint, 9::bigint, 10::bigint, 11::bigint);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_bigint WHERE data = ANY(ARRAY[
|
||||||
|
1::bigint, 2::bigint, 3::bigint, 4::bigint, 5::bigint, 6::bigint,
|
||||||
|
7::bigint, 8::bigint, 9::bigint, 10::bigint, 11::bigint]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash_bigint WHERE data IN +| 2
|
||||||
|
($1 /*, ... */) |
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
-- Bigint, long tokens with parenthesis, will not squash
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_bigint WHERE id IN
|
||||||
|
(abs(100), abs(200), abs(300), abs(400), abs(500), abs(600), abs(700),
|
||||||
|
abs(800), abs(900), abs(1000), ((abs(1100))));
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_bigint WHERE id = ANY(ARRAY[
|
||||||
|
abs(100), abs(200), abs(300), abs(400), abs(500), abs(600), abs(700),
|
||||||
|
abs(800), abs(900), abs(1000), ((abs(1100)))]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash_bigint WHERE id IN +| 2
|
||||||
|
(abs($1), abs($2), abs($3), abs($4), abs($5), abs($6), abs($7),+|
|
||||||
|
abs($8), abs($9), abs($10), ((abs($11)))) |
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
-- Multiple FuncExpr's. Will not squash
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT WHERE 1 IN (1::int::bigint::int, 2::int::bigint::int);
|
||||||
|
--
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT WHERE 1 = ANY(ARRAY[1::int::bigint::int, 2::int::bigint::int]);
|
||||||
|
--
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------+-------
|
||||||
|
SELECT WHERE $1 IN ($2 /*, ... */) | 2
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- CoerceViaIO
|
||||||
|
--
|
||||||
|
-- Create some dummy type to force CoerceViaIO
|
||||||
|
CREATE TYPE casttesttype;
|
||||||
|
CREATE FUNCTION casttesttype_in(cstring)
|
||||||
|
RETURNS casttesttype
|
||||||
|
AS 'textin'
|
||||||
|
LANGUAGE internal STRICT IMMUTABLE;
|
||||||
|
NOTICE: return type casttesttype is only a shell
|
||||||
|
CREATE FUNCTION casttesttype_out(casttesttype)
|
||||||
|
RETURNS cstring
|
||||||
|
AS 'textout'
|
||||||
|
LANGUAGE internal STRICT IMMUTABLE;
|
||||||
|
NOTICE: argument type casttesttype is only a shell
|
||||||
|
LINE 1: CREATE FUNCTION casttesttype_out(casttesttype)
|
||||||
|
^
|
||||||
|
CREATE TYPE casttesttype (
|
||||||
|
internallength = variable,
|
||||||
|
input = casttesttype_in,
|
||||||
|
output = casttesttype_out,
|
||||||
|
alignment = int4
|
||||||
|
);
|
||||||
|
CREATE CAST (int4 AS casttesttype) WITH INOUT;
|
||||||
|
CREATE FUNCTION casttesttype_eq(casttesttype, casttesttype)
|
||||||
|
returns boolean language sql immutable as $$
|
||||||
|
SELECT true
|
||||||
|
$$;
|
||||||
|
CREATE OPERATOR = (
|
||||||
|
leftarg = casttesttype,
|
||||||
|
rightarg = casttesttype,
|
||||||
|
procedure = casttesttype_eq,
|
||||||
|
commutator = =);
|
||||||
|
CREATE TABLE test_squash_cast (id int, data casttesttype);
|
||||||
|
-- Use the introduced type to construct a list of CoerceViaIO around Const
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_cast WHERE data IN
|
||||||
|
(1::int4::casttesttype, 2::int4::casttesttype, 3::int4::casttesttype,
|
||||||
|
4::int4::casttesttype, 5::int4::casttesttype, 6::int4::casttesttype,
|
||||||
|
7::int4::casttesttype, 8::int4::casttesttype, 9::int4::casttesttype,
|
||||||
|
10::int4::casttesttype, 11::int4::casttesttype);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_cast WHERE data = ANY (ARRAY
|
||||||
|
[1::int4::casttesttype, 2::int4::casttesttype, 3::int4::casttesttype,
|
||||||
|
4::int4::casttesttype, 5::int4::casttesttype, 6::int4::casttesttype,
|
||||||
|
7::int4::casttesttype, 8::int4::casttesttype, 9::int4::casttesttype,
|
||||||
|
10::int4::casttesttype, 11::int4::casttesttype]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash_cast WHERE data IN +| 2
|
||||||
|
($1 /*, ... */) |
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
-- Some casting expression are simplified to Const
|
||||||
|
CREATE TABLE test_squash_jsonb (id int, data jsonb);
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_jsonb WHERE data IN
|
||||||
|
(('"1"')::jsonb, ('"2"')::jsonb, ('"3"')::jsonb, ('"4"')::jsonb,
|
||||||
|
('"5"')::jsonb, ('"6"')::jsonb, ('"7"')::jsonb, ('"8"')::jsonb,
|
||||||
|
('"9"')::jsonb, ('"10"')::jsonb);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_jsonb WHERE data = ANY (ARRAY
|
||||||
|
[('"1"')::jsonb, ('"2"')::jsonb, ('"3"')::jsonb, ('"4"')::jsonb,
|
||||||
|
('"5"')::jsonb, ('"6"')::jsonb, ('"7"')::jsonb, ('"8"')::jsonb,
|
||||||
|
('"9"')::jsonb, ('"10"')::jsonb]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash_jsonb WHERE data IN +| 2
|
||||||
|
($1 /*, ... */) |
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
-- CoerceViaIO, SubLink instead of a Const. Will not squash
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_jsonb WHERE data IN
|
||||||
|
((SELECT '"1"')::jsonb, (SELECT '"2"')::jsonb, (SELECT '"3"')::jsonb,
|
||||||
|
(SELECT '"4"')::jsonb, (SELECT '"5"')::jsonb, (SELECT '"6"')::jsonb,
|
||||||
|
(SELECT '"7"')::jsonb, (SELECT '"8"')::jsonb, (SELECT '"9"')::jsonb,
|
||||||
|
(SELECT '"10"')::jsonb);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash_jsonb WHERE data = ANY(ARRAY
|
||||||
|
[(SELECT '"1"')::jsonb, (SELECT '"2"')::jsonb, (SELECT '"3"')::jsonb,
|
||||||
|
(SELECT '"4"')::jsonb, (SELECT '"5"')::jsonb, (SELECT '"6"')::jsonb,
|
||||||
|
(SELECT '"7"')::jsonb, (SELECT '"8"')::jsonb, (SELECT '"9"')::jsonb,
|
||||||
|
(SELECT '"10"')::jsonb]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
----------------------------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash_jsonb WHERE data IN +| 2
|
||||||
|
((SELECT $1)::jsonb, (SELECT $2)::jsonb, (SELECT $3)::jsonb,+|
|
||||||
|
(SELECT $4)::jsonb, (SELECT $5)::jsonb, (SELECT $6)::jsonb,+|
|
||||||
|
(SELECT $7)::jsonb, (SELECT $8)::jsonb, (SELECT $9)::jsonb,+|
|
||||||
|
(SELECT $10)::jsonb) |
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
-- Multiple CoerceViaIO are squashed
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT WHERE 1 IN (1::text::int::text::int, 1::text::int::text::int);
|
||||||
|
--
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT WHERE 1 = ANY(ARRAY[1::text::int::text::int, 1::text::int::text::int]);
|
||||||
|
--
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------+-------
|
||||||
|
SELECT WHERE $1 IN ($2 /*, ... */) | 2
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- RelabelType
|
||||||
|
--
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- However many layers of RelabelType there are, the list will be squashable.
|
||||||
|
SELECT * FROM test_squash WHERE id IN
|
||||||
|
(1::oid, 2::oid, 3::oid, 4::oid, 5::oid, 6::oid, 7::oid, 8::oid, 9::oid);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT ARRAY[1::oid, 2::oid, 3::oid, 4::oid, 5::oid, 6::oid, 7::oid, 8::oid, 9::oid];
|
||||||
|
array
|
||||||
|
---------------------
|
||||||
|
{1,2,3,4,5,6,7,8,9}
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1::oid, 2::oid::int::oid);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY(ARRAY[1::oid, 2::oid::int::oid]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
-- RelabelType together with CoerceViaIO is also squashable
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY(ARRAY[1::oid::text::int::oid, 2::oid::int::oid]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY(ARRAY[1::text::int::oid, 2::oid::int::oid]);
|
||||||
|
id | data
|
||||||
|
----+------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------+-------
|
||||||
|
SELECT * FROM test_squash WHERE id IN +| 5
|
||||||
|
($1 /*, ... */) |
|
||||||
|
SELECT ARRAY[$1 /*, ... */] | 1
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- edge cases
|
||||||
|
--
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- for nested arrays, only constants are squashed
|
||||||
|
SELECT ARRAY[
|
||||||
|
ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||||
|
ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||||
|
ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||||
|
ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||||
|
];
|
||||||
|
array
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
{{1,2,3,4,5,6,7,8,9,10},{1,2,3,4,5,6,7,8,9,10},{1,2,3,4,5,6,7,8,9,10},{1,2,3,4,5,6,7,8,9,10}}
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------+-------
|
||||||
|
SELECT ARRAY[ +| 1
|
||||||
|
ARRAY[$1 /*, ... */], +|
|
||||||
|
ARRAY[$2 /*, ... */], +|
|
||||||
|
ARRAY[$3 /*, ... */], +|
|
||||||
|
ARRAY[$4 /*, ... */] +|
|
||||||
|
] |
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
-- Test constants evaluation in a CTE, which was causing issues in the past
|
||||||
|
WITH cte AS (
|
||||||
|
SELECT 'const' as const FROM test_squash
|
||||||
|
)
|
||||||
|
SELECT ARRAY['a', 'b', 'c', const::varchar] AS result
|
||||||
|
FROM cte;
|
||||||
|
result
|
||||||
|
--------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Rewritten as an OpExpr, so it will not be squashed
|
||||||
|
select where '1' IN ('1'::int, '2'::int::text);
|
||||||
|
--
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Rewritten as an ArrayExpr, so it will be squashed
|
||||||
|
select where '1' IN ('1'::int, '2'::int);
|
||||||
|
--
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------+-------
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
select where $1 IN ($2 /*, ... */) | 1
|
||||||
|
select where $1 IN ($2::int, $3::int::text) | 1
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
t
|
||||||
|
---
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Both of these queries will be rewritten as an ArrayExpr, so they
|
||||||
|
-- will be squashed, and have a similar queryId
|
||||||
|
select where '1' IN ('1'::int::text, '2'::int::text);
|
||||||
|
--
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
select where '1' = ANY (array['1'::int::text, '2'::int::text]);
|
||||||
|
--
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
query | calls
|
||||||
|
-------------------------------------------------+-------
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t | 1
|
||||||
|
select where $1 IN ($2 /*, ... */) | 2
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- cleanup
|
||||||
|
--
|
||||||
|
DROP TABLE test_squash;
|
||||||
|
DROP TABLE test_float;
|
||||||
|
DROP TABLE test_squash_numeric;
|
||||||
|
DROP TABLE test_squash_bigint;
|
||||||
|
DROP TABLE test_squash_cast CASCADE;
|
||||||
|
DROP TABLE test_squash_jsonb;
|
||||||
|
SELECT pg_stat_monitor_reset();
|
||||||
|
pg_stat_monitor_reset
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
DROP EXTENSION pg_stat_monitor;
|
||||||
|
|
@ -42,6 +42,19 @@ SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
SELECT pg_stat_monitor_reset() |
|
SELECT pg_stat_monitor_reset() |
|
||||||
(5 rows)
|
(5 rows)
|
||||||
|
|
||||||
|
-- make sure that we handle nested queries correctly
|
||||||
|
BEGIN;
|
||||||
|
DO $$
|
||||||
|
DECLARE
|
||||||
|
i int;
|
||||||
|
BEGIN
|
||||||
|
-- default stack limit is 2000kB, 50000 is much larger than that
|
||||||
|
FOR i IN 1..50000 LOOP
|
||||||
|
EXECUTE format('SELECT %s', i);
|
||||||
|
END LOOP;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
COMMIT;
|
||||||
SELECT pg_stat_monitor_reset();
|
SELECT pg_stat_monitor_reset();
|
||||||
pg_stat_monitor_reset
|
pg_stat_monitor_reset
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,19 @@ SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
SELECT pg_stat_monitor_reset() |
|
SELECT pg_stat_monitor_reset() |
|
||||||
(5 rows)
|
(5 rows)
|
||||||
|
|
||||||
|
-- make sure that we handle nested queries correctly
|
||||||
|
BEGIN;
|
||||||
|
DO $$
|
||||||
|
DECLARE
|
||||||
|
i int;
|
||||||
|
BEGIN
|
||||||
|
-- default stack limit is 2000kB, 50000 is much larger than that
|
||||||
|
FOR i IN 1..50000 LOOP
|
||||||
|
EXECUTE format('SELECT %s', i);
|
||||||
|
END LOOP;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
COMMIT;
|
||||||
SELECT pg_stat_monitor_reset();
|
SELECT pg_stat_monitor_reset();
|
||||||
pg_stat_monitor_reset
|
pg_stat_monitor_reset
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ CREATE EXTENSION pg_stat_monitor;
|
||||||
SELECT pg_stat_monitor_version();
|
SELECT pg_stat_monitor_version();
|
||||||
pg_stat_monitor_version
|
pg_stat_monitor_version
|
||||||
-------------------------
|
-------------------------
|
||||||
2.1.0
|
2.3.1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
DROP EXTENSION pg_stat_monitor;
|
DROP EXTENSION pg_stat_monitor;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
CREATE EXTENSION pg_stat_monitor;
|
||||||
|
|
||||||
|
DO $$
|
||||||
|
DECLARE
|
||||||
|
i integer;
|
||||||
|
BEGIN
|
||||||
|
FOR i IN 10..24 LOOP
|
||||||
|
RAISE NOTICE 'error_code: %, error_level: %', i, decode_error_level(i);
|
||||||
|
END LOOP;
|
||||||
|
END $$;
|
||||||
|
|
||||||
|
DROP EXTENSION pg_stat_monitor;
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
--
|
||||||
|
-- Tests for parallel statistics
|
||||||
|
--
|
||||||
|
|
||||||
|
SELECT setting::integer < 180000 AS skip_test FROM pg_settings where name = 'server_version_num' \gset
|
||||||
|
\if :skip_test
|
||||||
|
\quit
|
||||||
|
\endif
|
||||||
|
|
||||||
|
CREATE EXTENSION pg_stat_monitor;
|
||||||
|
SET pgsm.track_utility = FALSE;
|
||||||
|
|
||||||
|
-- encourage use of parallel plans
|
||||||
|
SET parallel_setup_cost = 0;
|
||||||
|
SET parallel_tuple_cost = 0;
|
||||||
|
SET min_parallel_table_scan_size = 0;
|
||||||
|
SET max_parallel_workers_per_gather = 2;
|
||||||
|
|
||||||
|
CREATE TABLE pgsm_parallel_tab (a int);
|
||||||
|
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
|
||||||
|
SELECT count(*) FROM pgsm_parallel_tab;
|
||||||
|
|
||||||
|
SELECT query,
|
||||||
|
parallel_workers_to_launch > 0 AS has_workers_to_launch,
|
||||||
|
parallel_workers_launched > 0 AS has_workers_launched
|
||||||
|
FROM pg_stat_monitor
|
||||||
|
WHERE query ~ 'SELECT count'
|
||||||
|
ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
DROP TABLE pgsm_parallel_tab;
|
||||||
|
|
@ -0,0 +1,312 @@
|
||||||
|
--
|
||||||
|
-- Const squashing functionality
|
||||||
|
--
|
||||||
|
|
||||||
|
SELECT setting::integer < 180000 AS skip_test FROM pg_settings where name = 'server_version_num' \gset
|
||||||
|
\if :skip_test
|
||||||
|
\quit
|
||||||
|
\endif
|
||||||
|
|
||||||
|
CREATE EXTENSION pg_stat_monitor;
|
||||||
|
SET pg_stat_monitor.pgsm_normalized_query = TRUE;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Simple Lists
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE test_squash (id int, data int);
|
||||||
|
|
||||||
|
-- single element will not be squashed
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1);
|
||||||
|
SELECT ARRAY[1];
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- more than 1 element in a list will be squashed
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3);
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4);
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5);
|
||||||
|
SELECT ARRAY[1, 2, 3];
|
||||||
|
SELECT ARRAY[1, 2, 3, 4];
|
||||||
|
SELECT ARRAY[1, 2, 3, 4, 5];
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- built-in functions will be squashed
|
||||||
|
-- the IN and ARRAY forms of this statement will have the same queryId
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT WHERE 1 IN (1, int4(1), int4(2), 2);
|
||||||
|
SELECT WHERE 1 = ANY (ARRAY[1, int4(1), int4(2), 2]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- This tests are disabled due bug in PGSM, see: https://perconadev.atlassian.net/browse/PG-1936
|
||||||
|
-- -- external parameters will be squashed
|
||||||
|
-- SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
-- SELECT * FROM test_squash WHERE id IN ($1, $2, $3, $4, $5) \bind 1 2 3 4 5
|
||||||
|
-- ;
|
||||||
|
-- SELECT * FROM test_squash WHERE id::text = ANY(ARRAY[$1, $2, $3, $4, $5]) \bind 1 2 3 4 5
|
||||||
|
-- ;
|
||||||
|
-- SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- -- prepared statements will also be squashed
|
||||||
|
-- -- the IN and ARRAY forms of this statement will have the same queryId
|
||||||
|
-- SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
-- PREPARE p1(int, int, int, int, int) AS
|
||||||
|
-- SELECT * FROM test_squash WHERE id IN ($1, $2, $3, $4, $5);
|
||||||
|
-- EXECUTE p1(1, 2, 3, 4, 5);
|
||||||
|
-- DEALLOCATE p1;
|
||||||
|
-- PREPARE p1(int, int, int, int, int) AS
|
||||||
|
-- SELECT * FROM test_squash WHERE id = ANY(ARRAY[$1, $2, $3, $4, $5]);
|
||||||
|
-- EXECUTE p1(1, 2, 3, 4, 5);
|
||||||
|
-- DEALLOCATE p1;
|
||||||
|
-- SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- More conditions in the query
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9) AND data = 2;
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) AND data = 2;
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) AND data = 2;
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9]) AND data = 2;
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) AND data = 2;
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) AND data = 2;
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- Multiple squashed intervals
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9)
|
||||||
|
AND data IN (1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||||
|
AND data IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
|
||||||
|
AND data IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9])
|
||||||
|
AND data = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
||||||
|
AND data = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
|
||||||
|
AND data = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
|
||||||
|
-- No constants squashing for OpExpr
|
||||||
|
-- The IN and ARRAY forms of this statement will have the same queryId
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT * FROM test_squash WHERE id IN
|
||||||
|
(1 + 1, 2 + 2, 3 + 3, 4 + 4, 5 + 5, 6 + 6, 7 + 7, 8 + 8, 9 + 9);
|
||||||
|
SELECT * FROM test_squash WHERE id IN
|
||||||
|
(@ '-1', @ '-2', @ '-3', @ '-4', @ '-5', @ '-6', @ '-7', @ '-8', @ '-9');
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY(ARRAY
|
||||||
|
[1 + 1, 2 + 2, 3 + 3, 4 + 4, 5 + 5, 6 + 6, 7 + 7, 8 + 8, 9 + 9]);
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY(ARRAY
|
||||||
|
[@ '-1', @ '-2', @ '-3', @ '-4', @ '-5', @ '-6', @ '-7', @ '-8', @ '-9']);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
--
|
||||||
|
-- FuncExpr
|
||||||
|
--
|
||||||
|
|
||||||
|
-- Verify multiple type representation end up with the same query_id
|
||||||
|
CREATE TABLE test_float (data float);
|
||||||
|
-- The casted ARRAY expressions will have the same queryId as the IN clause
|
||||||
|
-- form of the query
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT data FROM test_float WHERE data IN (1, 2);
|
||||||
|
SELECT data FROM test_float WHERE data IN (1, '2');
|
||||||
|
SELECT data FROM test_float WHERE data IN ('1', 2);
|
||||||
|
SELECT data FROM test_float WHERE data IN ('1', '2');
|
||||||
|
SELECT data FROM test_float WHERE data IN (1.0, 1.0);
|
||||||
|
SELECT data FROM test_float WHERE data = ANY(ARRAY['1'::double precision, '2'::double precision]);
|
||||||
|
SELECT data FROM test_float WHERE data = ANY(ARRAY[1.0::double precision, 1.0::double precision]);
|
||||||
|
SELECT data FROM test_float WHERE data = ANY(ARRAY[1, 2]);
|
||||||
|
SELECT data FROM test_float WHERE data = ANY(ARRAY[1, '2']);
|
||||||
|
SELECT data FROM test_float WHERE data = ANY(ARRAY['1', 2]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- Numeric type, implicit cast is squashed
|
||||||
|
CREATE TABLE test_squash_numeric (id int, data numeric(5, 2));
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT * FROM test_squash_numeric WHERE data IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
|
SELECT * FROM test_squash_numeric WHERE data = ANY(ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- Bigint, implicit cast is squashed
|
||||||
|
CREATE TABLE test_squash_bigint (id int, data bigint);
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT * FROM test_squash_bigint WHERE data IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
|
SELECT * FROM test_squash_bigint WHERE data = ANY(ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- Bigint, explicit cast is squashed
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT * FROM test_squash_bigint WHERE data IN
|
||||||
|
(1::bigint, 2::bigint, 3::bigint, 4::bigint, 5::bigint, 6::bigint,
|
||||||
|
7::bigint, 8::bigint, 9::bigint, 10::bigint, 11::bigint);
|
||||||
|
SELECT * FROM test_squash_bigint WHERE data = ANY(ARRAY[
|
||||||
|
1::bigint, 2::bigint, 3::bigint, 4::bigint, 5::bigint, 6::bigint,
|
||||||
|
7::bigint, 8::bigint, 9::bigint, 10::bigint, 11::bigint]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- Bigint, long tokens with parenthesis, will not squash
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT * FROM test_squash_bigint WHERE id IN
|
||||||
|
(abs(100), abs(200), abs(300), abs(400), abs(500), abs(600), abs(700),
|
||||||
|
abs(800), abs(900), abs(1000), ((abs(1100))));
|
||||||
|
SELECT * FROM test_squash_bigint WHERE id = ANY(ARRAY[
|
||||||
|
abs(100), abs(200), abs(300), abs(400), abs(500), abs(600), abs(700),
|
||||||
|
abs(800), abs(900), abs(1000), ((abs(1100)))]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- Multiple FuncExpr's. Will not squash
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT WHERE 1 IN (1::int::bigint::int, 2::int::bigint::int);
|
||||||
|
SELECT WHERE 1 = ANY(ARRAY[1::int::bigint::int, 2::int::bigint::int]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
--
|
||||||
|
-- CoerceViaIO
|
||||||
|
--
|
||||||
|
|
||||||
|
-- Create some dummy type to force CoerceViaIO
|
||||||
|
CREATE TYPE casttesttype;
|
||||||
|
|
||||||
|
CREATE FUNCTION casttesttype_in(cstring)
|
||||||
|
RETURNS casttesttype
|
||||||
|
AS 'textin'
|
||||||
|
LANGUAGE internal STRICT IMMUTABLE;
|
||||||
|
|
||||||
|
CREATE FUNCTION casttesttype_out(casttesttype)
|
||||||
|
RETURNS cstring
|
||||||
|
AS 'textout'
|
||||||
|
LANGUAGE internal STRICT IMMUTABLE;
|
||||||
|
|
||||||
|
CREATE TYPE casttesttype (
|
||||||
|
internallength = variable,
|
||||||
|
input = casttesttype_in,
|
||||||
|
output = casttesttype_out,
|
||||||
|
alignment = int4
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE CAST (int4 AS casttesttype) WITH INOUT;
|
||||||
|
|
||||||
|
CREATE FUNCTION casttesttype_eq(casttesttype, casttesttype)
|
||||||
|
returns boolean language sql immutable as $$
|
||||||
|
SELECT true
|
||||||
|
$$;
|
||||||
|
|
||||||
|
CREATE OPERATOR = (
|
||||||
|
leftarg = casttesttype,
|
||||||
|
rightarg = casttesttype,
|
||||||
|
procedure = casttesttype_eq,
|
||||||
|
commutator = =);
|
||||||
|
|
||||||
|
CREATE TABLE test_squash_cast (id int, data casttesttype);
|
||||||
|
|
||||||
|
-- Use the introduced type to construct a list of CoerceViaIO around Const
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT * FROM test_squash_cast WHERE data IN
|
||||||
|
(1::int4::casttesttype, 2::int4::casttesttype, 3::int4::casttesttype,
|
||||||
|
4::int4::casttesttype, 5::int4::casttesttype, 6::int4::casttesttype,
|
||||||
|
7::int4::casttesttype, 8::int4::casttesttype, 9::int4::casttesttype,
|
||||||
|
10::int4::casttesttype, 11::int4::casttesttype);
|
||||||
|
SELECT * FROM test_squash_cast WHERE data = ANY (ARRAY
|
||||||
|
[1::int4::casttesttype, 2::int4::casttesttype, 3::int4::casttesttype,
|
||||||
|
4::int4::casttesttype, 5::int4::casttesttype, 6::int4::casttesttype,
|
||||||
|
7::int4::casttesttype, 8::int4::casttesttype, 9::int4::casttesttype,
|
||||||
|
10::int4::casttesttype, 11::int4::casttesttype]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- Some casting expression are simplified to Const
|
||||||
|
CREATE TABLE test_squash_jsonb (id int, data jsonb);
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT * FROM test_squash_jsonb WHERE data IN
|
||||||
|
(('"1"')::jsonb, ('"2"')::jsonb, ('"3"')::jsonb, ('"4"')::jsonb,
|
||||||
|
('"5"')::jsonb, ('"6"')::jsonb, ('"7"')::jsonb, ('"8"')::jsonb,
|
||||||
|
('"9"')::jsonb, ('"10"')::jsonb);
|
||||||
|
SELECT * FROM test_squash_jsonb WHERE data = ANY (ARRAY
|
||||||
|
[('"1"')::jsonb, ('"2"')::jsonb, ('"3"')::jsonb, ('"4"')::jsonb,
|
||||||
|
('"5"')::jsonb, ('"6"')::jsonb, ('"7"')::jsonb, ('"8"')::jsonb,
|
||||||
|
('"9"')::jsonb, ('"10"')::jsonb]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- CoerceViaIO, SubLink instead of a Const. Will not squash
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT * FROM test_squash_jsonb WHERE data IN
|
||||||
|
((SELECT '"1"')::jsonb, (SELECT '"2"')::jsonb, (SELECT '"3"')::jsonb,
|
||||||
|
(SELECT '"4"')::jsonb, (SELECT '"5"')::jsonb, (SELECT '"6"')::jsonb,
|
||||||
|
(SELECT '"7"')::jsonb, (SELECT '"8"')::jsonb, (SELECT '"9"')::jsonb,
|
||||||
|
(SELECT '"10"')::jsonb);
|
||||||
|
SELECT * FROM test_squash_jsonb WHERE data = ANY(ARRAY
|
||||||
|
[(SELECT '"1"')::jsonb, (SELECT '"2"')::jsonb, (SELECT '"3"')::jsonb,
|
||||||
|
(SELECT '"4"')::jsonb, (SELECT '"5"')::jsonb, (SELECT '"6"')::jsonb,
|
||||||
|
(SELECT '"7"')::jsonb, (SELECT '"8"')::jsonb, (SELECT '"9"')::jsonb,
|
||||||
|
(SELECT '"10"')::jsonb]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- Multiple CoerceViaIO are squashed
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
SELECT WHERE 1 IN (1::text::int::text::int, 1::text::int::text::int);
|
||||||
|
SELECT WHERE 1 = ANY(ARRAY[1::text::int::text::int, 1::text::int::text::int]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
--
|
||||||
|
-- RelabelType
|
||||||
|
--
|
||||||
|
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
-- However many layers of RelabelType there are, the list will be squashable.
|
||||||
|
SELECT * FROM test_squash WHERE id IN
|
||||||
|
(1::oid, 2::oid, 3::oid, 4::oid, 5::oid, 6::oid, 7::oid, 8::oid, 9::oid);
|
||||||
|
SELECT ARRAY[1::oid, 2::oid, 3::oid, 4::oid, 5::oid, 6::oid, 7::oid, 8::oid, 9::oid];
|
||||||
|
SELECT * FROM test_squash WHERE id IN (1::oid, 2::oid::int::oid);
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY(ARRAY[1::oid, 2::oid::int::oid]);
|
||||||
|
-- RelabelType together with CoerceViaIO is also squashable
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY(ARRAY[1::oid::text::int::oid, 2::oid::int::oid]);
|
||||||
|
SELECT * FROM test_squash WHERE id = ANY(ARRAY[1::text::int::oid, 2::oid::int::oid]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
--
|
||||||
|
-- edge cases
|
||||||
|
--
|
||||||
|
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
-- for nested arrays, only constants are squashed
|
||||||
|
SELECT ARRAY[
|
||||||
|
ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||||
|
ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||||
|
ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||||
|
ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||||
|
];
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- Test constants evaluation in a CTE, which was causing issues in the past
|
||||||
|
WITH cte AS (
|
||||||
|
SELECT 'const' as const FROM test_squash
|
||||||
|
)
|
||||||
|
SELECT ARRAY['a', 'b', 'c', const::varchar] AS result
|
||||||
|
FROM cte;
|
||||||
|
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
-- Rewritten as an OpExpr, so it will not be squashed
|
||||||
|
select where '1' IN ('1'::int, '2'::int::text);
|
||||||
|
-- Rewritten as an ArrayExpr, so it will be squashed
|
||||||
|
select where '1' IN ('1'::int, '2'::int);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
SELECT pg_stat_monitor_reset() IS NOT NULL AS t;
|
||||||
|
-- Both of these queries will be rewritten as an ArrayExpr, so they
|
||||||
|
-- will be squashed, and have a similar queryId
|
||||||
|
select where '1' IN ('1'::int::text, '2'::int::text);
|
||||||
|
select where '1' = ANY (array['1'::int::text, '2'::int::text]);
|
||||||
|
SELECT query, calls FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
--
|
||||||
|
-- cleanup
|
||||||
|
--
|
||||||
|
DROP TABLE test_squash;
|
||||||
|
DROP TABLE test_float;
|
||||||
|
DROP TABLE test_squash_numeric;
|
||||||
|
DROP TABLE test_squash_bigint;
|
||||||
|
DROP TABLE test_squash_cast CASCADE;
|
||||||
|
DROP TABLE test_squash_jsonb;
|
||||||
|
SELECT pg_stat_monitor_reset();
|
||||||
|
DROP EXTENSION pg_stat_monitor;
|
||||||
|
|
@ -16,5 +16,22 @@ $$ language plpgsql;
|
||||||
|
|
||||||
SELECT add2(1,2);
|
SELECT add2(1,2);
|
||||||
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
SELECT query, top_query FROM pg_stat_monitor ORDER BY query COLLATE "C";
|
||||||
|
|
||||||
|
-- make sure that we handle nested queries correctly
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
DO $$
|
||||||
|
DECLARE
|
||||||
|
i int;
|
||||||
|
BEGIN
|
||||||
|
-- default stack limit is 2000kB, 50000 is much larger than that
|
||||||
|
FOR i IN 1..50000 LOOP
|
||||||
|
EXECUTE format('SELECT %s', i);
|
||||||
|
END LOOP;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
SELECT pg_stat_monitor_reset();
|
SELECT pg_stat_monitor_reset();
|
||||||
DROP EXTENSION pg_stat_monitor;
|
DROP EXTENSION pg_stat_monitor;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,24 @@ print $conf "shared_preload_libraries = 'pg_stat_monitor'\n";
|
||||||
close $conf;
|
close $conf;
|
||||||
|
|
||||||
# Dictionary for expected PGSM columns names on different PG server versions
|
# Dictionary for expected PGSM columns names on different PG server versions
|
||||||
my %pg_versions_pgsm_columns = ( 17 => "application_name,".
|
my %pg_versions_pgsm_columns = ( 18 => "application_name,".
|
||||||
|
"bucket,bucket_done,bucket_start_time,calls," .
|
||||||
|
"client_ip,cmd_type,cmd_type_text,comments,cpu_sys_time,cpu_user_time," .
|
||||||
|
"datname,dbid,elevel,jit_deform_count,jit_deform_time," .
|
||||||
|
"jit_emission_count,jit_emission_time,jit_functions,jit_generation_time," .
|
||||||
|
"jit_inlining_count,jit_inlining_time,jit_optimization_count,jit_optimization_time," .
|
||||||
|
"local_blk_read_time,local_blk_write_time,local_blks_dirtied,local_blks_hit,".
|
||||||
|
"local_blks_read,local_blks_written,max_exec_time,max_plan_time,mean_exec_time," .
|
||||||
|
"mean_plan_time,message,min_exec_time,min_plan_time,minmax_stats_since," .
|
||||||
|
"parallel_workers_launched,parallel_workers_to_launch," .
|
||||||
|
"pgsm_query_id,planid,plans,query,query_plan,queryid,relations,resp_calls,rows," .
|
||||||
|
"shared_blk_read_time,shared_blk_write_time,shared_blks_dirtied," .
|
||||||
|
"shared_blks_hit,shared_blks_read,shared_blks_written,sqlcode,stats_since," .
|
||||||
|
"stddev_exec_time,stddev_plan_time,temp_blk_read_time,temp_blk_write_time," .
|
||||||
|
"temp_blks_read,temp_blks_written,top_query,top_queryid,toplevel," .
|
||||||
|
"total_exec_time,total_plan_time,userid,username,wal_buffers_full,wal_bytes," .
|
||||||
|
"wal_fpi,wal_records",
|
||||||
|
17 => "application_name,".
|
||||||
"bucket,bucket_done,bucket_start_time,calls," .
|
"bucket,bucket_done,bucket_start_time,calls," .
|
||||||
"client_ip,cmd_type,cmd_type_text,comments,cpu_sys_time,cpu_user_time," .
|
"client_ip,cmd_type,cmd_type_text,comments,cpu_sys_time,cpu_user_time," .
|
||||||
"datname,dbid,elevel,jit_deform_count,jit_deform_time," .
|
"datname,dbid,elevel,jit_deform_count,jit_deform_time," .
|
||||||
|
|
|
||||||
|
|
@ -93,10 +93,10 @@ PGSM::append_to_debug_file($stdout);
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', "SELECT bucket, bucket_start_time, queryid, substr(query,0,30) AS query, calls, rows, total_exec_time, min_exec_time, max_exec_time, mean_exec_time, stddev_exec_time, ROUND(${col_shared_blk_read_time}::numeric,4) AS ${col_shared_blk_read_time}, ROUND(${col_shared_blk_write_time}::numeric,4) AS ${col_shared_blk_write_time}, cpu_user_time, cpu_sys_time FROM pg_stat_monitor WHERE query LIKE '%bench%' ORDER BY query,calls DESC;", extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', "SELECT bucket, bucket_start_time, queryid, substr(query,0,30) AS query, calls, rows, total_exec_time, min_exec_time, max_exec_time, mean_exec_time, stddev_exec_time, ROUND(${col_shared_blk_read_time}::numeric,4) AS ${col_shared_blk_read_time}, ROUND(${col_shared_blk_write_time}::numeric,4) AS ${col_shared_blk_write_time}, cpu_user_time, cpu_sys_time FROM pg_stat_monitor WHERE query LIKE '%bench%' ORDER BY query,calls DESC;", extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
||||||
PGSM::append_to_debug_file($stdout);
|
PGSM::append_to_debug_file($stdout);
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT substr(query,0,30) AS query,calls,rows,wal_records,wal_fpi,wal_bytes FROM pg_stat_statements WHERE query LIKE \'%bench%\' ORDER BY query,calls;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT substr(query,0,30) AS query,calls,rows,wal_records,wal_fpi,wal_bytes,wal_buffers_full FROM pg_stat_statements WHERE query LIKE \'%bench%\' ORDER BY query,calls;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
||||||
PGSM::append_to_debug_file($stdout);
|
PGSM::append_to_debug_file($stdout);
|
||||||
|
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT bucket, bucket_start_time, substr(query,0,30) AS query,calls, rows, wal_records,wal_fpi,wal_bytes, cmd_type_text FROM pg_stat_monitor WHERE query LIKE \'%bench%\' ORDER BY query,calls;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT bucket, bucket_start_time, substr(query,0,30) AS query,calls, rows, wal_records,wal_fpi,wal_bytes,wal_buffers_full, cmd_type_text FROM pg_stat_monitor WHERE query LIKE \'%bench%\' ORDER BY query,calls;', extra_params => ['-a', '-Pformat=aligned','-Ptuples_only=off']);
|
||||||
PGSM::append_to_debug_file($stdout);
|
PGSM::append_to_debug_file($stdout);
|
||||||
|
|
||||||
# Compare values for query 'DELETE FROM pgbench_accounts WHERE $1 = $2'
|
# Compare values for query 'DELETE FROM pgbench_accounts WHERE $1 = $2'
|
||||||
|
|
@ -140,6 +140,21 @@ is($stdout,'t',"Compare: wal_fpi is equal.");
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Compare: wal_bytes are equal.");
|
is($stdout,'t',"Compare: wal_bytes are equal.");
|
||||||
|
|
||||||
|
if ($PGSM::PG_MAJOR_VERSION >= 18)
|
||||||
|
{
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.wal_buffers_full) = SUM(PGSS.wal_buffers_full) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
|
trim($stdout);
|
||||||
|
is($stdout,'t',"Compare: wal_buffers_full are equal.");
|
||||||
|
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.parallel_workers_to_launch) = SUM(PGSS.parallel_workers_to_launch) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
|
trim($stdout);
|
||||||
|
is($stdout,'t',"Compare: parallel_workers_to_launch are equal.");
|
||||||
|
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.parallel_workers_launched) = SUM(PGSS.parallel_workers_launched) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%DELETE FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
|
trim($stdout);
|
||||||
|
is($stdout,'t',"Compare: parallel_workers_launched are equal.");
|
||||||
|
}
|
||||||
|
|
||||||
# Compare values for query 'INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES ($1, $2, $3, $4, CURRENT_TIMESTAMP)'
|
# Compare values for query 'INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES ($1, $2, $3, $4, CURRENT_TIMESTAMP)'
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.calls) = SUM(PGSS.calls) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.calls) = SUM(PGSS.calls) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
|
|
@ -189,6 +204,21 @@ is($stdout,'t',"Compare: wal_fpi is equal.");
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Compare: wal_bytes are equal.");
|
is($stdout,'t',"Compare: wal_bytes are equal.");
|
||||||
|
|
||||||
|
if ($PGSM::PG_MAJOR_VERSION >= 18)
|
||||||
|
{
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.wal_buffers_full) = SUM(PGSS.wal_buffers_full) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
|
trim($stdout);
|
||||||
|
is($stdout,'t',"Compare: wal_buffers_full are equal.");
|
||||||
|
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.parallel_workers_to_launch) = SUM(PGSS.parallel_workers_to_launch) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
|
trim($stdout);
|
||||||
|
is($stdout,'t',"Compare: parallel_workers_to_launch are equal.");
|
||||||
|
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.parallel_workers_launched) = SUM(PGSS.parallel_workers_launched) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%INSERT INTO pgbench_history%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
|
trim($stdout);
|
||||||
|
is($stdout,'t',"Compare: parallel_workers_launched are equal.");
|
||||||
|
}
|
||||||
|
|
||||||
# Compare values for query 'SELECT abalance FROM pgbench_accounts WHERE aid = $1'
|
# Compare values for query 'SELECT abalance FROM pgbench_accounts WHERE aid = $1'
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.calls) = SUM(PGSS.calls) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%SELECT abalance FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.calls) = SUM(PGSS.calls) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%SELECT abalance FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
|
|
@ -238,6 +268,21 @@ is($stdout,'t',"Compare: wal_fpi is equal.");
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Compare: wal_bytes are equal.");
|
is($stdout,'t',"Compare: wal_bytes are equal.");
|
||||||
|
|
||||||
|
if ($PGSM::PG_MAJOR_VERSION >= 18)
|
||||||
|
{
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.wal_buffers_full) = SUM(PGSS.wal_buffers_full) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%SELECT abalance FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
|
trim($stdout);
|
||||||
|
is($stdout,'t',"Compare: wal_buffers_full are equal.");
|
||||||
|
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.parallel_workers_to_launch) = SUM(PGSS.parallel_workers_to_launch) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%SELECT abalance FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
|
trim($stdout);
|
||||||
|
is($stdout,'t',"Compare: parallel_workers_to_launch are equal.");
|
||||||
|
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.parallel_workers_launched) = SUM(PGSS.parallel_workers_launched) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%SELECT abalance FROM pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
|
trim($stdout);
|
||||||
|
is($stdout,'t',"Compare: parallel_workers_launched are equal.");
|
||||||
|
}
|
||||||
|
|
||||||
# Compare values for query 'UPDATE pgbench_accounts SET abalance = abalance + $1 WHERE aid = $2'
|
# Compare values for query 'UPDATE pgbench_accounts SET abalance = abalance + $1 WHERE aid = $2'
|
||||||
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.calls) = SUM(PGSS.calls) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.calls) = SUM(PGSS.calls) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
|
|
@ -283,6 +328,21 @@ is($stdout,'t',"Compare: wal_fpi is equal.");
|
||||||
trim($stdout);
|
trim($stdout);
|
||||||
is($stdout,'t',"Compare: wal_bytes are equal.");
|
is($stdout,'t',"Compare: wal_bytes are equal.");
|
||||||
|
|
||||||
|
if ($PGSM::PG_MAJOR_VERSION >= 18)
|
||||||
|
{
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.wal_buffers_full) = SUM(PGSS.wal_buffers_full) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
|
trim($stdout);
|
||||||
|
is($stdout,'t',"Compare: wal_buffers_full are equal.");
|
||||||
|
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.parallel_workers_to_launch) = SUM(PGSS.parallel_workers_to_launch) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
|
trim($stdout);
|
||||||
|
is($stdout,'t',"Compare: parallel_workers_to_launch are equal.");
|
||||||
|
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'SELECT SUM(PGSM.parallel_workers_launched) = SUM(PGSS.parallel_workers_launched) FROM pg_stat_monitor AS PGSM INNER JOIN pg_stat_statements AS PGSS ON PGSS.query = PGSM.query WHERE PGSM.query LIKE \'%UPDATE pgbench_accounts%\' GROUP BY PGSM.query;', extra_params => ['-Pformat=unaligned','-Ptuples_only=on']);
|
||||||
|
trim($stdout);
|
||||||
|
is($stdout,'t',"Compare: parallel_workers_launched are equal.");
|
||||||
|
}
|
||||||
|
|
||||||
# DROP EXTENSION
|
# DROP EXTENSION
|
||||||
$stdout = $node->safe_psql('postgres', 'DROP EXTENSION pg_stat_monitor;', extra_params => ['-a']);
|
$stdout = $node->safe_psql('postgres', 'DROP EXTENSION pg_stat_monitor;', extra_params => ['-a']);
|
||||||
ok($cmdret == 0, "DROP PGSM EXTENSION");
|
ok($cmdret == 0, "DROP PGSM EXTENSION");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use File::Basename;
|
||||||
|
use File::Compare;
|
||||||
|
use Test::More;
|
||||||
|
use lib 't';
|
||||||
|
use pgsm;
|
||||||
|
|
||||||
|
# Get filename and create out file name and dirs where requried
|
||||||
|
PGSM::setup_files_dir(basename($0));
|
||||||
|
|
||||||
|
# Create new PostgreSQL node and do initdb
|
||||||
|
my $node = PGSM->pgsm_init_pg();
|
||||||
|
my $pgdata = $node->data_dir;
|
||||||
|
|
||||||
|
# Update postgresql.conf to include/load pg_stat_monitor library
|
||||||
|
$node->append_conf('postgresql.conf', "shared_preload_libraries = 'pg_stat_monitor'");
|
||||||
|
|
||||||
|
# Start server
|
||||||
|
my $rt_value = $node->start;
|
||||||
|
ok($rt_value == 1, "Start Server");
|
||||||
|
|
||||||
|
# Create EXTENSION version 2.0
|
||||||
|
my ($cmdret, $stdout, $stderr) = $node->psql('postgres', 'CREATE EXTENSION pg_stat_monitor VERSION "2.0";', extra_params => ['-a']);
|
||||||
|
ok($cmdret == 0, "Create PGSM EXTENSION");
|
||||||
|
PGSM::append_to_debug_file($stdout);
|
||||||
|
|
||||||
|
# Check that we have some results for version 2.0
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', "SELECT * FROM pg_stat_monitor;", extra_params => ['-a']);
|
||||||
|
ok($cmdret == 0, "Check PGSM returns some results for version 2.0");
|
||||||
|
PGSM::append_to_debug_file($stdout);
|
||||||
|
|
||||||
|
# Update EXTENSION to new version 2.1
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', 'ALTER EXTENSION pg_stat_monitor UPDATE TO "2.1";', extra_params => ['-a']);
|
||||||
|
ok($cmdret == 0, "Update PGSM EXTENSION to new version");
|
||||||
|
PGSM::append_to_debug_file($stdout);
|
||||||
|
|
||||||
|
# Check that we have some results for version 2.1
|
||||||
|
($cmdret, $stdout, $stderr) = $node->psql('postgres', "SELECT * FROM pg_stat_monitor;", extra_params => ['-a']);
|
||||||
|
ok($cmdret == 0, "Check PGSM returns some results for version 2.1");
|
||||||
|
PGSM::append_to_debug_file($stdout);
|
||||||
|
|
||||||
|
# DROP EXTENSION
|
||||||
|
$stdout = $node->safe_psql('postgres', 'DROP EXTENSION pg_stat_monitor;', extra_params => ['-a']);
|
||||||
|
ok($cmdret == 0, "DROP PGSM EXTENSION");
|
||||||
|
PGSM::append_to_debug_file($stdout);
|
||||||
|
|
||||||
|
# Stop the server
|
||||||
|
$node->stop;
|
||||||
|
|
||||||
|
# Done testing for this testcase file.
|
||||||
|
done_testing();
|
||||||
|
|
@ -0,0 +1,151 @@
|
||||||
|
CREATE EXTENSION pg_stat_monitor;
|
||||||
|
SELECT pg_stat_monitor_reset();
|
||||||
|
pg_stat_monitor_reset
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_query_shared_buffer';
|
||||||
|
name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart
|
||||||
|
------------------------------------------+---------+------+------------+---------+--------------------+---------+---------+----------+----------+-----------+-----------------
|
||||||
|
pg_stat_monitor.pgsm_query_shared_buffer | 1 | MB | postmaster | integer | configuration file | 1 | 10000 | | 20 | 1 | f
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
CREATE database example;
|
||||||
|
SELECT datname, substr(query,0,150) AS query, SUM(calls) AS calls FROM pg_stat_monitor GROUP BY datname, query ORDER BY datname, query, calls DESC Limit 20;
|
||||||
|
datname | query | calls
|
||||||
|
---------+---------------------------------------------------------------------------------------------------------------+-------
|
||||||
|
example | INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES ($1, $2, $3, $4, CURRENT_TIMESTAMP) | 10000
|
||||||
|
example | SELECT abalance FROM pgbench_accounts WHERE aid = $1 | 10000
|
||||||
|
example | SELECT relkind FROM pg_catalog.pg_class WHERE oid=$1::pg_catalog.regclass | 3
|
||||||
|
example | UPDATE pgbench_accounts SET abalance = abalance + $1 WHERE aid = $2 | 10000
|
||||||
|
example | UPDATE pgbench_branches SET bbalance = bbalance + $1 WHERE bid = $2 | 10000
|
||||||
|
example | UPDATE pgbench_tellers SET tbalance = tbalance + $1 WHERE tid = $2 | 10000
|
||||||
|
example | alter table pgbench_accounts add primary key (aid) | 1
|
||||||
|
example | alter table pgbench_branches add primary key (bid) | 1
|
||||||
|
example | alter table pgbench_tellers add primary key (tid) | 1
|
||||||
|
example | begin | 10001
|
||||||
|
example | commit | 10001
|
||||||
|
example | copy pgbench_accounts from stdin with (freeze on) | 1
|
||||||
|
example | copy pgbench_branches from stdin with (freeze on) | 1
|
||||||
|
example | copy pgbench_tellers from stdin with (freeze on) | 1
|
||||||
|
example | create table pgbench_accounts(aid int not null,bid int,abalance int,filler char(84)) with (fillfactor=100) | 1
|
||||||
|
example | create table pgbench_branches(bid int not null,bbalance int,filler char(88)) with (fillfactor=100) | 1
|
||||||
|
example | create table pgbench_history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22)) | 1
|
||||||
|
example | create table pgbench_tellers(tid int not null,bid int,tbalance int,filler char(84)) with (fillfactor=100) | 1
|
||||||
|
example | drop table if exists pgbench_accounts, pgbench_branches, pgbench_history, pgbench_tellers | 1
|
||||||
|
example | select count(*) from pgbench_branches | 1
|
||||||
|
(20 rows)
|
||||||
|
|
||||||
|
SELECT pg_stat_monitor_reset();
|
||||||
|
pg_stat_monitor_reset
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_query_shared_buffer';
|
||||||
|
name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart
|
||||||
|
------------------------------------------+---------+------+------------+---------+--------------------+---------+---------+----------+----------+-----------+-----------------
|
||||||
|
pg_stat_monitor.pgsm_query_shared_buffer | 2 | MB | postmaster | integer | configuration file | 1 | 10000 | | 20 | 2 | f
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT datname, substr(query,0,150) AS query, SUM(calls) AS calls FROM pg_stat_monitor GROUP BY datname, query ORDER BY datname, query, calls DESC Limit 20;
|
||||||
|
datname | query | calls
|
||||||
|
---------+---------------------------------------------------------------------------------------------------------------+-------
|
||||||
|
example | INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES ($1, $2, $3, $4, CURRENT_TIMESTAMP) | 10000
|
||||||
|
example | SELECT abalance FROM pgbench_accounts WHERE aid = $1 | 10000
|
||||||
|
example | SELECT relkind FROM pg_catalog.pg_class WHERE oid=$1::pg_catalog.regclass | 3
|
||||||
|
example | UPDATE pgbench_accounts SET abalance = abalance + $1 WHERE aid = $2 | 10000
|
||||||
|
example | UPDATE pgbench_branches SET bbalance = bbalance + $1 WHERE bid = $2 | 10000
|
||||||
|
example | UPDATE pgbench_tellers SET tbalance = tbalance + $1 WHERE tid = $2 | 10000
|
||||||
|
example | alter table pgbench_accounts add primary key (aid) | 1
|
||||||
|
example | alter table pgbench_branches add primary key (bid) | 1
|
||||||
|
example | alter table pgbench_tellers add primary key (tid) | 1
|
||||||
|
example | begin | 10001
|
||||||
|
example | commit | 10001
|
||||||
|
example | copy pgbench_accounts from stdin with (freeze on) | 1
|
||||||
|
example | copy pgbench_branches from stdin with (freeze on) | 1
|
||||||
|
example | copy pgbench_tellers from stdin with (freeze on) | 1
|
||||||
|
example | create table pgbench_accounts(aid int not null,bid int,abalance int,filler char(84)) with (fillfactor=100) | 1
|
||||||
|
example | create table pgbench_branches(bid int not null,bbalance int,filler char(88)) with (fillfactor=100) | 1
|
||||||
|
example | create table pgbench_history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22)) | 1
|
||||||
|
example | create table pgbench_tellers(tid int not null,bid int,tbalance int,filler char(84)) with (fillfactor=100) | 1
|
||||||
|
example | drop table if exists pgbench_accounts, pgbench_branches, pgbench_history, pgbench_tellers | 1
|
||||||
|
example | select count(*) from pgbench_branches | 1
|
||||||
|
(20 rows)
|
||||||
|
|
||||||
|
SELECT pg_stat_monitor_reset();
|
||||||
|
pg_stat_monitor_reset
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_query_shared_buffer';
|
||||||
|
name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart
|
||||||
|
------------------------------------------+---------+------+------------+---------+--------------------+---------+---------+----------+----------+-----------+-----------------
|
||||||
|
pg_stat_monitor.pgsm_query_shared_buffer | 20 | MB | postmaster | integer | configuration file | 1 | 10000 | | 20 | 20 | f
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT datname, substr(query,0,150) AS query, SUM(calls) AS calls FROM pg_stat_monitor GROUP BY datname, query ORDER BY datname, query, calls DESC Limit 20;
|
||||||
|
datname | query | calls
|
||||||
|
---------+---------------------------------------------------------------------------------------------------------------+-------
|
||||||
|
example | INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES ($1, $2, $3, $4, CURRENT_TIMESTAMP) | 10000
|
||||||
|
example | SELECT abalance FROM pgbench_accounts WHERE aid = $1 | 10000
|
||||||
|
example | SELECT relkind FROM pg_catalog.pg_class WHERE oid=$1::pg_catalog.regclass | 3
|
||||||
|
example | UPDATE pgbench_accounts SET abalance = abalance + $1 WHERE aid = $2 | 10000
|
||||||
|
example | UPDATE pgbench_branches SET bbalance = bbalance + $1 WHERE bid = $2 | 10000
|
||||||
|
example | UPDATE pgbench_tellers SET tbalance = tbalance + $1 WHERE tid = $2 | 10000
|
||||||
|
example | alter table pgbench_accounts add primary key (aid) | 1
|
||||||
|
example | alter table pgbench_branches add primary key (bid) | 1
|
||||||
|
example | alter table pgbench_tellers add primary key (tid) | 1
|
||||||
|
example | begin | 10001
|
||||||
|
example | commit | 10001
|
||||||
|
example | copy pgbench_accounts from stdin with (freeze on) | 1
|
||||||
|
example | copy pgbench_branches from stdin with (freeze on) | 1
|
||||||
|
example | copy pgbench_tellers from stdin with (freeze on) | 1
|
||||||
|
example | create table pgbench_accounts(aid int not null,bid int,abalance int,filler char(84)) with (fillfactor=100) | 1
|
||||||
|
example | create table pgbench_branches(bid int not null,bbalance int,filler char(88)) with (fillfactor=100) | 1
|
||||||
|
example | create table pgbench_history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22)) | 1
|
||||||
|
example | create table pgbench_tellers(tid int not null,bid int,tbalance int,filler char(84)) with (fillfactor=100) | 1
|
||||||
|
example | drop table if exists pgbench_accounts, pgbench_branches, pgbench_history, pgbench_tellers | 1
|
||||||
|
example | select count(*) from pgbench_branches | 1
|
||||||
|
(20 rows)
|
||||||
|
|
||||||
|
SELECT pg_stat_monitor_reset();
|
||||||
|
pg_stat_monitor_reset
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT name, setting, unit, context, vartype, source, min_val, max_val, enumvals, boot_val, reset_val, pending_restart FROM pg_settings WHERE name='pg_stat_monitor.pgsm_query_shared_buffer';
|
||||||
|
name | setting | unit | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | pending_restart
|
||||||
|
------------------------------------------+---------+------+------------+---------+--------------------+---------+---------+----------+----------+-----------+-----------------
|
||||||
|
pg_stat_monitor.pgsm_query_shared_buffer | 2048 | MB | postmaster | integer | configuration file | 1 | 10000 | | 20 | 2048 | f
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT datname, substr(query,0,150) AS query, SUM(calls) AS calls FROM pg_stat_monitor GROUP BY datname, query ORDER BY datname, query, calls DESC Limit 20;
|
||||||
|
datname | query | calls
|
||||||
|
---------+---------------------------------------------------------------------------------------------------------------+-------
|
||||||
|
example | INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES ($1, $2, $3, $4, CURRENT_TIMESTAMP) | 10000
|
||||||
|
example | SELECT abalance FROM pgbench_accounts WHERE aid = $1 | 10000
|
||||||
|
example | SELECT relkind FROM pg_catalog.pg_class WHERE oid=$1::pg_catalog.regclass | 3
|
||||||
|
example | UPDATE pgbench_accounts SET abalance = abalance + $1 WHERE aid = $2 | 10000
|
||||||
|
example | UPDATE pgbench_branches SET bbalance = bbalance + $1 WHERE bid = $2 | 10000
|
||||||
|
example | UPDATE pgbench_tellers SET tbalance = tbalance + $1 WHERE tid = $2 | 10000
|
||||||
|
example | alter table pgbench_accounts add primary key (aid) | 1
|
||||||
|
example | alter table pgbench_branches add primary key (bid) | 1
|
||||||
|
example | alter table pgbench_tellers add primary key (tid) | 1
|
||||||
|
example | begin | 10001
|
||||||
|
example | commit | 10001
|
||||||
|
example | copy pgbench_accounts from stdin with (freeze on) | 1
|
||||||
|
example | copy pgbench_branches from stdin with (freeze on) | 1
|
||||||
|
example | copy pgbench_tellers from stdin with (freeze on) | 1
|
||||||
|
example | create table pgbench_accounts(aid int not null,bid int,abalance int,filler char(84)) with (fillfactor=100) | 1
|
||||||
|
example | create table pgbench_branches(bid int not null,bbalance int,filler char(88)) with (fillfactor=100) | 1
|
||||||
|
example | create table pgbench_history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22)) | 1
|
||||||
|
example | create table pgbench_tellers(tid int not null,bid int,tbalance int,filler char(84)) with (fillfactor=100) | 1
|
||||||
|
example | drop table if exists pgbench_accounts, pgbench_branches, pgbench_history, pgbench_tellers | 1
|
||||||
|
example | select count(*) from pgbench_branches | 1
|
||||||
|
(20 rows)
|
||||||
|
|
||||||
|
DROP EXTENSION pg_stat_monitor;
|
||||||
Loading…
Reference in New Issue