Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pure SQLite approach, with generate_series #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 8 additions & 0 deletions bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 13 additions & 0 deletions load.sql
Original file line number Diff line number Diff line change
@@ -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);