torrents.csv/scripts/sqlite_performance_test.sh

54 lines
1.5 KiB
Bash
Raw Normal View History

#!/bin/bash
# Remove quotes
sed 's/\"//g' ../torrents.csv > torrents_removed_quotes.csv
sqlite3 -batch test.db <<"EOF"
2018-12-02 18:48:26 +00:00
create table torrents(
"infohash" TEXT,
"name" TEXT,
"size_bytes" INTEGER,
"created_unix" INTEGER,
"seeders" INTEGER,
"leechers" INTEGER,
"completed" INTEGER,
"scraped_date" INTEGER
);
.separator ";"
.import torrents_removed_quotes.csv torrents
2018-12-02 18:48:26 +00:00
UPDATE torrents SET completed=NULL WHERE completed = '';
EOF
echo "Ripgrep time for pearl jam"
time rg -i "pearl.*jam" ../torrents.csv > /dev/null
echo "Sqlite3 time"
2018-12-02 18:48:26 +00:00
time sqlite3 test.db "select * from torrents where name like '%pearl%jam%' limit 10" > /dev/null
echo "Ripgrep time for avengers infinity"
time rg -i "avengers.*infinity" ../torrents.csv > /dev/null
echo "Sqlite3 time"
time sqlite3 test.db "select * from torrents where name like '%avengers%infinity%' limit 10" > /dev/null
echo "Ripgrep time for w"
time rg -i "w" ../torrents.csv > /dev/null
echo "Sqlite3 time"
time sqlite3 test.db "select * from torrents where name like '%w%' limit 10" > /dev/null
echo "Ripgrep time for prestige 2006"
time rg -i "prestige.*2006" ../torrents.csv > /dev/null
echo "Sqlite3 time"
time sqlite3 test.db "select * from torrents where name like '%prestige%2006%' limit 10" > /dev/null
2018-12-02 18:48:26 +00:00
echo "Ripgrep time for why"
time rg -i "w" ../torrents.csv > /dev/null
echo "Sqlite3 time"
time sqlite3 test.db "select * from torrents where name like '%why%' limit 10" > /dev/null
rm test.db
rm torrents_removed_quotes.csv