News for hackers. Stuff that matters.
Re:How the SQLite virtual machine works by avl999 on Wednesday September 07, 2022 @11:49AM (#32752243)
I wonder how an alternate timeline might have played out if Richard Hipp had not named it "SQLite" and instead called it "SQLightning" or "SQLExpress" or something like that. For much of its lifetime, SQLite wasn't taken seriously despite being an extraordinary technology and part of me is convinced it was in large part due to "Lite" being in the name.
Re:How the SQLite virtual machine works by dimitrios1 on Wednesday September 07, 2022 @12:38PM (#32752900)
SQLite has been taken seriously by serious people for decades. We just don't hear about it in the cool, hipster startup circles because it isn't sexy. But it's steadily grown to be the most deployed embedded database in the world, in millions of devices, and have specialized strands that went through military and medical grade formal validations to end up in airplanes, fighter pilots, naval ships, medical devices.

You have to look where SQLite isn't rather than where it is these days.

Re:How the SQLite virtual machine works by tptacek on Wednesday September 07, 2022 @01:16PM (#32753382)
The shift isn't in SQLite being taken seriously behind the scenes, or as a better file format. It's in SQLite being taken seriously as an alternative to n-tier database in full stack applications.
Re:How the SQLite virtual machine works by rrdharan on Wednesday September 07, 2022 @08:15PM (#32759226)
I don’t necessarily disagree but I still get an Upton Sinclair vibe from fly.io folks declaring that this shift is happening as a matter of fact / by fiat.
Re:How the SQLite virtual machine works by tptacek on Wednesday September 07, 2022 @09:13PM (#32759740)
Why? We don't have an SQLite offering; we do Postgres.
Re:How the SQLite virtual machine works by sgbeal on Wednesday September 07, 2022 @01:49PM (#32753778)
> ... in millions of devices...

cough _Billions_ cough with a capital "B". Very nearly every non-trivial electronic device built over the past 10-15 years. (Non-trivial being very roughly: "anything with a UI or having the potential to run one.")

Re:How the SQLite virtual machine works by simlevesque on Wednesday September 07, 2022 @12:13PM (#32752531)
You may already know but it's SQL-ite (sequel-ite), like graphite, dynamite, sulfite.

https://en.wiktionary.org/wiki/-ite

Re:How the SQLite virtual machine works by srcreigh on Wednesday September 07, 2022 @12:20PM (#32752638)
Not even Sequel-ite. But S.Q.L.-ite. That's how Dr Hipp says it, anyways.
Re:How the SQLite virtual machine works by sgbeal on Wednesday September 07, 2022 @01:42PM (#32753678)
FWIW... i've been in Richard's presence several times when he was asked how to pronounce it by various people and he's invariably answered, "pronounce it however you like!" (i belong to the ess-queue-lite school of thought.)
Re:How the SQLite virtual machine works by dec0dedab0de on Wednesday September 07, 2022 @07:37PM (#32758790)
I love when projects have cute puns in the name. I always am sure to correct people so they don't miss out on the fun. Luckily most developers are pedantic and like language enough that they don't get too annoyed with me. Same thing applies to PostgreSQL, it drives me nuts that sqlalchemy is not sqlchemy.

completely off topic at this point, but Jim Cornette reading paid advertisements for codecademy was very funny during the pandemic. He insisted on pronouncing it code-cademy while his co-host tried to correct him.

Re:How the SQLite virtual machine works by avgcorrection on Wednesday September 07, 2022 @05:26PM (#32757181)
Such ambigious names remind of “Rust”. It’s such an um-actually name (um actually it’s not first and foremost about oxidization it’s about fungi…)
Re:How the SQLite virtual machine works by randomdata on Wednesday September 07, 2022 @09:26PM (#32759830)
> it’s not first and foremost about oxidization it’s about fungi…

Um, actually this[1] suggests that it originally wasn't about anything other than seeming like a good name and that any deeper explanation that has been given was made up. Of course, by the same token, "it seemed like a good name" could have also been made up. But it appears that the team eventually embraced it in the oxidization[2] sense.

[1] https://www.reddit.com/r/rust/comments/27jvdt/internet_archa...

[2] https://bugzilla.mozilla.org/show_bug.cgi?id=680521

Re:How the SQLite virtual machine works by avgcorrection on Thursday September 08, 2022 @02:56PM (#32770321)
Um actually I believe more in community consensus with regards to naming provenance as opposed to authorial intent

ad nauseam

Re:How the SQLite virtual machine works by randomdata on Friday September 09, 2022 @11:22AM (#32780317)
Fair, but community consensus is that of oxidization to reflect how the Rust community comes in, takes over, and ruins every discussion about programming by finding some way to mention Rust. It is very much a virtual oxidization process.

Case in point: This discussion was originally about SQLite.

Re:How the SQLite virtual machine works by EGreg on Wednesday September 07, 2022 @05:54PM (#32757508)
I had no idea! I was sure it was “SQL Lite” ever since I heard about it a decade ago. Its support for mostly text strings while MySQL and Postgres supported a myriad types made me think it’s just a small embedded “lite” library for when you wanted to bundle a mostly SQL database with your app lol
Re:How the SQLite virtual machine works by geewee on Wednesday September 07, 2022 @01:55PM (#32753856)
Huh, I had no idea!
Re:How the SQLite virtual machine works by tveita on Wednesday September 07, 2022 @02:04PM (#32753970)
I've used SQLite for toy services "in production", and it was really just as bad as people think it is. Sure, you could handle a large amount of read-only queries, but it only took a tiny bit of write traffic in the mix to make the random latency spikes jarring.

This was pre-WAL, presumably enabling WAL would help a lot (but is still not the default, so beware). But the caveats were real, it's not like people just took one look at the name and though "'SQLite?' I better put a big warning in our documentation to not use this in production."

Re:How the SQLite virtual machine works by LAC-Tech on Wednesday September 07, 2022 @03:19PM (#32755275)
This was pre-WAL, presumably enabling WAL would help a lot

Indeed it would!

"WAL provides more concurrency as readers do not block writers and a writer does not block readers. Reading and writing can proceed concurrently."

https://www.sqlite.org/wal.html

I think the people advocating for SQLite to be used in more places are all assuming write ahead logging is enabled.

Re:How the SQLite virtual machine works by chasil on Wednesday September 07, 2022 @03:24PM (#32755374)
There are many problems with WAL, as acknowledged by Dr. Hipp in the recent olap/duckdb paper.

The chief problem that I see with WAL is that it breaks ACID with databases that are ATTACHed, as the documentation shows:

https://sqlite.org/lang_attach.html

Re:How the SQLite virtual machine works by simonw on Wednesday September 07, 2022 @04:35PM (#32756436)
What are the other problems?
Re:How the SQLite virtual machine works by chasil on Wednesday September 07, 2022 @06:27PM (#32757940)
OK, I'll download the PDF onto my phone and get the quote...

...I forgot how significant these problems are. These are quite serious.

"However, WAL mode has notable disadvantages. To accelerate searching the WAL, SQLite creates a WAL index in shared memory. This improves the performance of read transactions, but the use of shared memory requires that all readers must be on the same machine. Thus, WAL mode does not work on a network filesystem. It is not possible to change the page size after entering WAL mode. In addition, WAL mode comes with the added complexity of checkpoint operations and additional files to store the WAL and the WAL index."

https://vldb.org/pvldb/volumes/15/paper/SQLite%3A%20Past%2C%...

https://news.ycombinator.com/item?id=32684424

Re:How the SQLite virtual machine works by yread on Wednesday September 07, 2022 @06:50PM (#32758204)
It also complicates backups. I have another process that .backups the database but even when opening it in read-only it creates a .wal file. My first version of the backup script didn't delete it afterwards and the normal process didn't have the right to overwrite the backup's wal file so opening the db failed
Re:How the SQLite virtual machine works by chasil on Wednesday September 07, 2022 @07:19PM (#32758565)
Maybe adjust the umask of the backup process?
Re:How the SQLite virtual machine works by gigatexal on Wednesday September 07, 2022 @03:59PM (#32755915)
How often is attach really used though?
Re:How the SQLite virtual machine works by chasil on Wednesday September 07, 2022 @04:34PM (#32756431)
How often are distributed transactions used elsewhere with two-phase commit?

All the time. I suspect this is similar.

Re:How the SQLite virtual machine works by gigatexal on Wednesday September 07, 2022 @05:52PM (#32757493)
Right but that’s bending SQLite a lot no? I mean it’s meant to be used as a file that has a sql interface. But I digress.
Re:How the SQLite virtual machine works by taberiand on Thursday September 08, 2022 @01:40AM (#32761606)
I wonder how many times SQLite has been passed over for a more complex solution because people thought they needed highly scalable distributed two phase commit or whatever when all they really needed was a file with an SQL interface
Re:How the SQLite virtual machine works by gigatexal on Friday September 09, 2022 @04:59AM (#32776992)
I'm guessing your response was sarcastic. I don't get it, though. If you need a distributed two-phase commit DB get one like CockroachDB or something like that. SQLite is not that.
Re:How the SQLite virtual machine works by simonw on Wednesday September 07, 2022 @04:34PM (#32756424)
WAL was added 2010-07-21, so pre-WAL is over 12 years ago now!
Re:How the SQLite virtual machine works by hinkley on Thursday September 08, 2022 @12:12AM (#32761106)
Lots of changes with branch prediction in that time too.
Re:How the SQLite virtual machine works by tptacek on Wednesday September 07, 2022 @12:23PM (#32752674)
I don't think it has much to do with the name. I think the biggest perceptual impact on SQLite came from Rails, and its default for using SQLite as a test database while strongly discouraging people from using it in production.
Re:How the SQLite virtual machine works by post-it on Wednesday September 07, 2022 @12:46PM (#32752997)
Django too.

> By default, the configuration uses SQLite. If you’re new to databases, or you’re just interested in trying Django, this is the easiest choice. SQLite is included in Python, so you won’t need to install anything else to support your database. When starting your first real project, however, you may want to use a more scalable database like PostgreSQL, to avoid database-switching headaches down the road. [0]

[0] https://docs.djangoproject.com/en/4.1/intro/tutorial02/

Re:How the SQLite virtual machine works by tptacek on Wednesday September 07, 2022 @12:49PM (#32753047)
Sure, Django too.
Re:How the SQLite virtual machine works by 0x457 on Wednesday September 07, 2022 @01:39PM (#32753634)
To be fair, serving any kind of traffic with Rails required multiple replicas of Rails application running. So SQLite wasn't an option for production for any kind of production rails workload.

Then most hosting for rails were stateless, so you had no way of storing SQLite on disk.

And finally, for serious production you need high availability and SQLite couldn't offer that.

Re:How the SQLite virtual machine works by Abishek_Muthian on Thursday September 08, 2022 @03:29AM (#32762435)
Would Go's concurrency be an issue for SQLite too?

Edit: I looked into a common Go driver for SQLite[1] and the FAQ reads,

> Can I use this in multiple routines concurrently?

> Yes for readonly. But not for writable. See #50, #51, #209, #274.

Every time I see a blog post from fly.io reg SQLite I'm tempted to use it for my next project, But the need to rewrite my framework for limited data types and the doubts regarding concurrency keeps me away.

[1] https://github.com/mattn/go-sqlite3

Re:How the SQLite virtual machine works by tptacek on Thursday September 08, 2022 @03:38PM (#32770930)
My general M.O. for SQLite in Go is to have a single writer thread with a channel of closures to apply transactions, and a shared db handle for reads. Works fine.
Re:How the SQLite virtual machine works by Abishek_Muthian on Thursday September 08, 2022 @11:16PM (#32774887)
That's an useful information, Thanks for sharing.
Re:How the SQLite virtual machine works by randomdata on Wednesday September 07, 2022 @02:26PM (#32754312)
I think it's older than that, even predating SQLite. Back when Perl/CGI was all the rage it was common to store data in files. But the web was growing fast and scaling files was hard. Pushing that workload onto the heavyweight RDMBS was seen as the solution, reasonably so in some cases, but that also brought the cargo culting along with it.

When SQLite arrived it got lumped in with file storage that can't scale. Rails only perpetuated what everyone was already thinking.

Re:How the SQLite virtual machine works by nigma on Wednesday September 07, 2022 @01:14PM (#32753353)
There are many reasons for using other databases like PostgreSQL or MySQL in production - feature set, (managed) hosting, backup and replication, etc.

SQLite is primarily embedded/local database and cannot be easily separated and shared over network [1] between multiple disposable backend/worker instances.

[1] https://12factor.net/backing-services

Re:How the SQLite virtual machine works by tptacek on Wednesday September 07, 2022 @01:15PM (#32753372)
Yes, that's what Rails (and Django) say about it.
Re:How the SQLite virtual machine works by deepstack on Wednesday September 07, 2022 @01:52PM (#32753813)
yeah when it comes to embbed, if one is willing to go the java road, then H2 is an excellent DB to use. It is some what Postgres compliant.
Re:How the SQLite virtual machine works by d23 on Wednesday September 07, 2022 @02:35PM (#32754451)
Interesting. I didn't realize it wasn't for "lite".

A friend of mine made a similar point about GIMP. I'd never thought about it that way. What a shame to be hindered by such a terrible name choice (in GIMP's case).

Re:How the SQLite virtual machine works by TOGoS on Wednesday September 07, 2022 @05:23PM (#32757127)
I'm always surprised at how quickly people will dismiss something just because of a name. I once wrote a bug tracking system/wiki for my company to replace the terrible one that we had been using. It did everything we needed and was much nicer to work with, but the reason people gave me for why we never used it was that the name sounded funny. It was a made-up word, totally an afterthought. sigh
Re:How the SQLite virtual machine works by busymom0 on Wednesday September 07, 2022 @10:34PM (#32760402)
What was the name?
Re:How the SQLite virtual machine works by gnrlst on Wednesday September 07, 2022 @11:56AM (#32752328)
I am a big believer in "nomen omen" -> latin for: destiny is in the name. It's obviously an exaggeration, but to your point, this is one of those cases where the name influenced how the tech was being used (and in what environments), regardless of its underlying potential.
Re:How the SQLite virtual machine works by mananaysiempre on Wednesday September 07, 2022 @12:56PM (#32753139)
“Nominative determinism”[1]

[1] https://unsongbook.com/

Re:How the SQLite virtual machine works by resoluteteeth on Wednesday September 07, 2022 @12:12PM (#32752516)
I'm not sure the problem is the name.

I think there has been a lot of recognition in the last 10 years that sqlite is actually quite robust, but it still hasn't been considered suitable for serious use is based on how software and database servers have traditionally operated.

It seems like what's changing that now is the recognition that other approaches may make more sense given modern software architecture.

Re:How the SQLite virtual machine works by kevincox on Wednesday September 07, 2022 @12:50PM (#32753057)
I don't think stability is the main concern. However for the longest time SQLite didn't have great support for multiple writers and it is still pretty basic. So it works really well for smallish numbers of clients or write-light workloads but if you want to pound it with inserts and updates it still isn't as good of a choice as other RDBMSes.
Re:How the SQLite virtual machine works by ternaryoperator on Wednesday September 07, 2022 @05:30PM (#32757221)
> For much of its lifetime, SQLite wasn't taken seriously

As far as I can recall, it was always well regarded as an embeddable database. What makes you think that it wasn't taken seriously "for much of its lifetime"?

Re:How the SQLite virtual machine works by aaaaaaaaata on Wednesday September 07, 2022 @07:53PM (#32758976)
By standard web devs.

Been in missiles for a while.

Re:How the SQLite virtual machine works by _the_inflator on Wednesday September 07, 2022 @12:46PM (#32753007)
I look at it differently. In my opinion Android started popularizing SQLite. For me kudos go out to Android, for integrating it on a large scale.
Re:How the SQLite virtual machine works by thro388 on Wednesday September 07, 2022 @12:38PM (#32752901)
There were other embedded databases; Firebird, Foxpro etc..
Re:How the SQLite virtual machine works by sethev on Wednesday September 07, 2022 @10:57PM (#32760585)
It's hard to imagine a timeline where SQLite was more successful.