Earlier quoted context omitted.
SQLite has what they "call a covering index", see point 9 here: https://www.sqlite.org/optoverview.html My impression is that this mechanism is less general than what one finds in full-fat client-server SQLite databases.
Ya if my reading is correct this is the poor man's covering index: if all the requested data is in the index key the query will not hit the table, so you can add additional fields at the end of the key to get index-only scans (at a cost, also some flexibility cost e.g. doesn't work with unique indexes). I guess it's less of an issue in sqlite than in databases with richer datatypes in the sense that all datatypes are…
Distributed SQLite: Paradigm shift or hype?
141–150 of 165 posts
Re: Distributed SQLite: Paradigm shift or hype?
#142I think this skips one mega benefit for apps. I’ve been using liteFS in production for a couple months. Your web app is able to resolve db queries instantly. You don’t need loading states if you’re using complex charts and other frontend JS that waits for data. All the data is resolved so fast and you can just return all your data like more traditional apps, and the load times are insane. If you’re multi region you c…
You can run postgres on the same host as the web server too. Isn't that going to get you most of that same benefit in speed?
Re: Distributed SQLite: Paradigm shift or hype?
#143Earlier quoted context omitted.
Ya if my reading is correct this is the poor man's covering index: if all the requested data is in the index key the query will not hit the table, so you can add additional fields at the end of the key to get index-only scans (at a cost, also some flexibility cost e.g. doesn't work with unique indexes). I guess it's less of an issue in sqlite than in databases with richer datatypes in the sense that all datatypes are…
can you elaborate? I was living under impression that what sqlite has, is exactly what covering index is...
CREATE INDEX tab_x_y
ON tab(x) INCLUDE (y);Re: Distributed SQLite: Paradigm shift or hype?
#144Earlier quoted context omitted.
SQLites handling of dates is pretty kludgy. It stores them as strings, so to do something like extract just the year from a date, you have to do 'CAST(substr(game_date,0,5) AS INTEGER).' Hackish and error prone.
It is a fairly low level abstraction, but one that does not require a verbose api. There is nothing error prone or hackish about what you have written, it will work for all inputs, it is just low level. You are just used to having other people write this code for you and give you a library. With newer versions of SQLite you could also write CAST(strftime(“%Y”, game_date)) as INTEGER Which is somewhat higher level and…
Still, having that all over a query looks ugly. SQL is can be unreadable enough as it is without all the joins/table renaming.
I just want something more readable like EXTRACT(year from date), like you can in Postgres et al.
Would also be nice if there was a native timestamp like there is in, pretty much every other database.
I'm sensitive to "feature creep" but this doesn't seem like too big of an ask.
Re: Distributed SQLite: Paradigm shift or hype?
#145Earlier quoted context omitted.
Ya if my reading is correct this is the poor man's covering index: if all the requested data is in the index key the query will not hit the table, so you can add additional fields at the end of the key to get index-only scans (at a cost, also some flexibility cost e.g. doesn't work with unique indexes). I guess it's less of an issue in sqlite than in databases with richer datatypes in the sense that all datatypes are…
can you elaborate? I was living under impression that what sqlite has, is exactly what covering index is...
- it's not constrained (e.g. to be orderable)
- it does not affect the behaviour of the index, so you can have covering data in a UNIQUE index, or in a PK constraint (although for the latter one might argue a clustered index is superior)
- it only takes space in leaf nodes, not interior nodes, so you can have better occupancy of interior node pages, less pages to traverse during lookup, and they have better cache residency
- and finally the intent is clearer, when you put everything in the key it does not tell the reader what's what and why it there, and thus makes it harder to evaluate changes
Re: Distributed SQLite: Paradigm shift or hype?
#146Something I've been thinking about is partitioning my SQLite. Instead of storing all user's data in one mega table, what if I made a SQLite database for each user? Provided users never talk to each other, I think this might work?
If you want to query across users, which you probably want for analytics, that is going to be a massive PITA.
Re: Distributed SQLite: Paradigm shift or hype?
#147I think this skips one mega benefit for apps. I’ve been using liteFS in production for a couple months. Your web app is able to resolve db queries instantly. You don’t need loading states if you’re using complex charts and other frontend JS that waits for data. All the data is resolved so fast and you can just return all your data like more traditional apps, and the load times are insane. If you’re multi region you c…
You can run postgres on the same host as the web server too. Isn't that going to get you most of that same benefit in speed?
SQLite, on the other hand, skips all of that with its simple in-process model.
Re: Distributed SQLite: Paradigm shift or hype?
#148LiteFS author here. I don't disagree with any points in the article but perhaps a reframing could help. I previously wrote a tool called Litestream that would do disaster recovery for a single-node SQLite server and I still think it's a great default option for people starting new projects. Unless you're doing very database-specific things, most SQL will carry over between SQLite and Postgres and MySQL, especially if…
SQLites handling of dates is pretty kludgy. It stores them as strings, so to do something like extract just the year from a date, you have to do 'CAST(substr(game_date,0,5) AS INTEGER).' Hackish and error prone.
Re: Distributed SQLite: Paradigm shift or hype?
#149We have so many distributed X applications nowadays that all try to solve the same problem, either in the same or different ways. I think we first have to come up with a simple, distributed, open-source storage solution. In the cloud, we have things like AWS S3, which is a very reliable distributed storage, but for self-hosting, we have: Ceph, with which I have much experience, is a very solid and quite bulletproof s…
[1] https://www.tigrisdata.com/ [2] https://github.com/tigrisdata-archive/tigris
Re: Distributed SQLite: Paradigm shift or hype?
#150Something I've been thinking about is partitioning my SQLite. Instead of storing all user's data in one mega table, what if I made a SQLite database for each user? Provided users never talk to each other, I think this might work?
at least for awhile this is how bluesky/atproto worked. afaik they only ran into issues when the number of users on each server overwhelmed how many files would fit comfortably in a single directory (which is obviously a large number) https://news.ycombinator.com/item?id=38171322