From 6787e782dab1a8ca746ac81ef5c15757e55d55b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= Date: Thu, 17 Feb 2022 22:18:23 +0100 Subject: [PATCH] Add an index on the full_insee field This DB is mostly used to retrieve all the street names for a given city. Adding an index for the full_insee field greatly improves the query time. Without the index: time $(echo 'select * from fantoir where full_insee="65054";' | sqlite3 fantoir.sqlite) real 0m2,230s user 0m1,896s sys 0m0,337s With the index: time $(echo 'select * from fantoir where full_insee=65054;' | sqlite3 fantoir.sqlite) real 0m0,148s user 0m0,126s sys 0m0,024s --- scripts/gen-fantoir.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/gen-fantoir.sh b/scripts/gen-fantoir.sh index fd3b0aa..2cb2bee 100755 --- a/scripts/gen-fantoir.sh +++ b/scripts/gen-fantoir.sh @@ -17,14 +17,16 @@ trap clean_tmp EXIT tmpCsv="${tmpDir}"/fantoir.csv tmpSql="${tmpDir}"/import-fantoir.sql -echo "Generating fantoir CSV" +echo "[+] Generating fantoir CSV" cargo run --release -- "$1" > "${tmpCsv}" -echo "Generating fantoir SQLite DB" +echo "[+] Generating fantoir SQLite DB" cat >"${tmpSql}" <