Live data from Hacker News

Ask HN: Do you self-host your database?

news.ycombinator.com

221–230 of 236 posts

Re: Ask HN: Do you self-host your database?

#221
post #52

We're currently transitioning from a multi-tenant 2TB postgres DB hosted on AWS RDS to using sqlite instead, a separate database for each client. We're doing this for multiple reasons: a) As our DB grew the service became very expensive, one of the biggest items in our AWS invoice; b) Keeping the PG servers up to date is a pain, we simply don't have time for this; c) We wanted to be able to migrate to other clouds an…

Sounds like a nightmare if you ever have to go under SOC2.

Re: Ask HN: Do you self-host your database?

#222

Earlier quoted context omitted.

Writing to a SQLite file on a remote filesystem only works with a heap of caveats: don't use WAL, and disable SHM. SQLite is crazy fast in WAL mode, but it's because they use a memory-mapped file to coordinate consistency across multiple processes/threads. You can't mmap a remote file. (Source: hacking in a DB replica workaround to PhotoStructure so people can store their library on arbitrary filesystems... BTW, I'd…

I'm idly curious why you need to use replicas in a workaround context, and why arbitrary filesystems are a problem.

The local-replica approach is only applied when your library database is on a remote filesystem, which SQLite can't read/write to (due to the absence of shm and flock).

Re: Ask HN: Do you self-host your database?

#223

I used WordPress as my datastore for a while on personal projects. I could wrestle it mostly into shape and use the built-in rest api. WP is my day job so I know it well and like it, but I'm not a backender, so it was a bit clunky and time consuming to get things the way I wanted. Then I needed to host that WP instance somewhere. That was also a pain. I decided last year to try and use Node/Express/Mongo for my backe…

Supabase cofounder here. I just want to give my thanks for your support. It’s always nice coming across a comment like this in the wild - makes all the hard work worth it.

Hi I hope its okay to ask you here.

I am looking at supabase because someone recommended to me that it uses postgres.

My current backend uses postgres and postgis and I was looking for real time geospatial service. I'm wondering does supabase make it easy for me to do real time geospatial querying, something like open a listener for radius(10km) around the user and have it continually update the results around me? I see that you have postgis extension available, so can I do that thing I mentioned?

I'm using firebase currently, with geofire, for the real time aspect of my app. It have limitations like can't do ordering or additional filtering because of the geofire approach.

Please let me know, and good luck with Supabase !

Re: Ask HN: Do you self-host your database?

#224
post #211

Earlier quoted context omitted.

And you don't usually grow your own food, yet it's not seen as strange.

It would be seen as strange if you say you are a farmer but you don't have a farm that you grow food in, instead you just temporarily rent a farm from random places for short amounts of time. Last year I was renting my farm from AppleFarms but they started charging high prices when I wanted to expand so I switched to AmazonForestServices. For migration I used the DockerShippingService from GiantGarageInc to transplan…

It’s non-obvious, but that’s actually very close to how farming works today, at least in the US. Farm-owners will lease their land for a season to grow a specific crop. The land needs to meet requirements for acreage, irrigation, etc., but someone else will “use” the farm.

I’m sure this happens on a continuum from “that’s a big field, can I use it?” to “here are seeds, I expect XYZ yield in N months”.

Re: Ask HN: Do you self-host your database?

#225
post #223

Earlier quoted context omitted.

Supabase cofounder here. I just want to give my thanks for your support. It’s always nice coming across a comment like this in the wild - makes all the hard work worth it.

Hi I hope its okay to ask you here. I am looking at supabase because someone recommended to me that it uses postgres. My current backend uses postgres and postgis and I was looking for real time geospatial service. I'm wondering does supabase make it easy for me to do real time geospatial querying, something like open a listener for radius(10km) around the user and have it continually update the results around me? I…

Your use-case is a bit novel, so it might be worth asking in our forum to make sure I haven't misunderstood your requirements: https://github.com/supabase/supabase/discussions

I think we have all the pieces in place for you to use:

  - a Postgres database with PostGIS
  - a Realtime listener for listening to database changes
I don't know if you need realtime though if you are constantly sending the user's location to the database. It might look something like this:

  - Turn on PostGIS
  - Create a Postgres function which takes in the user's location and calculates radius results. eg: get_objects(lat text, lng text, radius smallint)
  - Call this function from the client every XX seconds using the client[0] `supabase.rpc('get_objects', { lat, lng, 10 })

Hope that gives you a few ideas!

[0] RPC: https://supabase.io/docs/reference/javascript/rpc

Re: Ask HN: Do you self-host your database?

#226

Earlier quoted context omitted.

I'm idly curious why you need to use replicas in a workaround context, and why arbitrary filesystems are a problem.

The local-replica approach is only applied when your library database is on a remote filesystem, which SQLite can't read/write to (due to the absence of shm and flock).

I think I get it now: you want people to be able to point PhotoStructure at a NAS and have it Just Work. That was the context I was missing.

I was wondering if maybe the cute hack that was posted recentlyish (https://news.ycombinator.com/item?id=27016630) to enable SQLite3 to access large remote databases over HTTP might be relevant, but that approach requires a small server to be sitting at the remote, and only implements read-only access in any case.

Now I'm wondering what an NFS/SMB translation of the above idea (which uses SQLite3's VFS hooks) might look like: ramp internal buffering to the max, use separate transient files (with eg date-based unique names) for each in-flight request, etc. Append-only journal files also come to mind...

It's crazy how flaky network filesystems are at the lower levels. Like, I use NFS at home every day, without Kerberos (which lets me enable encryption, which IIUC provides AEAD), all while knowing my data integrity entirely depends on the IP checksum computed by my 15 year old ISP router. :D

(I already know I need to upgrade. Shhh.)

Re: Ask HN: Do you self-host your database?

#227
post #119

“Self-host” is such a weird word. Having your own stuff yourself should be the default , should it not? I mean, you don’t “self-drive” your car, nor “self-work” your job. The corresponding words instead exists for the opposites: You can have a chauffeur and you can outsource your job. I think the problem is entirely caused by the US having absolutely abysmal private internet speeds and capacity. Since you can’t then…

> "Having your own stuff yourself should be the default , should it not?" I don't think it has anything to do with internet speeds. Self-hosting is simply too complicated, not just for non-technical users, but for many developers too. Compare the simplicity of installing a desktop app. Click to start the installer. Click next, next...finish. Done. Self-hosting in the cloud is ludicrously complicated in comparison. Do…

> Self-hosting in the cloud

That’s a contradiction in terms. It’s like saying that you own your home when what you have is a timeshare. The cloud is a timeshare.

Re: Ask HN: Do you self-host your database?

#228
post #223

Earlier quoted context omitted.

Hi I hope its okay to ask you here. I am looking at supabase because someone recommended to me that it uses postgres. My current backend uses postgres and postgis and I was looking for real time geospatial service. I'm wondering does supabase make it easy for me to do real time geospatial querying, something like open a listener for radius(10km) around the user and have it continually update the results around me? I…

Your use-case is a bit novel, so it might be worth asking in our forum to make sure I haven't misunderstood your requirements: https://github.com/supabase/supabase/discussions I think we have all the pieces in place for you to use: - a Postgres database with PostGIS - a Realtime listener for listening to database changes I don't know if you need realtime though if you are constantly sending the user's location to the…

Thanks! That's awesome. I made a lot of progress yesterday with supabase, setting up some tables and auth :D

I really like it, and I'm going to keep maintaining a secondary project with it just to keep up with all the good work. Seriously, all the best!

Re: Ask HN: Do you self-host your database?

#229
post #52

We're currently transitioning from a multi-tenant 2TB postgres DB hosted on AWS RDS to using sqlite instead, a separate database for each client. We're doing this for multiple reasons: a) As our DB grew the service became very expensive, one of the biggest items in our AWS invoice; b) Keeping the PG servers up to date is a pain, we simply don't have time for this; c) We wanted to be able to migrate to other clouds an…

You'll probably come to regret that. A DB per customer is a maintenance nightmare.

I remember a discussion here a few years ago about it, and there were so many voices chiming up to say 'we did this, terrible idea'.

Re: Ask HN: Do you self-host your database?

#230

IMHO self hosting your database (even in the cloud) is the best way to do it. You have control over the version. You have control over features. You have control over performance. It’s tons cheaper for greater performance - especially when you go over a few hundred gigs. Yes, the hosted ones have built in replication - but my data is far too valuable to put in the hands of a third party. If they lost it - they could…

And every thing you have control over you are also responsible for maintaining. If that's your thing, ok, but not everyone wants to be a DBA all day.

At the early startup stages, you barely have to touch it. It'll just merrily run without intervention for months.

At the stage where you need to spend a few hours a month dealing with it, you can afford to hire a DBA.

Post reply on HN