Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions supabase/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
## Running Supabase Benchmark

```bash
$ export PG_PASSWORD="<PASSWORD>"
$ export SUPABASE_HOST="<HOST>"
$ export SUPABASE_CONNECTION_STRING="[...]"
$ ./benchmark.sh
```

The Supabase host looks something like: `db.oolfrgytrdoculplvizc.supabase.co`
By default, Supabase requires IPv6 connections.
This restriction can be bypassed using the "transaction pooler".
You can get its connection string from the Supabase "Connect to your project" UI.
It looks something like this: `postgresql://postgres.zlltjtdocmcqiqprpunq:[YOUR-PASSWORD]@aws-1-eu-north-1.pooler.supabase.com:6543/postgres`
6 changes: 2 additions & 4 deletions supabase/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ sudo apt-get install -y pigz
wget --continue --progress=dot:giga 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz'
pigz -d -f hits.tsv.gz

psql -h ${SUPABASE_HOST} -p 5432 -d postgres -U postgres -t -c 'CREATE DATABASE test'
psql -h ${SUPABASE_HOST} -p 5432 -U postgres -d test -t <create.sql
psql ${SUPABASE_CONNECTION_STRING} -c 'CREATE DATABASE test'
psql ${SUPABASE_CONNECTION_STRING} -t <create.sql

echo -n "Load time: "
command time -f '%e' ./load.sh
Expand All @@ -30,5 +30,3 @@ command time -f '%e' ./load.sh
cat log.txt | grep -oP 'Time: \d+\.\d+ ms' | sed -r -e 's/Time: ([0-9]+\.[0-9]+) ms/\1/' |
awk '{ if (i % 3 == 0) { printf "[" }; printf $1 / 1000; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }'
echo
echo
echo
4 changes: 2 additions & 2 deletions supabase/load.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ set -eu
# If we dont' do this, Postgres will throw an error:
# "ERROR: cannot perform COPY FREEZE because the table was not created or truncated in the current subtransaction"
# (i.e. Postgres requires that the table be either created or truncated in the current subtransaction)
psql -h ${SUPABASE_HOST} -p 5432 -U postgres -d test <<'EOF'
psql ${SUPABASE_CONNECTION_STRING} <<'EOF'
set statement_timeout = '60min';
BEGIN;
TRUNCATE TABLE hits;
\copy hits FROM 'hits.tsv' with freeze;
COMMIT;
EOF

psql -h ${SUPABASE_HOST} -p 5432 -U postgres -d test -t -c 'VACUUM ANALYZE hits'
psql ${SUPABASE_CONNECTION_STRING} -c 'VACUUM ANALYZE hits'
2 changes: 1 addition & 1 deletion supabase/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ cat queries.sql | while read -r query; do
(
echo '\timing'
yes "$query" | head -n $TRIES
) | psql -h ${SUPABASE_HOST} -p 5432 -d test -U postgres -t | grep 'Time'
) | psql ${SUPABASE_CONNECTION_STRING} -t | grep 'Time'
done