mirror of
https://github.com/supabase/supabase.git
synced 2026-07-05 03:24:19 +08:00
38 lines
1.6 KiB
Plaintext
38 lines
1.6 KiB
Plaintext
---
|
|
id: connecting-to-postgres
|
|
title: "Overview"
|
|
description: There are various ways to connect to your Postgres database.
|
|
---
|
|
|
|
# Overview
|
|
|
|
Supabase provides several options for connection to your Postgres database:
|
|
|
|
- HTTP connections using the API.
|
|
- Direct connections using Postgres' standard connection system.
|
|
- Connection pooling using PgBouncer.
|
|
|
|
## HTTP
|
|
|
|
Supabase provides an auto-updating API. This is the easiest way to get started if you are managing data (fetching, inserting, updating). However you cannot manage the database schema
|
|
via the API (for security reasons). To do that you can either use the dashboard we provide or connect directly to your database.
|
|
|
|
## Direct vs Connection Pooling
|
|
|
|
A "direct connection" is when a connection is made to the database using Postgres' native connection implementation.
|
|
|
|
A "connection pool" is a system (external to Postgres)
|
|
which manage connections, rather than Postgres' native system.
|
|
|
|
Why would you use a connection pool? Primarily because the way that Postgres handles connections isn't very scalable for a large number of _temporary_ connections.
|
|
You can use these simple questions to determine which connection method to use:
|
|
|
|
- Are you connecting to a database and _maintaining_ a connection? If yes, use a direct connection.
|
|
- Are you connecting to your database and then _disconnecting_ immediately (e.g. a serverless environment)? If yes, use a connection pool.
|
|
|
|
## Resources
|
|
|
|
- [Direct Connections](/docs/guides/database/connecting/direct-connections).
|
|
- [Connection Pooling](/docs/guides/database/connecting/connection-pooling).
|
|
|