Comment by nasretdinov

1 day ago

<please don't take this too seriously>

That's great but I believe it's still over-engineered. Unless it's a web site that can tolerate no downtime at all during schema updates, SQLite in WAL2 mode is more than enough. Moreover, in Postgres version upgrades can't be done without significant downtime (or setting up replication and performing a complex dance), so even that isn't so cut and dry.

</ ... >

For some of the simpler sites sqlite would have been fine, but I do need Postgres anyway for some other stuff on my server so the overall burden of standardizing on Postgres only is less than having to do tuning for two different databases. In particular sqlite has worse defaults due to backwards compatibility, so you have to do a lot of upfront config for every table and DB.

Postgres version upgrades are basically painless, at my workplace our upgrades complete in so little time our users don't notice, and we have more data than probably 99.9999% of companies out there (mature company in aerospace industry).

  • Well if you already have Postgres then yes, sounds fine. I don't really agree that SQLite needs tons of tweaking -- setting journal_mode to WAL/WAL2 is the only real thing worth doing, everything else I would consider optional.

    Version upgrades for SQLite are basically a no-op though, that's kinda one of the reasons why it's so great to run in production (and deployment a maintenance being mostly a no-op as well, apart from setting up backups I guess).

    I don't actually suggest that everyone should run their production on SQLite, but it's genuinely worth considering especially for small-ish projects.

    • Foreign key constraints, sync frequency, busy timeout, strict typing on tables, explicit types for integer primary keys, and a convention for storing dates and times are others I would want to do up front.

Every time I start with sqlite I outgrow it in some way, so I start with postgres now.

From an engineering perspective, sqlite and PostgreSQL are equivalent.

The difference is only in the deployment/maintenance.

And considering the context he stated, zero downtime really doesn't seem like something he's worrying about.

(Me not taking this seriously)

I personally find Postgres WAY easier than SQLite simply because of the deployment story. I do a lot of hotfixes and dangerous stuff on personal projects, and having two databases complicates that tremendously. I like being able to run hot code on prod.

For the record, this is not the same reason I like postgres for actual production code

  • Sorry can you please clarify what you mean by having two databases? You can share the same SQLite between applications if you really want

    • I think they mean that they actually do need Postgres for some of their projects, and it's easier to just use Postgres for everything, than to use Postgres for some things and SQLite for others.

      1 reply →

    • Yeah, I mean I guess I could technically connect to the remote SQLite server on my production server. You're right. But I've never done that and that's just not the pattern people use on SQLite

      1 reply →

> Unless it's a web site that can tolerate no downtime at all during schema updates, SQLite in WAL2 mode is more than enough.

I do think that people really underestimate how quickly a system starts being "please, no downtime" (or its weaker cousin, "please, don't make your ops people do rollouts at 1AM").

Like obviously it's not the end of the world but the default assumption of "the system is up" makes a loooooot of things downstream of that easier.

Having to do operational bug triage on systems that routinely have blips in availability is unfun.

  • Trying to have so few blips they're invisible to bug tracking is a very expensive level of uptime. It takes a lot of convenience to add up that high, compared to ignoring errors for thirty seconds at noon.

    • The sort of real thing is that it's not just about no-downtime deploys, but also stuff like rolling back smoothly, general continuous deployment or even just generally being able to easily move between versions.

      I still think there are lines (I have to begrudgingly accept that downtime for PG upgrades is still basically worth it because the effort to not downtime there is so high but the frequency is so low), and it's a spectrum. But I've found that this particular flavor of tech debt tends to hurt quite a lot even with fairly low activity systems

      1 reply →