Skip Navigation
InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)CH
ChimpScanner @programming.dev
Posts 0
Comments 2
Call for Assistance
  • I shortly looked through the source code for Lemmy, and it's using a Rust ORM named Diesel. I don't know Rust at all, but it seems like in order to add the ability for pgbouncer, two things would need to be done.

    1. There would have to be separate environment variables for a direct connection to the database, to run migrations. Prisma (an ORM for Node.js, which I am more familiar with) does something similar: https://www.prisma.io/docs/data-platform/data-proxy/prisma-cli-with-data-proxy#set-a-direct-database-connection-url-in-your-prisma-schema. From my understanding, pgbouncer is essentially a queue for the database. So if you have a bunch of things in the queue, it will delay your migrations from running.
    2. Once step 1 is completed, the regular database environment variables can point to the pgbouncer connection pool. Based on the pgbouncer documentation: PgBouncer acts as a Postgres server, so simply point your client to the PgBouncer port.

    Like I said, I don't know Rust but I would be interested in learning it if I have time. Or maybe someone else in the open-source community could work on this. There's no specific issue for adding pgbouncer support, but there's an issue about slow SQL queries that mentions it: https://github.com/LemmyNet/lemmy/issues/2877