Note that the measurements in the paper were made before they fixed a bug where they confused bits and bytes. So SQLite only used 1/8 of the reserved bloom filter space, thus increasing the false positive rate significantly: https://sqlite.org/src/info/56d9bb7aa63043f5 I found and reported the bug because I wanted to know how the bloom filters work in SQLite for my uni seminar paper. Still wondering if one can find t…
How much of a slowdown did you estimate this bug caused?
How bloom filters made SQLite 10x faster
41–50 of 127 posts
Re: How bloom filters made SQLite 10x faster
#42Earlier quoted context omitted.
Sharing between processes? Absolutely. Machines? No. For example, LAMP stack applications could swap the M for SQlite (and I think it would have been better historically if they did).
Sharing between processes isn't impossible but this where you get all of your performance caveats. I think it is a bit unfair to argue against SQLite on performance grounds but then not explore ways to utilize instances of it within a single process scope where it is most effective. Sharing a single SQLite connection across all threads within a process is where you get the best performance outcomes. Everything is ser…
You mean the one where it locks on write? It’s totally fine, if you wrote any cross process code yourself it’s probably going to do similar locking.
Re: How bloom filters made SQLite 10x faster
#43Earlier quoted context omitted.
No, it's indeed a very real problem. I ran into with a very small service.
You want to configure it so it has a timeout. Take turns. That’s how locks work. The only difference between SQLite and Postgres write locking is the granularity.
Re: How bloom filters made SQLite 10x faster
#44They will never have a false negative (and only sometimes a false positive).
We used this to vastly improve render times for comments pages on reddit. We used two tricks. The first was to store the time of your last vote as a first class property on your user object. If you loaded a comments page for a link that was submitted after your last vote, we knew that you couldn't have voted on any of those comments.
But if you had voted afterwards, we had to look up every single comment on the page to see if you had voted on it (we couldn't only do the comments made before your last vote because we didn't know the creation time until after we looked up the comment, and it was faster to just look up the vote).
But with a bloom filter, we could very quickly look up all the comments and get back a list of all the ones you voted on (with a couple of false positives in there). Then we could go to the cache and see if your actual vote was there (and if it was an upvote or a downvote). It was only after a failed cache hit did we have to actually go to the database.
But that bloom filter saved us from doing sometimes 1000s of cache lookups.
Re: How bloom filters made SQLite 10x faster
#45Note that the measurements in the paper were made before they fixed a bug where they confused bits and bytes. So SQLite only used 1/8 of the reserved bloom filter space, thus increasing the false positive rate significantly: https://sqlite.org/src/info/56d9bb7aa63043f5 I found and reported the bug because I wanted to know how the bloom filters work in SQLite for my uni seminar paper. Still wondering if one can find t…
Re: How bloom filters made SQLite 10x faster
#46Re: How bloom filters made SQLite 10x faster
#47> SQLite does Nested Loop join Only that? Never anything better? Really? EDIT: Really. Section titled Joins here https://sqlite.org/optoverview.html states: "SQLite implements joins as nested loops." That's quite shocking. While doing MySQL and Postgres when nested loop showed up in EXPLAIN in almost all cases I knew I botched my query and/or indexes.
As far as i know (might be wrong,im not really familiar with mysql internals), mysql (like sqlite) generally uses nested loop joins all the time. The EXPLAIN just only says something in the join buffer case. When using a simple nested loop join, EXPLAIN does not mention the fact that it is using that algorithm.
Re: How bloom filters made SQLite 10x faster
#48Earlier quoted context omitted.
Sharing between processes? Absolutely. Machines? No. For example, LAMP stack applications could swap the M for SQlite (and I think it would have been better historically if they did).
Sharing between processes isn't impossible but this where you get all of your performance caveats. I think it is a bit unfair to argue against SQLite on performance grounds but then not explore ways to utilize instances of it within a single process scope where it is most effective. Sharing a single SQLite connection across all threads within a process is where you get the best performance outcomes. Everything is ser…
Re: How bloom filters made SQLite 10x faster
#49One way to address this is to recalculate it every n deletes, but this sounds similar to AUTOVACUUM issues in PostgreSQL and might result in unexpected drops in performance
Re: How bloom filters made SQLite 10x faster
#50What happens if the table is one with a big number of deletes? The Bloom filter false positive rate will keep increasing as time goes on. One way to address this is to recalculate it every n deletes, but this sounds similar to AUTOVACUUM issues in PostgreSQL and might result in unexpected drops in performance
My guess though is that many use cases are likely data stores that don't experience deletes at all.