Inserting a billion rows in SQLite under a minute
121–130 of 164 posts
Re: Inserting a billion rows in SQLite under a minute
#122Earlier quoted context omitted.
Yes, if you want to run non-trivial queries on that data. Although, frankly, SQLite would not be my choice.
What would be your choice?
If you just want to browse what other people are using, and not go by the recommendations of a random commenter, try:
https://db-engines.com/en/ranking
but note that's a joint ranking both for transaction-focused and analytics-focused DBMSes.
If it's time series data there are some more specialized offerings and I'm (even) less of an expert there.
Re: Inserting a billion rows in SQLite under a minute
#123Hey all, author here. I didn't expect this to reach front page of HN. I came here to submit and it was here already! I am looking for more ideas to experiment. Here's one idea which someone from another forum gave me: exploring recursive queries and using SQLite random methods to do the insertions. Another crazy idea is to learn about SQLite file format and just write the pages to disk.
Re: Inserting a billion rows in SQLite under a minute
#124# createSQL.tcl
set increment 100000
set loop [expr {100000000 / $increment}]
puts {PRAGMA journal_mode = OFF; PRAGMA synchronous = 0; PRAGMA cache_size = 1000000; PRAGMA locking_mode = EXCLUSIVE; PRAGMA temp_store = MEMORY;
CREATE TABLE user( pk INTEGER PRIMARY KEY, area INTEGER, age INTEGER, active INTEGER );}
for {set i 0} {$i #EOF
Core 2 Duo 2.53 GHz, 4GB RAM, SSD:
$ time -p tclsh createsql.tcl | sqlite3 test.db
off
exclusive
real 213.37
user 208.10
sys 4.58
Re: Inserting a billion rows in SQLite under a minute
#125Re: Inserting a billion rows in SQLite under a minute
#126But the results given are all for inserting 0.1B rows, not 1B rows. What are the full results?
Re: Inserting a billion rows in SQLite under a minute
#127Earlier quoted context omitted.
Ok but that is a rather clickbaity title. The title makes it sound like they are successfully doing that.
Hey, sorry for the misleading title. I started with ‘Fast SQLite Inserts’ and it had many iterations. In the title, I wanted to intend that I want to insert 1 billion rows under a minute on my machine. I thought the current title is fine, since I got LGTM for earlier drafts. The detail about on my machine is also important since mine is a two year old laptop and all the measurements are done on it. Also I got another…
Add "trying":
"Trying to insert 1 billion rows in SQL in under a minute".
If anything it's more interesting because it implies the chance of failure.
Re: Inserting a billion rows in SQLite under a minute
#128Re: Inserting a billion rows in SQLite under a minute
#129The source code can be found here: https://github.com/wuxb45/remixdb/blob/master/i100m.c
$ make i100m.out libremixdb.so
$ numactl -N 0 ./i100m.out
insert time without sync: 24.865s, with sync: 25.801s