I see that there are a bunch of different Postgresql interfaces for OCaml. Caqti, PGO’Caml, PostgreSQL-OCaml, PGX. Does anybody know of a comparison of all these, maybe to help guide somebody making a choice of which to use ?
If you want PostgreSQL specifically, I’ve had good luck with postgresql-ocaml. It’s a thin wrapper around libpq. It doesn’t have type safe query builders or value (de)serialization.
I think pgx has a pure ocaml implementation of the libpq wire protocol. I’d be interested to hear from anyone who has experience with it.
My friends “in the biz” tell me that postgresql is the database to go with these days. My response for the last 15yr has always been to go with Mysql, but … clearly, given the pretty much unanimous view of the folks I queried that Postgresql is the way to go, I’ve decided to take the plunge.
I like Postgres personally, but using DB specific bindings locks you in a bit. There are other Postgres-compatible DBs though (Redshift, etc.), and you can mostly just swap them in (modulo all their interesting incompatibilities).
The alternative is libs like Caqti that abstract over the DB backend or I guess ODBC.
Caqti + ppx_rapper has been my go-to.
While postgresql is the hottest thing to use in startup land, and I enjoy it, the planetscale service makes working with mysql so easy that I sometimes want to start a service with mysql just for their migration and branching ux.
What about mysql bindings? According to ocamlverse, there are way fewer choices for mysql. Which ones are still okay to use if I don’t care about type-safety across the db network layer?
nevermind, found planetscale.
One of the reasons I thought about Mysql (other than “I’ve always used it when I didn’t have to use DB2”) was myrocks
: Mysql with RocksDB replacing the InnoDB storage engine. B/c boy howdy, SSD-friendliness is a good thing. And apparently really improves performance.
My friends’ urging of Postgresql was dispositive, though: they’re all in positions where these things matter, and not only in startups.
pgocaml looks very appealing to me, for the “magical” type safety you get out of the box, with very minimal friction.
The database’s default authentication method is incompatible with the library since v14 FYI.
So you may find this Dockerfile helpful to set things up.
Planetscale does look cool. There’s also https://neon.tech/, which I’ve been hoping to use one day. RDBMS is anything but boring tech these days.
This was a good episode where some tech was covered: Taking Postgres serverless with Nikita Shamgunov from Neon (The Changelog #510) |> Changelog
I enjoyed that episode too. RDBMS has a made comeback . I look forward to seeing neon being really put through the ringer. Cockroachdb’s serverless offering too is something we’re using. Not in production yet but think it’ll do fine for such an early product. Overall, great options out there now.
I could swear that I remember Amazon offering Postgresql as part of their RDB offering in the cloud? Isn’t that already close enough to serverless that the difference doesn’t matter? Just curious – for my project, I most definitely don’t want a serverless deployment.
Yeah, sorry to take it off-topic with my post. I didn’t want my friend, postgres, to be left out when discussing large scale distributed relation databases.
AWS does have an offering, but it doesn’t scale to zero, which I find compelling for side projects. If you want pay-per-use, you’re stuck with DynamoDB (document) last I checked. I’m definitely not an expert on this though. Professionally, we keep it pretty old-school.
Aha, ok, now tracking. The definition of “serverless” includes “no cost when not used”. Thank you for the clarification.