![download pgadmin windows download pgadmin windows](https://i.ytimg.com/vi/7xzW6pseLko/maxresdefault.jpg)
Are you on a network that doesn't support IPv6? Use the connection pooler.Are you connecting to your database and then disconnecting immediately (for example, are you running your code in a serverless environment)? Use the connection pooler in transaction mode.Are you performing operations supported by the Data APIs? We recommend using the APIs.Under Connection string, make sure Use connection pooling is unchecked.You can find the direct connection string in the Database settings inside the dashboard: If you need an IPv4 address, use the connection pooler instead or enable the IPv4 add-on. By default, you can connect to it via IPv6, which isn't supported by all networks. You can also use a direct connection to connect directly to your Postgres database. Under Connection string, make sure Use connection pooling is checked.You can find the connection pool config in the Database settings inside the dashboard: You might run into pooler connection limits since the connection is held till the client disconnects. When a new client connects, a connection is assigned to the client until it disconnects. There is full support for prepared statements in this mode. Session mode is similar to connecting to your database directly. Some session-based Postgres features such as prepared statements are not available with this option. Two consecutive transactions from the same client can be executed over two different connections. A connection is assigned to the client for the duration of a transaction. Transaction mode is recommended if you are connecting from serverless environments. The connection pooler is available in 2 modes: Transaction and Session. This is unlike the direct database connection, which resolves to an IPv6 address, unless you've enabled the IPv4 add-on. It provides an IPv4 endpoint to connect to your database, which you can use if your network provider doesn't support IPv6.To connect to your database efficiently with such tools, you need a pooler. If they connected directly each time, they would quickly exhaust your database server's memory.
![download pgadmin windows download pgadmin windows](https://cdn.comparitech.com/wp-content/uploads/2019/08/PgAdmin-screenshot-1024x576.jpg)
For example, serverless functions and ORMs such as Prisma, Drizzle, and Kysely often make and drop connections to the database.
![download pgadmin windows download pgadmin windows](https://lh3.googleusercontent.com/-5N8pfqUk8zI/YLJoQ5iYYDI/AAAAAAAAASI/KPCYhCMUvJ0FEzErmLlxaW4Rrt4yDxuTQCLcBGAsYHQ/w520-h273/image.png)
The pooler provides 2 important services: Connecting to the database directly vs using a Connection PoolerĮvery Supabase project comes with a connection pooler for managing connections to your database. When the client transaction or session is completed the connection is returned to the pool and is free to be used by another client. When a client makes a request, the pooler "allocates" an available connection to the client. Realtime: listen to database changes over websockets.Ī "connection pool" is a system (external to Postgres) which manages Postgres connections.GraphQL: interact with your database through a GraphQL interface.REST: interact with your database through a REST interface.
![download pgadmin windows download pgadmin windows](https://static.filehorse.com/screenshots/developer-tools/pgadmin-screenshot-05.png)
We provide several types of API to suit your preferences: These are the easiest way to get started if you are managing data (fetching, inserting, updating). Supabase provides auto-updating Data APIs. If you use the database connection string, see the GitHub discussion on how to prepare for IPv6. If you connect to your database using the REST or GraphQL endpoints, this doesn't affect you. Starting from January 26, 2024, projects will be gradually migrated to this behavior. Direct database connections will start resolving to an IPv6 address.