Live data from Hacker News

How to use Postgres for everything

github.com

81–90 of 181 posts

Re: How to use Postgres for everything

#81
post #14

Earlier quoted context omitted.

You could go whole hog with postgrest I suppose

I always wonder if postgrest works well after growing quite a bit. I really should google the largest companies using it.

Check out supabase, they're all in on postgrest.

Re: How to use Postgres for everything

#83
I love Postgres but wouldn't want to use it for everyting.

Taking graph databases, for example, Postgres (via Apache AGE) stores graph data in relational tables with O(log(n)) index lookups and O(k ⋅ log(n)) traversal*

Whereas a true graph database like Neo4J stores graph data in adjacency lists, which means O(1) index lookups and O() traversal.

That's a massive difference in traversal complexity for most graphs.

*k is the degree of the node (number of edges connected to a node).

Re: How to use Postgres for everything

#86
post #70

PGQueuer is a lightweight job queue for Python, built entirely on PostgreSQL. It uses SKIP LOCKED for efficient and safe job processing, with a minimalist design that keeps things simple and performant. If you’re already using Postgres and want a Python-native way to manage background jobs without adding extra infrastructure, PGQueuer might be worth a look: GitHub - https://github.com/janbjorge/pgqueuer

Also https://github.com/TkTech/chancy for another (early) Python option that goes the other way and aims to have bells and whistles included like a dashboard, workflows, mixed-mode workers, etc...

Check out the Similar Projects section in the docs for a whole bunch of Postgres-backed task queues. Haven't heard of pgqueuer before, another one to add!

Re: How to use Postgres for everything

#87
post #70

PGQueuer is a lightweight job queue for Python, built entirely on PostgreSQL. It uses SKIP LOCKED for efficient and safe job processing, with a minimalist design that keeps things simple and performant. If you’re already using Postgres and want a Python-native way to manage background jobs without adding extra infrastructure, PGQueuer might be worth a look: GitHub - https://github.com/janbjorge/pgqueuer

What are its advantages compared to a more dedicated job queue system?

Re: How to use Postgres for everything

#88
post #78
post #70

PGQueuer is a lightweight job queue for Python, built entirely on PostgreSQL. It uses SKIP LOCKED for efficient and safe job processing, with a minimalist design that keeps things simple and performant. If you’re already using Postgres and want a Python-native way to manage background jobs without adding extra infrastructure, PGQueuer might be worth a look: GitHub - https://github.com/janbjorge/pgqueuer

I always wondered about the claim that SKIP LOCKED is all that efficient. Surely there are lots of cases where this is a really suboptimal pattern. Simple example: if you have a mixture of very short jobs and longer duration jobs, then there might be hundreds or thousands of short jobs executed for each longer job. In such a case the rows in the jobs table for the longer jobs will be skipped over hundreds of times. T…

Job rows could have an indexed column state so you just query for the rows with state "not-started".

This way you won't need to skip over the long jobs that are in state "processing".

Re: How to use Postgres for everything

#89

Great repo! Thanks! I'm wondering, any approach for bitemporal dbs, like xtdb?

You definitely don’t need a special database for bitemporal data. Just a datetime and as of data time column, your value column and whatever metadata you want (or a jsonb col for metadata if you want more flexibility at the cost of some speed of filtering by metadata)

How do you find it when you scale it up to every table, every query?

Re: How to use Postgres for everything

#90
post #80

Earlier quoted context omitted.

If you don't have any discipline it becomes hell. Not to mention that a random team writing a migration that locks a key shared table (or otherwise chokes resources) now causes outages for everyone .

Not a problem until it's a problem.

And the best thing is that until it’s a problem you can focus on product/market fit and delighting your customers.

Overengineering is a plague amongst SWEs, and almost as dangerous as failing to sell the product in the market.

Post reply on HN