9 comments

  • levkk 1 hour ago
    2026 is the year of the Postgres queue! (DBOS[0], pgQue[1]) It's awesome that the community is contributing this and giving us the option to use it.

    As an ex-app engineer though, I kind of prefer my queue logic to be in code, in Git, but maybe with the right tooling, you can change my mind. :)

    [0]: https://www.dbos.dev/

    [1]: https://github.com/NikolayS/pgque

  • jraedisch 59 minutes ago
    If understanding correctly, Absurd (by the Pi LLM harness devs) minimizes the pure db approach as much as possible. I only just started getting into the topic myself, though.

    https://github.com/earendil-works/absurd

  • kilobaud 1 hour ago
    > When not to use it > … > The workflow mostly lives outside Postgres and spans many heterogeneous systems.

    How is this project at all comparable to something like Temporal? Am I misunderstanding the limitation implied by this particular recommendation?

    • faxmeyourcode 1 hour ago
      I aggree - I'm not understanding the value of the project either if you look at the example here https://github.com/microsoft/pg_durable/blob/main/examples/i...

      It's an interesting technical achievement I guess, but it's very bizarre to try and read this

          SELECT df.start(
              @> (
                  ($$SELECT ... FROM demo.invoices WHERE status = 'pending'$$ |=> 'inv')
                  ~> df.if_rows('inv',
                      $$UPDATE ... SET status = 'processing'$$
                      ~> (df.http(...) |=> 'resp')
                      ~> df.if($$SELECT $r.ok$$,
                          -- classify, branch, wait for signal ...
                      ),
                      df.sleep(5)
                  )
              ),
              'invoice-approval-pipeline'
          );
      • rswail 42 minutes ago
        Without reading any of the doco, it appears to be a job definition called invoice-approval-pipeline that runs every 5 seconds.

        The steps are:

        1. Get all the pending invoices

        2. Set their state to "processing"

        3. Call out to an external service/process to do the actual processing, wait for a response.

        4. If the response is OK, do something

        5. Wait 5 seconds and then start again.

        Not sure I love the syntax and the way SQL is embedded between the $$

        But it is in the database, can be updated and modified in the same way as all the other stored procedures/functions, allows job control, I assume other control structures for parallel steps etc.

        Gonna go read the doco now.

        • franckpachot 9 minutes ago
          "dollar quoting" is the PostgreSQL way to quote strings with quotes, avoiding double quoting or escape characters. I like to use the tagged version of it, like $sql$ SELECT ... $sql$ to describe what is inside.
      • gdecandia 48 minutes ago
        Contributor here - at Microsoft we've built AI workflows on pg_durable and seen it substantially reduce code and increase reliability. Agree that the DSL ergonomics can be improved. Our pipelines use a higher level language and therefore simplified, but pg_durable is meant to solve a wider array of problems. We're happy to take suggestions for improvements.
        • faxmeyourcode 38 minutes ago
          Somebody else in the thread brought up the benefit of snapshotting a database at a point in time stores not only the state of execution but also the code, etc. That is a unique benefit I'd be interested in exploring over storing your orchestration outside of the database.

          Not trying to dismiss the project - it looks like a lot of hard work has gone in and somebody has a use for it. I just come from an airflow style external orchestrator frame of mind that manages durability state in postgres but keeps the control flow out. Sorry if I came off as a bit snarky

  • redmonduser 3 minutes ago
    Seems like an interesting idea to add durability and resumability to lengthy cron jobs.
  • rastignack 15 minutes ago
    I hope it could be used in the future to export pg_dump formated exports to s3.

    One would be able to trigger maintenance jobs via simple lambda functions whose duration is capped.

  • mikey_p 13 minutes ago
    Is this an open sourcing of something they use internally? My first thought on durable jobs was GHA aka Azure Devops.
  • oa335 58 minutes ago
    Can anyone explain why I would want to use this over an orchestration tool that lives outside the DB? Read through the Readme and some of the examples, I still don't get it.
    • rswail 47 minutes ago
      Snapshot PITR of your database means everything restores including the durable jobs at the PIT.

      Don't need to synchronize the backups with anything else that is part of the same data store, good for ETL pipelines and other state machine type jobs.

      If your ETL is mostly SQL anyway, then having the actual job being run on the same server helps as well.

    • thibaut_barrere 51 minutes ago
      You can have well-integrated applicative workflows (eg: progress report on a permalink in your front end app), app-restart-proof resumable workflows, and it avoids adding an extra piece of infrastructure.

      We use Postgres for that on https://transport.data.gouv.fr (Elixir app which does a fair bit of processing), and it helps.

      Not familiar yet with pg_durable though, but I have used or implemented similar solutions and can relate.

    • jpalomaki 52 minutes ago
      It’s sometimes convenient if database is the only ”stateful” component in architecture.

      Also if all the "state" is in one database, then you have better chance of getting consistent backups.

    • gdecandia 42 minutes ago
      Contributor here. At Microsoft, our Postgres customers seem to split pretty evenly into 2 camps, those that want to do as much as they can in the database, and those that agree with your take - want to keep apps and compute outside the DB.
  • faxmeyourcode 1 hour ago
    This feels like the wrong solution to an age old problem solved by the DAG schedulers like Apache Airflow for a while now.

    Why would I want to store my control flow in the database and not in code? It feels strange.

    Not trying to dismiss the project, I'm just not getting it yet I think.

  • cpursley 1 hour ago
    Looks pretty good but I wonder why they didn’t build it on pgmq? If you’re on elixir I maintain a DAG package around this (based on and compatible with pgflow.dev which is TS/Deno).

    https://github.com/agoodway/pgflow