by hmokiguess · 4mo ago · 0 comments
I end up with a mixture of serverless storage like DynamoDB, S3, DuckDB on S3, and SQLite.
Am I crazy? How can one have a decent Postgres and not pay at least $100/mo (yes, when I say frugal I mean really frugal ... think solo founder that likes to stay on free tiers haha) -- I am aware of Neon/Supabase, but last time I tried them they ended up becoming a tightly coupled annoying dependency after scale that defeated the cost savings as they grew in costs and we ended up migrating to Aurora / RDS lol
EDIT: I'm aware of the self-hosted path but I find configuring the above things faster/cheaper in terms of my admin hours than the self hosted postgres db. Maybe I just suck at being a DBA or need better education on it, that said, I have AI now so I should give it a chance again as it's been a minute since I created a fresh thing
You can run this on $10x2 = $20 per month setup for 2 replicas and 1 monitor node for maybe $2-3.
For most other projects i just use sqlite, backup periodically to s3.
some report (coincidentally i was checking health of my small cluster for an app)
Common application queries average under 4 ms:frequent analytics queries: ~0.9–1.4 ms average common inserts: ~0.4–3.4 ms average the slower recurring reporting query: 62 ms average across 53 calls, 308 ms worst case
Query volume is approximately 2.30 million SQL statements/day (~26.6 statements/sec), based on pg_stat_statements over the last 97.3 days. That includes every SQL statement, not just user-facing requests: BEGIN/COMMIT alone account for ~1.05M/day, analytics inserts for ~522K/day, and HA/monitoring checks for ~118K/day.
You mentioned not wanting to spend admin hours fine-tuning a self-hosted instance though. Are you really hitting the DB hard enough for that to matter, but SQLite works fine? Cause I haven't tuned local Postgres in years.
I think most of the work I've done just fits in the other storage models and they scale really far really fast at $0 cost
I haven't paid for then ever, similarly, I have a few super tiny apps on Supabase and Neon too that cost me $0
On another project that got traction though, Postgres became better DX than DynamoDB and such, but that traction came with the overhead cost
The "fine-tuning" was setting up things like pgbouncer, restart, vaccuum, query optimizer, etc. Like, the db would always create some amount of work every fortnight. Coming from managed services, especially these serverless ones, they just work and you do nothing so it makes you spoiled.
Different mental model maybe?
On the "hitting the DB hard enough for that to matter but SQLite works fine" -- Absolutely! I have a <10gb SQLite inside a Lambda for some complex queries, and that gets refreshed whenever that data changes (which is not that often).