[Csync2] sqlite optimization
Art -kwaak- van Breemen
ard+csync2 at telegraafnet.nl
Tue Aug 26 15:43:51 CEST 2008
This query happens when using -r with csync2:
ard at lain:~$ time sqlite3 /var/lib/csync2/lain.db3 "SELECT filename from file where filename = '%25dslbestanden%25' or (filename > '%25dslbestanden%25/' and filename < '%25dslbestanden%250') ORDER BY filename" |wc -l
44675
real 0m12.265s
user 0m11.590s
sys 0m0.670s
This is what it can be:
ard at lain:~$ time sqlite3 /var/lib/csync2/lain.db3 "SELECT filename from file where filename = '%25dslbestanden%25';SELECT filename from file where filename > '%25dslbestanden%25/' and filename < '%25dslbestanden%250' ORDER BY filename" |wc -l
44675
real 0m0.124s
user 0m0.050s
sys 0m0.040s
It's a 100 fold speed improvement. And my database really is > 10M files...
Now to put the split query back into a single query that's equal.
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in email?
More information about the Csync2
mailing list