#!/bin/bash export PATH=$PATH:$PWD/bin dbname=postgres secs=30 psql -c "alter system set max_parallel_workers_per_gather = 0;" $dbname > /dev/null psql -c "select pg_reload_conf();" $dbname > /dev/null psql -c "create extension if not exists uri;" $dbname > /dev/null cat << EOSQL > bench.sql WITH u(uri) AS MATERIALIZED ( SELECT 'https://root:qerty@example.com:80/a/b/c#comments'::uri ), a(uri) AS ( SELECT replace( uri::text, uri_scheme( uri ), 'wss' )::uri FROM u ), b(uri) AS ( SELECT replace( uri::text, uri_userinfo( uri ), '123:abc' )::uri FROM a ), c(uri) AS ( SELECT replace( uri::text, uri_port( uri )::text, '5432' )::uri FROM b ), d(uri) AS ( SELECT replace( uri::text, uri_path( uri )::text, '/d/e/f' )::uri FROM c ) SELECT replace( uri::text, uri_fragment( uri )::text, 'version' )::uri FROM d; EOSQL for i in {1..5} do pgbench -n -f bench.sql -T $secs $dbname | grep tps done