r/programming • u/StellarNavigator • Sep 10 '24
SQLite is not a toy database
https://antonz.org/sqlite-is-not-a-toy-database/255
u/Apoema Sep 10 '24 edited Sep 10 '24
I am a data scientist. I use a bunch of datasets that are mostly read only and infrequently used I found that the simplicity and flexibility of sqlite is a lot better for me than using something like postgresql.
181
u/keepthepace Sep 10 '24
I think it was SQLite's author who was saying that there is a misunderstanding about his lib. It is not a competitor to DBs like MySQL or postgres, it is a competitor to open(...) and file IO.
SQLite is not a database, it is a lib to do SQL requests to a local file.
DBs handle concurrency and this is their main feature and their main problem. SQLite does not handle it and does not care. And neither should you if you only have one user at the time.
63
u/anti-state-pro-labor Sep 10 '24
This is a great call-out and fits with how I understand SQLite. It's a wrapper over a file that just so happens to be a SQL interface. Glad to hear it's not far off from the intent of the lib!
38
u/xebecv Sep 10 '24
SQLite allows multiple processes safely write to the database (provided file locking works properly) and it provides atomic transactions using journaling, allowing for process crash resilience, so it's pretty much a database - not just "a lib to do SQL requests to a local file". What it lacks is the ability to be a distributed database. Backups, synchronization and failovers are on you
→ More replies (5)13
u/Kaelin Sep 10 '24
SQLite does not support parallel writes.
8
u/crozone Sep 11 '24
No, but it locks the database for you so that they're serialised safely.
→ More replies (1)21
u/tom-dixon Sep 10 '24
DBs handle concurrency and this is their main feature and their main problem. SQLite does not handle it and does not care.
That's false.
https://www.sqlite.org/draft/faq.html#q5
Q: Can multiple applications or multiple instances of the same application access a single database file at the same time?
A: Multiple processes can have the same database open at the same time. Multiple processes can be doing a SELECT at the same time. But only one process can be making changes to the database at any moment in time, however.
SQLite uses reader/writer locks to control access to the database.
...
However, client/server database engines (such as PostgreSQL, MySQL, or Oracle) usually support a higher level of concurrency and allow multiple processes to be writing to the same database at the same time. This is possible in a client/server database because there is always a single well-controlled server process available to coordinate access. If your application has a need for a lot of concurrency, then you should consider using a client/server database. But experience suggests that most applications need much less concurrency than their designers imagine.
They also have WAL-mode, which allows really fast operation when there's many concurrent readers and writers. Orders of magnitude faster than
fopen()with manual locking.→ More replies (3)→ More replies (2)5
u/Apoema Sep 10 '24
I do believe that is the case and for a long time I was naively trying to use postgresql for one of my large datasets, it was a pain to setup and almost every time I was going to use it postgres had updated and nothing was working properly, it was also a pain to backup and restore.
I finally resolved to just use sqlite and break the database up in different files depending on years and that basically solved all my problems.
→ More replies (3)29
u/TheBananaKart Sep 10 '24
Pretty much my goto unless I know something will have a-lot of concurrent users. Works really well for a sales-estimation app I’ve made for work since I don’t have the bother of dealing with IT just put the file on a shared drive and alls good. Also works great for data logging for industrial applications, used in a few SCADA projects.
→ More replies (1)6
u/syntaktik Sep 10 '24
How are you handling the concern in the FAQ: https://www.sqlite.org/faq.html on section 5? No concurrency issues at all?
→ More replies (10)24
u/TheBananaKart Sep 10 '24
Simple we have like 3 engineers, normally only one is estimating at a time 😂 GO and my setup makes it fairly trivial to migrate the DB to something like postgres if it becomes an issue.
29
u/JustFinishedBSG Sep 10 '24
You need to try duckdb
3
u/darkcton Sep 10 '24
We're likely going to try it soon. Is it good? How easy is it to host?
11
u/FujiKeynote Sep 10 '24
DuckDB is insanely good. To me, they've ticked all the checkboxes for what makes a piece of software great. Self-contained, smart design choices, great language bindings, and zero fluff.
A lot of it feels like magic, and part of that magic is in the fact there's no bloat and no added complexity to the stack. I actually have had legitimate use cases for extremely wide tables (bioinformatics at scale, you have like 60k genes in rows and an arbitrarily large number of datasets and samples in columns) and DuckDB chews through it like a champ.
And no need to think about your indexing strategy! Well, I guess almost no need—it does support explicit indexing—but for the vast majority of cases it "just works."They also hit 1.0 recently, I can't name a reason not to use it.
→ More replies (1)13
→ More replies (1)3
u/leros Sep 10 '24
I build small mostly read-only datasets (< 100MB). I'll put them in sqlite and even commit them to git alongside my code.
107
u/EmergencyLaugh5063 Sep 10 '24
I worked at a company that stored hard drive backups in a sqlite database. What originally started as a quick way to get the product to market turned into a 10+ year abusive relationship.
I have a lot of respect for sqlite as a result. It processed enormous amounts of data and we were often limited more by just the speed of our drives than the database technology.
However, before adopting it developers should carefully consider what their long-term plans are. If they predict constant growth and a need to scale their solution then sqlite may not be the best solution and I would recommend just biting the bullet and going with something that has scaling in mind from the start.
For example:
At that company we reached a point where we needed concurrent access because we needed to start separating workloads amongst different processes. So we enabled WAL mode. At the time WAL mode was still kind of new so it's probably a lot better now, but we started to run into pretty big issues with checkpointing not working. This resulted in .wal files growing to sizes far larger than we were comfortable with and then when we finally forced a checkpoint the database would become unusable for long periods of time while it tried to process the large .wal file. WAL mode is simply not a solution to the concurrent access problem, it's more of a workaround and it comes with some additional costs to consider.
3
Sep 11 '24
Why is it so hard to migrate a database? Isn't it just
go offline mysqldump ... > db.sql CREATE DATABASE db mysql ... db < db.sql go online?
89
Sep 10 '24
Sharded SQLite is very common for systems that require embedded data stores. It’s far from a toy, it was also designed for computerized missiles
54
u/avdgrinten Sep 10 '24
I'm a bit confused by the title. Why would it be a toy?
sqlite is the right solution if you need the processing offered by a database (say, CRUD operations, ACID semantics, queries) but you don't need a remote database because only a single service will ever connect to it anyway.
55
u/kherven Sep 10 '24
Some people who have worked exclusively with the "big" databases are sometimes horrified to see SQLite being used. It hits their ears the same way "We use a text file for our database" might to yours.
Of course that isn't a fair assessment, but I'm assuming that's the kind of person the article's assertion is trying to get through to.
→ More replies (5)20
→ More replies (1)2
14
u/Weird_Suggestion Sep 11 '24
Here is what SQLite authors have to say about when and when not to use SQLite. https://sqlite.org/whentouse.html
10
u/gnahraf Sep 10 '24
Yes. Also used at scale as units of sharded data both locally (e.g. on Android) and in the cloud (e.g. a db per user to store "user-state" on a game app or platform.) The sharding can be applied in other areas too. E.g. a db per game instance where players take turns to play. The basic requirement for such scaling is that the data flow is organized in such a way that there is at most one writer per db.
2
u/turbothy Sep 10 '24
(e.g. a db per user to store "user-state" on a game app or platform.)
Ooh. Neat idea.
2
u/Fabiolean Sep 11 '24
Web browsers do stuff like this. Use unique SQLite databases for each site you visit to store cookies and user data and more
8
u/FJ_Sanchez Sep 10 '24
It's getting trendy lately with projects like Turso (libsql) and LiteFS. There are also rqlite and Litestream. I recommend reading this https://fly.io/blog/all-in-on-sqlite-litestream/
10
u/hudddb3 Sep 10 '24
rqlite[1] creator here, happy to answer any questions.
4
u/FJ_Sanchez Sep 10 '24
You compare it to multiple other projects in the FAQ but not to Turso DB, how are they different? What do you think of libsql?
3
14
u/wvenable Sep 10 '24
I don't think of it as a toy but I find the fact that (almost) everything is a string to be somewhat toy-like.
8
u/sidneyc Sep 10 '24
Well that's just not true. SQlite has a bunch of supported types.
11
u/wvenable Sep 10 '24 edited Sep 10 '24
That article describes the issue even better. "Flexible typing" for serious projects is not my jam.
→ More replies (8)8
6
u/Takeoded Sep 11 '24 edited Sep 11 '24
SQLite is a perfect tool for you
$ sqlite3
SQLite version 3.45.1 2024-01-30 16:01:20
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE tbl(str STRING);
sqlite> INSERT INTO tbl VALUES('0123');
sqlite> SELECT * FROM tbl;
123
sqlite> My biggest issue with SQLite is that the default affinity type is NUMERIC, it should have been "BLOB".
... used to have 3x of these retarded sqlite behaviors where data would be silently corrupted with no warnings/errors but I can't find my notes :( this is the only one I remember off the top of my head.
Remember one of the SQLite developers saying "we can't fix that now, it would break backwards-compatibility", though. As in, "we can't fix silent data corruption now, it would break apps that rely on silent data corruption."
Edit: found another one!
$ sqlite3 '' "SELECT 'foo' || x'00' || 'bar'" | wc -c
4
(it should have been 7)
sqlite3 '' "SELECT '123'" | wc -c
4
(it should have been 3)
$ sqlite3 '' "SELECT x'00'||'123'" | wc -c
1
(it should have been 4)silent data corruption righ there. Data integrity is not important for SQLite 😔
5
u/Bognar Sep 11 '24
Thanks for this, it was my experience as well. Everyone goes on about performance and reliability, but I find it hard to care when there are basic problems with correctness.
I've used SQLite with wrapper libraries that try to account for these quirks and make it invisible to your chosen language, but I still worry about edge case correctness problems leaking through the abstraction.
28
u/garfield1138 Sep 10 '24 edited Sep 10 '24
We have all been there. "It's just a small project and SQLite will suffice" and 3 days later we're migrating to MariaDB/PostgreSQL.
58
u/vanKlompf Sep 10 '24
We have also been in „make it future proof, use enterprise Postgres”. And project is dead after 3 days
9
u/tothatl Sep 10 '24
Whenever feature creep starts going towards sharing the sqlite database state, the migration should be planned.
If it's not, get away from that rat hole.
3
u/bwainfweeze Sep 11 '24
So here's the trick that most of us miss out on.
Expensive changes that have to be made to retain your existing revenue stream tank your company, and generally negatively affect morale of the people who pay attention.
Expensive changes that have to be made to attract or retain new revenue are costs of doing business. There's new money to pay for the new work. I was about to say, "this is fine" but even I don't entirely believe that. This can be fine. Some people call these, "good problems to have".
"Oh no! We have so many customers we need to upgrade our database so we can keep raking in cash hand over fist! Anyway..."
4
1
8
u/tothatl Sep 10 '24
It's also pretty darn fast.
You can feed it tables of millions of rows and do queries that would bring a lesser professional DB to its knees.
1
u/donatj Sep 11 '24
a lesser professional DB
I guess name the "lesser db". FoxPro or Bento? Sure.
Every time I've migrated from sqlite to mysql or mssql it's been for performance and the gains have been decent , even with the database running on the same machine
-1
u/garyk1968 Sep 10 '24
Not really. I worked in the city for 7 years in finance, we were building reg reporting repositories using mssql. Typical throughout was 10-15 million records per day…that need to be stored for 7 years. Not hating on SQLite as it’s awesome but mssql/oracle/postgresql would easily handle this volume.
→ More replies (4)13
u/bwainfweeze Sep 10 '24
I worked in the city for 7 years in finance
You are not the target audience for this thread. There's a giant space between 'not a toy' and 'golden hammer'.
2
u/LIGHTNINGBOLT23 Sep 11 '24
One of the biggest issues I have with SQLite is that it doesn't support compressed rows/columns by default (not the same as entirely compressing and decompressing the whole database file). There's only a few half-baked extensions to do this, and then there's ZIPVFS which is offered by the SQLite developers, but you have to pay $4000 for it.
→ More replies (2)
2
u/Carighan Sep 11 '24
SQLite is not a toy database
That's just what a toy database would say! 😑
Jokes aside, I feel people aren't all that often even in this situation. I can count on one hand the times I had to introduce a new database without the decision having already been made by some circumstance or another.
2
5
u/scottix Sep 10 '24
I don't think anyone considers it a toy. It depends on the use case and how you plan to use it.
1
3
Sep 11 '24
I think the name is the problem. To me, “lite” makes me think “less than” or “not as good”, which I guess I’ve seen in other products that have been marketed as “lite”.
4
u/MaleficentFig7578 Sep 11 '24
But it is lite. It's very simple, a drop-in library, no complex administration, and with fewer features.
2
u/PabloZissou Sep 10 '24 edited Sep 10 '24
"This is a myth. In the write-ahead log mode (available since long ago), there can be as many concurrent readers as you want. There can be only one concurrent writer, but often one is enough."
That might be the case for some types of applications and very specific ones but that sounds like strong biased information, from that point on how can I know if the rest of the claims are accurate?
SQLite has its uses but it is not useful for everything.
1
1
u/Drakonluke Sep 11 '24
I manage a postgresql database with about a dozen tables and a few hundred records. At this point using postgres seems excessive to me and this post was very convincing. It's important data, but it will never reach millions of rows (it's an IT Hardware, Network and consumables management app for my work). How can I convert the database to sqlite?
1
u/bulletrhli Sep 11 '24
In our case we are adding roughly 3 to 5 million rows a year right now, with the possibility of increasing. We thankfully don't have a lot of traffic but the data is really important to retain long term for analysis. We just use mariadb, mostly due to familiarity. Not quite sure what the best case for us is. We maintain two databases with a total of maybe 10 tables but they are just densely packed. We will never have to change the amount of columns, and we have a decent index setup for our queries but by no means perfect.
1
u/nesh34 Sep 11 '24
So I'm a bit out of the game with respect to starting new professional projects, as I've been in big tech for 6 years.
Please correct me on the following understanding:
If you want an online transactional database that you may want to scale in future, use PostGres.
If you want an offline database (that for example lives on the client device), use SQLLite.
1
u/ElMachoGrande Sep 11 '24
Yep. Sometimes, small and simple is what is needed.
The same goes for Access. I've used Access a lot for single user desktop application with small (say, a few GB) databases, and for "database on file server" applications with few (2-3) users. I only use the database, I build front end in other tools.
I think the problem is that people tend to think in human scales. "My customer database is huge, it has thousands of customers!", when not even millions would count as anything but a small database.
Being able to install a program without having to add a database service, just a database file and some DLLs is a great thing in many cases.
1
u/ProjectInfinity Sep 11 '24
It's a decent database but I really dislike writing applications using it. It's just harder than it should be to avoid concurrency locking issues.
1
u/HoratioWobble Sep 11 '24
I use it for isolation applications and mobile apps quite often. Never had any issues. Never understood the hate for it to be honest.
If you have local, relational data, why wouldn't you?
1
u/audentis Sep 11 '24
I find it funny to say: "When you are [Role], [Technology] is perfect for you". Where's the use case in this consideration?
SQLite is great and I love it, but literally the first statement in the article is something I deeply disagree with.
1
u/Voidrith Sep 11 '24
I have a service that reads in a lot of metrics / telemetry data from a lot of different customers and needs to keep them isolated from eachother due to the wild differences in structure. Every customers dataset is a series of sqlite files, while all the administrative/orchestration is in a single big postgres db
sqlite is great for what i need it for. Its not perfect for everything.
1
u/st4rdr0id Sep 11 '24
100% of the interviewers for backend positions I've encountered don't acknowledge this. Having worked mostly in mobile development, I've worked with ORMs and SQL a lot, and that experience apparently doesn't count as real experience.
1
u/hughk Sep 11 '24
If you use the Adobe product Lightroom for photographic image management and processing uses SQLite. You can even do your own queries in it. The problem is that it isn't designed for multiuser.
1
u/The-Dark-Legion Sep 11 '24
You lost me on "Native JSON". If you store JSON documents in a relational database, you did something wrong along the way.
Normal forms, people. If your data doesn't conform to a schema, you chose the wrong technology!
1
1
u/anacrolix Sep 11 '24
I built this on SQLite, give it a spin (C, Go and Rust bindings provided): https://github.com/anacrolix/possum
1
u/TCB13sQuotes Sep 11 '24
I just want Wordpress to officially support SQLite out of the box. Will work fine for 70% of the WP websites out there.
1
u/crusoe Sep 11 '24
For embedded tough to beat,
But SQLITE is pretty loosey-goosey when it comes to enforcing data types.
Oh, they finally added datatype enforcement in 2021. Cool
1
u/00nu Sep 12 '24
SQLite for simplicity, speed and maintenance.PG when tcp connections are needed (instead of api calls?!)
1
u/AbbreviationsFlat976 Jul 31 '26
Everyone talks about SQLite as the "little guy" of the bunch—and in a way, it is. But people also mistakenly assume that companies with fewer than 50 employees don't exist; there are companies whose databases barely reach 100 MB. There are scenarios where the requirements are simple: a local database for fewer than 10 users that works without an internet connection.
1
u/wjrasmussen Sep 10 '24
Look at that, SQLite is all grown up and out on the town.
Now go get your shinebox.
1
1
u/New_Computer3619 Sep 11 '24
Look left and right around you. If you see an electronic device like your phone, your security camera or even your car, it’s more likely than not that this device use SQLite.
0
u/Aedan91 Sep 10 '24
As is the case with 90% opinionated posts in this community, the answer is "it depends". It's certainly a toy for some use cases, it's more than enough for others.
→ More replies (1)
-110
u/OffbeatDrizzle Sep 10 '24 edited Sep 10 '24
SQLite is a perfect fit for small websites and applications
So it's a toy...
There is a popular opinion among developers that SQLite is not suitable for the web, because it doesn't support concurrent access. This is a myth. In the write-ahead log mode (available since long ago), there can be as many concurrent readers as you want. There can be only one concurrent writer
So it's a toy...
edit: lots of toy fanboys here
8
u/StellarNavigator Sep 10 '24
I guess you've never heard of the legend Pieter Levels! His tech stack is sqlite, javascript, jquery and makes a few millions a year.
-7
u/OffbeatDrizzle Sep 10 '24
What does that have to do with anything? I never said you can't make money with it
17
31
u/Mognakor Sep 10 '24
This may come as a shock to you but there are applications besides web applications.
→ More replies (1)47
u/pojska Sep 10 '24
Some jobs are big, some jobs are small. A good craftsman uses the right tool for the job.
-50
u/OffbeatDrizzle Sep 10 '24
Some hammers are toys, some can down brick walls. How does that contradict anything I said?
37
17
u/pojska Sep 10 '24
It's hard to say where exactly your thought process is going wrong, because you've only said "so it's a toy," which is entirely wrong.
It seems like you're implying that any tool that is not useful for huge websites
software is not a tool, but rather, a toy. This is obviously incorrect. Toy databases exist, just like toy hammers. The key feature of a toy is that it is designed for play, not work. A large inflatable hammer is big, but a toy. A jeweler's hammer is small, but not a toy.SQLite is not a toy database. It is used by professionals to get real work done. In a wide domain, it is the best tool for the job. Perhaps it is not suited for the narrow domain of software you have expertise in.
→ More replies (5)7
u/SnooPaintings8639 Sep 10 '24
I have an app that has extremely static data, i.e. only the admin updates this when the customer needs some new items.
This RO reality, makes my app very easily and cheapliy scalable. Each of my nodes simply loads the db file from the shared resource on boot, and then it just works, very fast, very simple, and SQL compatible. I reload the db by either restart or execution of a dedicated entry point. Add as many nodes as needed.
This is as "toy", as any other "do one thing and do it well" tool.
3
u/davvblack Sep 10 '24 edited Sep 10 '24
idk it seems fine if the next closest solution is "committing json to your repo" for which there are certainly cases for, on the web. Git is a "database" in some sense, and "webscale" in some sense. There are certainly use cases where you may commit some data into a git repo to be used by a highly scalable application.
Those same usecases would compare favorably to times when sqlite might be the correct tool for the job, for example when the changes are slighlty-more-frequent than sldc, but still 'rare'.
I would be hard-pressed to think of a problem where the solution is "maybe postgres, maybe sqlite" but that's not necessarily it's next-most-similar solution.
"Maybe config files, maybe sqlite" is much closer.
1
u/MaleficentFig7578 Sep 11 '24
I would be hard-pressed to think of a problem where the solution is "maybe postgres, maybe sqlite" but that's not necessarily it's next-most-similar solution.
Any web app that only needs a single server, such as a personal blog.
3
u/ub3rh4x0rz Sep 10 '24
Having only one concurrent writer solidifies that it is not the right choice for web. I try to tell juniors who try to XY problem into getting it to work in a web context to just use postgres, and they're like "well that's just too complicated". No, too complicated is trying to manage locking of a pool of size 1 without severely throttling traffic yourself, especially as an inexperienced dev lol.
I do love sqlite for offline analytics of relatively small datasets, where concurrent writing isn't needed
9
u/QueasyEntrance6269 Sep 10 '24
It really depends, most applications are read-intensive. Use the tool that works for you, but especially with WAL mode (where you can read even during a write), one VPS is enough for most applications.
1
u/MaleficentFig7578 Sep 11 '24
sqlite handles locking for you. Remember to set busy_timeout and retry the whole transacion if you get SQLITE_BUSY - it can be because of deadlock prevention which ignores busy_timeout and fails immediately.
-2
u/OffbeatDrizzle Sep 10 '24
Are you agreeing with me? Nobody else does :(
19
u/bawng Sep 10 '24
You might be right that it's the wrong tool for the web but that doesn't make it a toy. Unless everything that isn't web is toys.
→ More replies (1)-23
u/kobumaister Sep 10 '24
Sad to see people so emotional about technology, SQLlite is what it is, and has its (small and specific) use cases. I dont understand why people is downvoting you... Does the toy concept seem too offensive FOR A DATABASE THAT IS NOT INTENDED FOR PRODUCTION?
Get my upvotes.
13
u/Mognakor Sep 10 '24
Where the fuck are you getting that SQLite is not intended for production?
0
u/kobumaister Sep 10 '24
Experience. But let me be more specific: It's not intended for production of any serious project.
Why do you take it so personal? it's just a database.engine for smalls projects.
4
u/Mognakor Sep 10 '24
Experience
So personal opinion.
But let me be more specific: It's not intended for production of any serious project.
Considering the wide spread successful usage of SQLite in serious production systems (likely even the browser you or i use to argue), i think your experience is lacking.
Either you think the companies financing the living for 4 or so developers pay for support of their toy projects or they are stupid for using it in serious software for which it is not intended according to you.
3
5
u/kronik85 Sep 10 '24
lol, what does production mean to you?
It's used everywhere. Mother. Fucking. Everywhere.
-2
u/kobumaister Sep 10 '24
Production means: resilient, stable, predictable and ideally scalable.
if you've seen SQLlite in production, I'm sorry but you are not working with serious products.
5
3
1
u/kronik85 Sep 13 '24
it's "small and specific" use cases are 10,000x more numerous than every mega social-media company in the world. production != big. small != toy. you've got a massively warped perspective of what it means to be production ready.
0
Sep 10 '24
[deleted]
2
u/bwainfweeze Sep 10 '24
How far are you away from worrying about it running out of head room? Have you made design changes to keep it from reaching that point?
0
Sep 11 '24
[deleted]
2
1
u/LesterKurtz Sep 11 '24
I think it has a theoretical storage limit of 4TB. Maybe more since I heard that a few years back.
2
0
Sep 10 '24
[deleted]
3
u/MaleficentFig7578 Sep 11 '24
use sqlite and
create table data (id varchar primary key, json varchar not null);but once you have SQL you may wish for more schema than that, and you can do it.
1
56
Sep 10 '24
[removed] — view removed comment
8
u/SnooPaintings8639 Sep 10 '24
Yes it is. And it definitely needs (and deserves) more love in the space.
0
Sep 11 '24
[deleted]
7
u/MaleficentFig7578 Sep 11 '24
What do NoSQL databases bring that SQL don't? you can always have a table with two columns: ID and JSON
0
Sep 11 '24
[deleted]
2
u/CherryLongjump1989 Sep 11 '24 edited Sep 11 '24
There’s a reason why Google went from BigTable to BigQuery. You don’t hear about BigTable anymore now that you can access it via SQL. Even the platforms you mentioned such as Clickhouse offer a SQL API, as do many that you didn’t mention like Elasticsearch or Singlestore. SQL is not the problem, you’re confusing the query language with an RDBMS. These days if you don’t support SQL then that’s a liability that makes your database less likely to be adopted.
As far as embedded databases such as SQLite or DuckDB, the whole advantage is that you have SQL and ACID properties for every situation that calls for local storage or low-latency in-memory access, where none of your NOSQL solutions would be appropriate. It vastly expands the number of use cases for which a database is appropriate. It’s used for everything from config files to text messaging clients. There’s a reason why SQLite is actually the most prevalent database in existence. You don’t need a team of on-call engineers to administrate and handle server outages for the SQLite database in your iPhone app. SQLite also has the distinction where it’s actually part of standardized file formats, such as for geospatial data used by everyone from consumer to military use cases. People even build offline apps with eventual consistency by using an embedded database that eventually syncs with some server-side data store.
0
Sep 11 '24
[deleted]
2
u/CherryLongjump1989 Sep 12 '24 edited Sep 12 '24
I’m not aware of people choosing BigTable outside of legacy reasons. There are countless more modern alternatives. Internally at Google, where I worked, we used higher level APIs built on top of BigTable, or have been swapped out for better more modern things than BigTable. BigQuery itself is built on top of these intermediary APIs. I’m not sure why someone would choose to use BigTable directly for a brand new project. Maybe they are misinformed?
Moreover, the vast majority of BigQuery users - as well as most other “big data” large distributed database systems - don’t have anywhere close to the amount of dara that justifies their use and complexity. Or if they do have a lot of data, most of it is useless junk and they’re paying tons of money for the privilege of having poor data hygiene.
Neo4J is a great example of a database that is poorly adopted. For as old as it is, countless SQL databases have come after and ran circles around it. There are far more people doing graph queries in databases that support SQL. Neo4J is particularly infamous for having a convoluted API. Plus, graph databases themselves are notoriously difficult to design because different graph problems call for entirely different database designs. Neo4J is the type of system that you end up migrating away from.
I don’t understand a lot of your strawman and goalpost shifting arguments. No one ever said NOSQL can’t be ACID or that in-memory data can’t be organized without an embedded SQL database. I don’t know where you came up with those weird tangents.
I’m glad you’re familiar with MBTiles and such. Look up what the military is doing with it. Your next generation stealth fighter jet isn’t going to be querying an S3 bucket while it’s flying over Iran. You have a bias towards online client-server systems, clearly.
You mock SQLite in message clients but I put up all the messages on every iPhone on the planet against whatever data you can shake a stick at in some “big data” client-server database. And it is faster and lower latency than your best “BigTable” solution. That’s one huge multi-tenant distributed database that you would be killing yourself to try to shove into a client-server solution. That’s what you’re not seeing. You have a bias toward shoving as much data as you can into a single centralized store whether or not it makes any sense to do so. You’re telling me that an embedded SQL database can’t solve a problem of your own creation, and I’m flabbergasted. The embedded database eliminates the problem. That’s why SQLite exists.
19
Sep 10 '24
[removed] — view removed comment
4
u/Habba Sep 11 '24
Yeah this has been my experience too. Having been writing some web services in Rust (because I like the language and these are for fun) I've even found that I don't need multiple workers since the service can easily handle tens of thousands RPS.
If I ever needed to scale this up my plan would actually be just having additional SQLite files/worker pairs, since for my use case that's easy to do.
1
Sep 11 '24
[removed] — view removed comment
5
u/Habba Sep 11 '24
I have been using Axum and been happy with it! It's for building APIs, so only backend, for frontend I have been using it with htmx because it's easy to get interactivity and I don't need to learn JS for it.
If you would want to do full stack in Rust, I have some experience with Leptos and that has been really nice.
As for Rust, it is a very cool language IMO. It will feel really annoying at first coming from Python (it did for me) because it just does not let you do things that are not a problem in Python. For me it clicked when I realized that it was just forcing me to fix bugs while I wrote them instead of having to hunt them down when the program is already running.
1
u/gmes78 Sep 11 '24 edited Sep 11 '24
Axum.
Though, keep in mind that doing web (and async stuff in general) may be a bit awkward as a first Rust project. Axum does some fancy stuff in its API that seems like magic if you're not comfortable with Rust.
1
Sep 11 '24
[removed] — view removed comment
1
607
u/bastardoperator Sep 10 '24
I keep trying to push SQLite on my customers and they just don't understand, they think they always need something gigantic and networked. Even when I show them the performance, zero latency, and how everything is structured in the same way, they demand complexity. Keeps me employed, but god damn these people and their lack of understanding. The worst part is these are 2 and 3 table databases with the likelihood of it growing to maybe 100K records over the course of 5-10 years.