> For device-local storage with low writer concurrency and less than a terabyte of content, SQLite is almost always better.
Isn't MySQL MyISAM faster and this way constitute a better choice for a scientific number crunching application? I mean near 4GB DB, very simple schema, heavy reading load, little/no inserts and no updates.
But then you have to implement all the SELECT and DML logic yourself. SQL makes this a breeze with JOIN, ON UPDATE CASCADE, etc. And being SQL, it is very easy to maintain, even by the PFY that replaces you.
SQLite (also H2 and some other embedded SQL databases) can be used entirely in-memory, one can also drop an SQLite file on a RAM-hosted filesystem (tmpfs/ramdrive). You really can put everything into RAM (and still enjoy SQL) if you have enough, don't mind long cold-load and potential data loss.
I'd argue adding SQL into the mix makes it difficult to maintain, mixed-language codebases are almost by definition complex, and you get significant chafing when mixing a declarative language like SQL and OOP.
Since this is a no-update and no live-insert scenario we're talking about, it's fairly easy to produce code that is an order of magnitude faster than a DBMS, since they're not only primarily optimized for efficiently reading off disk (an in-memory hash table beats a B-tree every day of the week), they've got really unfortunate CPU cache characteristics, and additionally need to acquire read locks.
With a database you generally are loading it into RAM, thanks to caching at the database and/or filesystem level, and you get all of the fun database features more or less for free.
There's a performance hit relative to skipping the database altogether and simply allocating 4GB of RAM and accessing it directly, of course.
I dunno, just felt like conventional (since long ago) knowledge that MyISAM is the fastest of all SQL DBs in simplistic non-RAM scenarios. I'm not sure this is true so I ask.
The engine might be faster (I'm not sure) but SQLite has the advantage that it doesn't have to connect over a socket. Instead you load the SQLite library into your code and your application directly manipulates the database files. That's potentially a lot faster.
Before sqlite is definitely was said to be the fastest, I suspect the two are similar enough that it makes little or no difference these days and sqlite (unless the dynamic typing thing is an issue for you, and even that is going away as recent versions support at least some stricter type enforcement) safer and more “correct” than MyISAM in many ways.
I think the performance MySQL has over sqlite comes from its multithreading more than the storage engine. In my experience sqlite is just as fast as MyISAM for single threaded work.
Isn't MySQL MyISAM faster and this way constitute a better choice for a scientific number crunching application? I mean near 4GB DB, very simple schema, heavy reading load, little/no inserts and no updates.
Continue this thread — 3 replies
Since this is a no-update and no live-insert scenario we're talking about, it's fairly easy to produce code that is an order of magnitude faster than a DBMS, since they're not only primarily optimized for efficiently reading off disk (an in-memory hash table beats a B-tree every day of the week), they've got really unfortunate CPU cache characteristics, and additionally need to acquire read locks.
Continue this thread — 4 replies
There's a performance hit relative to skipping the database altogether and simply allocating 4GB of RAM and accessing it directly, of course.
I think the performance MySQL has over sqlite comes from its multithreading more than the storage engine.
In my experience sqlite is just as fast as MyISAM for single threaded work.
Faster, but at what price?