News for hackers. Stuff that matters.
Re:Ask HN: Is there a way to efficiently subscribe to an SQL... by stuiterbal on Thursday April 22, 2021 @07:49AM (#26901677)
Maybe https://hasura.io is something to have a look at? It's a GraphQL server that gives you realtime GraphQL API's over Postgres/SQL.

I've been trying out https://nhost.io for some time now. They use Hasura and I'm impressed by how easy subscriptions are using Apollo to query the GraphQL API.

Re:Ask HN: Is there a way to efficiently subscribe to an SQL... by jrowley on Thursday April 22, 2021 @09:22AM (#26902426)
I believe hasura uses polling under the hood to accomplish subscriptions, right?
Re:Ask HN: Is there a way to efficiently subscribe to an SQL... by tirumaraiselvan on Thursday April 22, 2021 @10:01AM (#26902828)
I work at Hasura.

Hasura uses a novel way of batching similar parameterized subscriptions together and then polls under the hood. This means that if there are 1000 subscribers of similar type of query, then underneath Hasura will only make a single query to Postgres (or few queries depending on the batch size). This approach, which we call "multiplexing" in short, scales really really well. And is also the simplest way to get live updates for _any_ query, no matter how many joins, etc.

We talk more about this approach (and comparisons with other approaches), and benchmarks in this post: https://hasura.io/blog/1-million-active-graphql-subscription...

Re:Ask HN: Is there a way to efficiently subscribe to an SQL... by vaughan on Thursday April 22, 2021 @10:41AM (#26903283)
Very clever approach and a great overview of the solution space.

> We made significant investment in investigating this approach coupled with basic incremental updating and have a few small projects in production that takes an approach similar to [this talk][1]. From https://github.com/hasura/graphql-engine/blob/master/archite...

Do you have/know of any findings/lessons learned from these projects?

[1]: https://www.postgresql.eu/events/pgconfeu2018/sessions/sessi...

Re:Ask HN: Is there a way to efficiently subscribe to an SQL... by nerdbaggy on Thursday April 22, 2021 @09:02PM (#26909943)
It’s crazy how well it works. I was skeptical at first but one of projects has 15k complexish subscriptions and it scales amazing. A few Hasura hosts and a single Postgres instance does amazing. 8 cores Postgres instances running at about 20% utilization.
Re:Ask HN: Is there a way to efficiently subscribe to an SQL... by arcticfox on Friday April 23, 2021 @01:35AM (#26911300)
This feels like something I'd naturally use on a frontend, but would it be a dumb idea to use this for backend anything? Like triggering actions off data updates.
Re:Ask HN: Is there a way to efficiently subscribe to an SQL... by mamcx on Thursday April 22, 2021 @11:26PM (#26910677)
I wish this was possible to use without going full to Hasura.
Re:Ask HN: Is there a way to efficiently subscribe to an SQL... by eloff on Friday April 23, 2021 @02:06PM (#26917437)
I advocated Hasura at a prior company I worked at, and came up with a plan to add it incrementally to our existing software. I think this is quite doable.

Why do you see it as an all or nothing choice?

Re:Ask HN: Is there a way to efficiently subscribe to an SQL... by mamcx on Friday April 23, 2021 @04:09PM (#26918663)
Is like Wordpress vs. Flask, I prefer libraries to full frameworks.
Re:Ask HN: Is there a way to efficiently subscribe to an SQL... by eloff on Friday April 23, 2021 @04:15PM (#26918715)
Not everything makes sense as a library. Your database for example.

There's no reason using Hasura requires going "full hasura".