5 ms·
it's important to note that the author of SQLite wasn't "competing" with RDMS engines -- it's competing with flat file access. To that goal, I think it's wildl
by dijit 6y ago
it's important to note that the author of SQLite wasn't "competing" with RDMS engines -- it's competing with flat file access.
To that goal, I think it's wildly successful, instead of writing files I almost always reach for SQLite first.
When systems share a database, I, like you, reach straight for postgresql. Most people reach for mysql, which I do not prefer.
- Quarrelsome 6y agoYe I believe its best to think of Sqlite not as a database per se but more as a file format, kinda as you would a word doc but a file format that doesn't suck and is absolutely amazing at storing information.
- lucioperca 6y agoIf it is mostly text, then I would say git is better suited.
- Quarrelsome 6y agogit is ACID? I still believe Sqlite is the appropriate store. Unless.. does Git handle power issues elegantly? What happens if you yank power in the middle of a commit? Sqlite is designed to handle that.
- lbruder 6y agothat's one of the reasons I love Fossil so much. Way better backend than Git.
- utxaa 6y agoone of my team members really pushed fossil, and we did like the integrated wiki/ticket system. not bad at all. ... but it was so slow compared to git! at everything. merging, pushing, pulling ... you did not experience same?
- megous 6y agoLet's see: - A - yes, update HEAD/branch text file is the key atomic update - C - not sure how to apply this in the context of git, because commited files' content is kinda free form by design, no schema, no consistency problems - I - there should not be concurrent use of commands, so no. practically this is mostly important for pushing to remote repository, and there it's handled by rejecting the push that comes second, if you make two commits from the same base and push them at the same time - D - yes
- hodgesrm 6y agoAnd retrieving it, too.
- jxi 6y agoIf competing with flat files, and assuming you don't need concurrency, I don't think it's better than just using one or more json or csv files. Those are much easier to manipulate and manage (same benefits in terms of admin and backup), and you don't need to use a database driver in your code.
- mumblemumble 6y agoEven when systems don't share a database, if operational concerns - disaster recovery, failover migrations, metrics and monitoring, anything like that - matter to me, I'm reaching for PostgreSQL or MS SQL Server. I hear I also need to get over my 20 year old grudge against MySQL. SQLite is really only my first choice for hobby projects and desktop apps that aren't running on the JVM.
- eric_h 6y ago> I hear I also need to get over my 20 year old grudge against MySQL. I hear this too - but silently truncating my data (causing a great deal of data loss and grief for me) is likely going to continue to bias me against MySQL for the foreseeable future.
- johannes1234321 6y agoThat was configurable for ages and default is on strict for a long time now ... Compatibility with old decisions vs. doing the right thing™ is always a pain ...
- eric_h 6y ago> That was configurable for ages and default is on strict for a long time now I'm not saying I'm being rational in holding my grudge. I got bit by that "bug" _bad_ early in my career and the scar tissue lingers.
- chris37879 6y agoI actually saw a really interesting article (probably on here) a while back about using SQLite files as your applications' document storage model, and I really like it. Like if you wrote a word processor, you could include a table of edits that would let you recreate Google Doc's timeline feature, among other things. I thought that was a really neat idea.
- simonw 6y agohttps://www.sqlite.org/appfileformat.html https://www.sqlite.org/appfileformat.html
- derefr 6y agoApple's Core Data persisted-object-graph engine (kind of like Hibernate, I guess?) uses SQLite as its default storage backend. There is a lot of macOS/iOS software using Core Data who already have "SQLite as an application document storage model" without even realizing it.
- bhl 6y ago[1] https://actualbudget.com/blog/porting-local-app-web https://actualbudget.com/blog/porting-local-app-web [2] https://news.ycombinator.com/item?id=23508923 https://news.ycombinator.com/item?id=23508923
- crazypython 6y agoFirefox uses SQLite for localStorage. When Firefox is force quit, the database becomes corrupted. https://bugzilla.mozilla.org/show_bug.cgi?id=1341070 https://bugzilla.mozilla.org/show_bug.cgi?id=1341070 This bug has occurred to me personally multiple times. Does it really have advantages over a flat file?
- edoceo 6y agoif you're corrupting sqlite files you're for sure going to corrupt other formats in a force quit situation.
- astrobe_ 6y agoThis is quite surprising. SQLite is also used in embedded where you don't have comparatively civil "forced quits" but also straight power offs. SQLite seems to do everything it can to handle this gracefully.
- throwawayboise 6y agoI use Firefox almost exclusively and have never encountered this. Whatever capabilities SQLLite has to recover corrupted or inconsistent storage, it certainly exceeds what you get with flat files (none, unless you implement it yourself).
- btilly 6y agoPer that bug report, you are likely to encounter it at https://codesandbox.io/s/sentry-js-sdk-unhandled-promise-fuq2h?file=/src/index.js https://codesandbox.io/s/sentry-js-sdk-unhandled-promise-fuq.... Which suggests an application error to me. I'd give decent odds to the real problem being some bounds check or pointer writing to the wrong place. To prove it, I'd instrument SQLite to log every single query that it was asked to do, then try to run those queries outside of the application. If the queries work fine, then the copy of SQLite in the application is being corrupted somehow. In which case it really isn't fair to blame SQLite.
- mcdevilkiller 6y ago
- 0xEFF 6y agoFor context, before the rise of SQLite, BerkeleyDB was often used for local file databases. I never programmed for berkelyDB but I don’t believe it was SQL, so I think that’s what made SQLite so successful. The combination of an SQL api backed by local files
- setpatchaddress 6y agoBerkeleyDB was a key/value store. I'm not sure how much uptake it actually had vs other solutions. Prior to widespread availability of SQLite3, it was not unheard of to write your bespoke format if you needed something sophisticated.
- 0xEFF 6y agoMy exposure to BDB was through sendmail, spam assassin, and subversion. All three a big chunk of my job in 2006.
- xdeepak81 6y agoBerkleyDB is NoSQL and is internally used in popular No-SQL solution like DynamoDB.