5 ms·
How SQLite Is Tested
- ckastner 5y agoIt's a great read, but it got posted quite often here. Some of the previous posts have longer comment threads. https://hn.algolia.com/?q=how+sqlite+is+tested https://hn.algolia.com/?q=how+sqlite+is+tested
- dang 5y agoPast related threads. I feel like there must have been something else since 2016? How SQLite Is Tested - https://news.ycombinator.com/item?id=11936435 https://news.ycombinator.com/item?id=11936435 - June 2016 (57 comments) How SQLite Is Tested - https://news.ycombinator.com/item?id=9737754 https://news.ycombinator.com/item?id=9737754 - June 2015 (1 comment) How SQLite Is Tested - https://news.ycombinator.com/item?id=9095836 https://news.ycombinator.com/item?id=9095836 - Feb 2015 (17 comments) How SQLite is tested - https://news.ycombinator.com/item?id=6815321 https://news.ycombinator.com/item?id=6815321 - Nov 2013 (37 comments) How SQLite is tested - https://news.ycombinator.com/item?id=4799878 https://news.ycombinator.com/item?id=4799878 - Nov 2012 (6 comments) How SQLite is tested - https://news.ycombinator.com/item?id=4616548 https://news.ycombinator.com/item?id=4616548 - Oct 2012 (40 comments) How SQLite Is Tested - https://news.ycombinator.com/item?id=633151 https://news.ycombinator.com/item?id=633151 - May 2009 (28 comments)
- ckastner 5y ago> I feel like there must have been something else since 2016? Funny, that was my feeling as well. I'm 99% sure to have read a discussion on this here, but all submissions after 2016 (apart from today's) have no comments at all, hence also no comments linking to the older discussion. Edit: Removed the remark on missing comments. The default search settings do not search for comments.
- zzzeek 5y agoexactly, what's the mechanism by which this keeps getting posted individually (a time limit I assume)? it almost seems like marketing spam at this point.
- dang 5y agoThe mechanism is simple: people keep running across it and finding it interesting. It's not spam, it's just the statistical cloud at work. On HN, reposts are fine when a story hasn't had a significant thread in a year or so (see https://news.ycombinator.com/newsfaq.html https://news.ycombinator.com/newsfaq.html). So it's certainly ok after 5 years! Though I'd swear we'd seen more threads than that...
- hinkley 5y agoMaybe a different marketing spam. I almost posted a video to Reddit last week that popped up on YouTube. It was an older video, by someone I’ve watched before, might have been one I’ve already seen, but there it was. I got distracted and didn’t. Three hours later, someone else posted it. It could be pure coincidence, but more likely The Algorithm was trying to shake things up and sent fifty, a hundred, a thousand of us the same old url.
- Lhiw 5y agoSQLite is the most underrated database of all time. I know it's popular, but nowhere near to the level it should be.
- jerodsanto 5y ago"SQLite is likely used more than all other database engines combined" So, like, even more popular than that?! https://www.sqlite.org/mostdeployed.html https://www.sqlite.org/mostdeployed.html
- rmbyrro 5y agoWhy so? I have the impression every developer relies on it for a lot of local stuff, and many libraries also use it locally in users' machines for persistence needs. What do you think it "should be" and is missing?
- chaxor 5y agoI think they have this perspective because SQLite is almost never mentioned when DBs are discussed. Almost everyone pushes postgres, which I think is often a bit insane. Postgres or (often rarely) MySQL is given as the answer to most DB questions, even when coming from clearly new devs. It's not often that the dev needs any of the large amount of setup/permissions required for postgres/MySQL. The fact that SQLite comes as part of python's standard library should be used as second nature for most devs. I feel the same way - that SQLite should be the default answer, and one should reach towards postgres or MySQL unless you really *have* to.
- cortesoft 5y agoWhat? SQLite is rarely the answer to replace Postgres or MySQL... it is not designed for network access nor high availability.
- chaxor 5y agoMost of the answers I was referring to are miles away from those requirements. Postgres fanbois love to suggest it for everything - for which ahuge percentage of the time is simply 'This csv is too big, how do I load part of it?'. The suggestion of Postgres is very often not required, because there isn't a need for multiple users, different permissions, password protection, etc.
- kingcharles 5y agoI would say this sums it up: > the SQLite library consists of approximately 143.4 KSLOC of C code. (KSLOC means thousands of "Source Lines Of Code" or, in other words, lines of code excluding blank lines and comments.) By comparison, the project has 640 times as much test code and test scripts - 91911.0 KSLOC. How does SQLite compare for bugs in comparison to other DBs? How much are the other players paying out in bug bounties?
- tmp_anon_22 5y agoAnd how many of those lines of tests are simply autogenerated?
- xmaayy 5y agoI hope most of them, 91 million lines of code is insane
- nmz 5y agoHe talks about it in the corecursive[1] podcast. No mention of code bounties anywhere. https://corecursive.com/066-sqlite-with-richard-hipp/ https://corecursive.com/066-sqlite-with-richard-hipp/
- egeozcan 5y agoI remember reading someone here explain the extensive number of tests the oracle database has and how implementing a feature is more of a waiting for tests to fail game rather than writing code. I couldn't find it now, maybe I'm misremembering. Especially after reading the MySQL post yesterday[0], I don't know what to expect anymore. Does anyone have anything to say about the testing story of Postgres? [0]: https://news.ycombinator.com/item?id=29455852 https://news.ycombinator.com/item?id=29455852 edit: found it https://news.ycombinator.com/item?id=18442941 https://news.ycombinator.com/item?id=18442941
- Aeolun 5y ago90 million lines of test code? That seems ridiculous to me. I can’t imagine what would lead to so many lines, but I strongly doubt it’s all actually source code.
- postalrat 5y agoThen one day a better embedded db comes along and people forget about sqlite.
- deleted 5y ago[deleted]
- lifeisstillgood 5y agoMaybe. But we learn from the sheer hard work put into this level of testing. And having this level of testing makes you put a bit more effort into each new line. The bar has been raised. If someone is to make a better embedded DB, they will have to maintain it at least as well as this. (PS I feel embarrassed by my own testing failures when reading this).
- henning 5y agoSince SQLite is in every iOS and every Android device along with the Python standard library, I don't think it will be forgotten quickly.
- zepto 5y agoSuch as?
- karmasimida 5y agoThat DB better inherit those test cases however, those are incredible assets
- yung_steezy 5y agoI use sqlite every day at work as a web dev. I do a lot of work with file uploaders and being able to import CSV files as tables I can query is a killer feature.
- Dangsucks2 5y agoUnfortunately SQLite was developed by a religious extremist for use on war ships. (Try to reconcile those two facts...)
- uvdn7 5y agoIn SQlite's source code, it has the following comment. 2001 September 15 The author disclaims copyright to this source code. In place of a legal notice, here is a blessing: - May you do good and not evil. - May you find forgiveness for yourself and forgive others. - May you share freely, never taking more than you give. SQLite is _the_ most amazing database in my opinion. (Not the most amazing distributed database for obvious reasons). It strips away all the connect and network IO management, and focuses on the actual database. It's _the_ most deployed and used database in the world (it's even running outside of the Earth). Because of its wide distribution, it has to be very well tested. It's much harder to fix a bug on client (comparing to on server). Dr. Hipp is amazing. I wish more people are like him.
- hi41 5y ago>> the project has 640 times as much test code and test scripts - 91911.0 KSLOC. This is amazing. One of the reasons some of the developers don’t write extensive test code is because it can cause delays in the deliverables and miss deadlines. How is the sqlite team able to write such a large number of test cases and not miss deadlines?
- hawk_ 5y agoOne reason I suspect is that it's a well defined product. The "spec" is quite well specified at this point. When changes are made existing tests just need to catch regressions, not be changed extensively due to changed meaning of existing primitives. Projects with significant spec/feature churn can't do the same.
- layer8 5y ago> not miss deadlines SQLite doesn’t really have market pressure, so they can choose any deadline such that it provides adequate time for writing test code — assuming they set deadlines at all.
- sophacles 5y agoTangential: I've seen a couple SQLite articles today. Did I miss some cool related news?
- rolandog 5y agoI got the impression that this may have been posted because other fellow HN'ers mentioned it in the "How GNU coreutils are tested" thread.
- mattalex 5y agoAt what point does it just become easier to prove the semantics with e.g. VeriFast or frama-c?
- joshspankit 5y agoOne thing I was kind of surprised about while reading through this massively humbling post: if there’s a bit flip in a value in a closed DB the value just changes? Like, there’s no checksum or error correction in an SQLite DB?
- detaro 5y agoThat's fairly normal for database systems. E.g. in postgres it's also an optional thing that needs to be enabled, and afaik MySQL doesn't have it either (it has an explicit "calculate a checksum for this data" command, which e.g. can be used to verify replication or backups, but no live checksumming)