6 ms·
The economics of a Postgres free tier
- cultofmetatron 2y agofrom their homepage > Xata is the only serverless data platform for PostgreSQL. ummm. what about https://neon.tech/ https://neon.tech/?
- corytheboyd 2y agoWow, I usually hate marketing pages but that one is awesome
- snide 2y agoXata employee here. The clarification would be "platform" vs. "host". You get a lot with Xata beyond the core Postgres offering. We automatically replicate to OpenSearch for a great, fast search experience, provide file attachments through the DB itself (with image transformations), provide a pretty cool editor, and are now starting to think heavily towards how migrations could be better (more on this next week). No knock against Neon, who build cool stuff too. I agree "only" is likely a little aggressive, but marketing is tricky and sometimes the A/B gods appear. We've switched this one-liner a few times in the past year. I'll provide that feedback to the team in any case.
- cultofmetatron 2y agodo you guys host within aws? one thing that keepsme gong back to drds is always latency and egress fees. its nice to have a db thats in the same data center as my api server.
- tudorg 2y agohi, yes, we are on AWS and offer several regions: https://xata.io/docs/getting-started/available-regions https://xata.io/docs/getting-started/available-regions
- tossandthrow 2y agoI would love a service, where I can pay 2$ per month, pre-paid, something like my email, and then get a worry free Postgres instance - some limits as what these free databases offer, just for 1-2$ a month so that I know that I pay my part and that the database is kept alive. But all DBaaS's seem to offer free or at least 20$ per month, which is excessive for a small hobby project. Does that exist?
- noja 2y agoWhere does that $2 a month price come from? You could choose a webhost with a database included.
- krageon 2y agoA small db user costs almost nothing to the host. It'd be like a shared webhost, except there's none of the overhead of running the programming language (e.g. php). That is by far the most expensive part of the machine. Offering this for around that price is a proposition that will have significant RoI in terms of hardware used.
- filleokus 2y agoI guess that's true now with these "serverless" databases where compute and storage is separated in a neat way. Otherwise you either need to be ok with keeping the whole ≈vm alive, or have a really old school shared database setup alá 2004 web hosting… Maybe it's no problem, but feels kinda icky? But regardless, I agree with you. I can spin up the cheapest fly.io machine for 2 usd / month, or some DO droplet/function, but neon and these guys are either free or 20. It always feels better paying a bit than nothing. I know CockroachDB has some serverless > 0 (but cheap) pricing https://www.cockroachlabs.com/pricing/ https://www.cockroachlabs.com/pricing/
- mrkurt 2y agoA small db isn't free to _operate_. The actual compute and storage costs are pretty low, but keeping the thing running is harder than you'd think. Keeping it running with no users is easy. Keeping it running when someone ships an app that blows the DB up is hard.
- password4321 2y agoLast I checked: Supabase deactivates after 1 week, Render deletes after 90+14 days.
- tristan957 2y agoResponding with my Neon employee hat on: > Neon is scaling databases to zero and offer a certain number of "active hours" in their free tier. Neon's free tier allows users to run their database 24/7[0]. That means you could keep a database alive all the time if you wanted. Quoting the pricing page: > 24/7 for your main database In addition to the 24/7 usage on the free tier, Neon additionally gives you 20 compute hours for branches other than your primary/main branch. Just wanted to clear up the confusion in the article. Not sure why they phrased the Neon section that way. Edit: The author has corrected the statement about Neon. Thanks! [0]: https://neon.tech/pricing https://neon.tech/pricing
- fngjdflmdflg 2y agoYeah, but there is a point (about 1 hour, last I checked being a few months ago) where you start getting cold starts in Neon. You can call that being active the whole time but CockroachDB doesn't have this problem. If I had to rank it: "Live" database > CockroachDB (few hundred ms) > NeonDB (2-3 seconds) > traditional cold start. This is just my impression and the data is made up but that is how it has felt as a user. So there are definitely levels of "scaling to zero"
- tristan957 2y agoWhen you scale something to 0, indeed there are issues with cold starts. On the Neon free tier, you will get a cold start if your database is inactive for 5 minutes (you can configure this value on paid plans). As an exercise, I decided to try for myself what my cold start time is + query round trip, on Neon's free tier. Note that I am in Austin connecting to us-east-2. $ time psql -c 'SELECT 1' 'postgresql://neondb_owner:<password>@<endpoint>.us-east-2.aws.neon.tech/neondb?sslmode=require' Null display is "(null)". ?column? ---------- 1 (1 row) real 0m1.156s user 0m0.036s sys 0m0.020s You can't make a trend out of 1 data point, but thought I would provide it nonetheless.
- skybrian 2y agoLast year I was playing around with Neon and the cold starts were slow enough that I implemented a “Loading…” dialog box. I haven’t touched it in a year, but I tried it just now and it still works. Cold startup for the Deno Fresh instance and the database query were about 700ms each, assuming I interpreted my logs correctly. Subjectively, it’s slow enough that it’s worth putting up a dialog box, but it disappears fast enough that you don’t need a spinner or progress bar. A meta-refresh of one second seems good enough. (I’m in California but the demo uses an East Coast instance for Neon. I set it up that way because I wanted to know how it would feel.) Demo: https://postgres-counter-demo.deno.dev/ https://postgres-counter-demo.deno.dev/ Source code: https://github.com/skybrian/postgres-counter-demo/ https://github.com/skybrian/postgres-counter-demo/
- adam_gyroscope 2y agoAt bit.io, _if_ you ran the database on the free tier for the full month, it cost us around $0.83. We scaled to zero, so the most common case was that free tier DBs cost us about 1/30th of that. That database was running on its own pod, isolated from every other database.
- adam_gyroscope 2y agoStartup time after you scaled to zero was 250ms.
- 1oooqooq 2y agosounds like the whole site scalled to zero :(
- klabb3 2y agoYes and they were really promising but they were acquired and shut down by Databricks. Not that it matters much for users, but it’s important to know why the market looks the way it does.
- deleted 2y ago[deleted]
- danpalmer 2y agoSomething I'd love to understand is the latency model for hosted databases like this. Every production web app or backend I've worked on has pretty much depended on having 1-3ms latency to the database. That's easy when you're deploying your own hardware, and in my experience easy when you use a cloud provider's hosted offering in the same zone, and fine within the region. So how does this work? I sign up and get a Postgres connection string. Where is it? Because the where _really_ matters. Do Xata and the other examples of this all deploy into all the cloud providers and all the regions and let you choose which one? That feels like a big duplication of effort and like it would be harder to get critical mass in order to get the unit economics to work. Or do people just put up with a database 10ms away?
- scosman 2y agoEvery one I’ve used is on AWS and will tell you the zone so you can keep things within the region/zone. That includes Heroku, Supabase, Neon, and (obviously) RDS. That said, I’ve used AWS DBs with Cloudflare pages and the latency isn’t a major issue. If you are running non geo-distributed DB, the DB is a lot further than 10ms away from your average user.
- danpalmer 2y agoIn my experience, applications tend to do far more DB queries than users do backend requests, and as such, 50ms to the user matters much less than the difference between 1 and 10ms on DB queries. That said, thanks for the experience. Do they also tend to launch in other cloud providers? It seems like it would be a tricky business to navigate, restricting your customer base to specific providers.
- Kwpolska 2y agoSome SaaS providers will let you choose your cloud and set up their services there. As for the latency, it might not matter for all applications, or it may encourage the devs to spend more time optimizing the number of SQL queries.
- skybrian 2y agoThey let you choose a region. Here is Xata’s region list: https://xata.io/docs/getting-started/available-regions https://xata.io/docs/getting-started/available-regions Looks like it’s using AWS Aurora under the hood: https://xata.io/blog/serverless-postgres-platform https://xata.io/blog/serverless-postgres-platform But also, they’ve done some work to reduce the number of network round trips that Postgres needs to respond to a query. For many situations, SQL over HTTPS is used. In JavaScript, the database driver is a wrapper around a fetch request. Xata seems to have its own SDK with higher-level API’s to reduce round trips. Also: https://xata.io/blog/geo-distributed-postgres https://xata.io/blog/geo-distributed-postgres Meanwhile, here’s Neon’s blog post on their connection options: https://neon.tech/blog/http-vs-websockets-for-postgres-queries-at-the-edge https://neon.tech/blog/http-vs-websockets-for-postgres-queri...
- justinclift 2y agoLooking at the pricing for those AWS instance types ("db.t4g.medium" and "r6gd.large.search"), then looking at co-location costs... I wonder if they have enough clusters that it would make sense to move some to co-location? I guess if their customers are mostly already using AWS, that would be a bad idea because of AWS data transfer fees then applying?
- khaki54 2y agoI've been wondering this for a while -- why are people using DBaaS? Wouldn't you use an AMI of choice, self-host, or use one of the cloud native solutions? Seems like piping all your DB calls outside your VPC would have a lot of downsides, not the least of which is a lot of latency (I get there is peering infrastructure). Also, there are security issues to contend with, threat surface is much larger with a DB available to the internet vs a DB on a segmented private network only available to the middle tier. Is it a cost thing? Is something like xata or neon cheaper than say AWS Aurora? I don't see how it could be cheaper with all the inherent egress costs.
- SirMaster 2y agoThis seems great. I was looking for a free cloud database I could use to host some shared data for my small free open source project and this should do nicely. I probably wont ever even use more than a dozen MB or so and such low traffic. Basically it's an app for remote controlling home theater equipment, and I wanted to give users of the app a centralized database to add the little text commands that they find and use for their various device control. So that new users can get a list of commands that other users have written/found for specific devices instead of having to go to the command doc themselves every time. And I doubt ill ever have more than maybe a couple hundred users tops.