diff --git a/bench.sh b/bench.sh index fa12f10..4363b7c 100755 --- a/bench.sh +++ b/bench.sh @@ -2,6 +2,14 @@ # runs each of the scripts one after another, prints the measurements to stdout export TZ=":Asia/Kolkata" +# benching sqlite cli +rm -rf sqlite3.db +echo "$(date)" "[SQLite] running sqlite3 (100_000_000) inserts" +time sqlite3 sqlite3.db '.read load.sql' +if [[ $(sqlite3 sqlite3.db "select count(*) from user";) != 100000000 ]]; then + echo "data verification failed" +fi + # benching naive version rm -rf naive.db naive.db-shm naive.db-wal echo "$(date)" "[PYTHON] running naive.py (10_000_000) inserts" diff --git a/load.sql b/load.sql new file mode 100644 index 0000000..5c04623 --- /dev/null +++ b/load.sql @@ -0,0 +1,13 @@ +create table IF NOT EXISTS user ( + id INTEGER not null primary key, + area CHAR(6), + age INTEGER not null, + active INTEGER not null +); + +insert into user (area, age, active) +select + abs(random() % 99999) as area, + (abs(random() % 3) + 1) * 5 as age, + abs(random() % 1) as active +from generate_series(1, 100000000);