Created
June 1, 2022 22:59
Revisions
-
andy-wm-arthur created this gist
Jun 1, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ #!/bin/bash SCALE=100000 if [ ! -z "$1" ]; then SCALE="$1" fi # generate source data cat << DOC > psv_gen.py with open('$SCALE.psv', 'w+') as f: f.write('pk|c0|c1|c2\n') for i in range ($SCALE): s = '{}|{}|{}|{}\n'.format(i,i,i,i) f.write(s) DOC python3 psv_gen.py rm psv_gen.py # use source data to create and benchmark a dolt database rm -rf .dolt DOLT_DEFAULT_BIN_FORMAT="__DOLT_1__" dolt init > /dev/null dolt table import -pk=pk -c difftbl "$SCALE.psv" > /dev/null dolt add -A && dolt commit -m "created difftbl" > /dev/null dolt sql -q "delete from difftbl where pk = 1234;" > /dev/null dolt commit -am "create point diff" > /dev/null echo "benchmarking dolt database (SCALE=$SCALE)" time dolt sql -q "SELECT count(*) FROM dolt_commit_diff_difftbl WHERE to_commit=HASHOF('HEAD') AND from_commit=HASHOF('HEAD^')" > /dev/null echo "" # use source data to create and benchmark a sqlite database rm diff.db diff2.db sqlite3 diff.db "create table difftbl (pk int primary key, c0 int, c1 int, c2 int)" sqlite3 diff.db ".import $SCALE.psv difftbl" cp diff.db diff2.db sqlite3 diff2.db "delete from difftbl where pk = 1234" echo "benchmarking sqlite3 database (SCALE=$SCALE)" time sqldiff diff.db diff2.db > /dev/null echo "" # cleanup rm psv_gen.py rm "$SCALE.psv"