Skip to content

Instantly share code, notes, and snippets.

View ardentperf's full-sized avatar

Jeremy Schneider ardentperf

View GitHub Profile
@ardentperf
ardentperf / gist:584307726f95564a4b0e2195ffd1010a
Created March 4, 2024 19:12
Count mxids and number of mxid slru pages on a table
#### tested on r6i.16xlarge with RDS Postgres
pgbench -i -s 10 --foreign-keys
pgbench -N -M prepared -T 360 -P 5 -c 512 -j 8
psql -c "create extension pageinspect"
psql <<EOF
-- this query will return one row for each SLRU page.
@ardentperf
ardentperf / run_test_uuid.sh
Created February 3, 2024 11:38
UUID benchmark driver script
#!/bin/bash
INIT_TABLE_ROWS=20000000
PGBENCH_TRANSACTIONS_PER_CLIENT=100000
PGBENCH_CLIENTS=10
run_test() {
echo "$(date +%y%m%d.%H%M) STARTING TEST $1"
pg_stop
@ardentperf
ardentperf / test_random.lua
Created January 19, 2023 06:34
print a clear representation of a sysbench random distribution
function thread_init()
h = sysbench.histogram.new(1000, 1, 100)
end
function event()
h:update(sysbench.rand.default(1, 100))
end
function thread_done()
h:print()
# https://github.com/brendangregg/FlameGraph
#
# skipping directories "test" and "demos"
~/src/FlameGraph$ for F in $(find . -type f -a \! -path ./test\* -a \! -path ./.git\* -a \! -path ./demos\*); do echo $(egrep "(Free Software.*version|CDDL-|Apache)" $F||echo "UNKNOWN") -- $F -- $(git shortlog -s $F|awk '{$1="";print}') ; done | sort
# as published by the Free Software Foundation; either version 2 -- ./difffolded.pl -- Brendan Gregg
# as published by the Free Software Foundation; either version 2 -- ./stackcollapse-bpftrace.pl -- Jose Fernandez Peter Sanford
@ardentperf
ardentperf / psqlrc.sql
Created May 8, 2019 16:47
ardentperf psqlrc
-- Jeremy Schneider's psqlrc http://ardentperf.com
--
-- see also https://www.citusdata.com/blog/2017/07/16/customizing-my-postgres-shell-using-psqlrc/
--
\set QUIET 1
select case when count(*)=0 then 'select ''not-aurora'' as avers'
else 'select aurora_version() as avers'
end as aurora_version_query
from pg_settings where name='rds.extensions' and setting like '%aurora_stat_utils%' \gset