Skip to content

Commit c2170be

Browse files
committed
chore: adjust postgres connection pool default settings
1 parent 1663746 commit c2170be

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

docs/docs/core/settings.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ If not set, all flows are in a default unnamed namespace.
9696

9797
:::
9898

99-
* `max_connections` (type: `int`, default: `64`): The maximum number of connections to keep in the pool.
99+
* `max_connections` (type: `int`, default: `25`): The maximum number of connections to keep in the pool.
100100

101101
*Environment variable* for `Settings.database.max_connections`: `COCOINDEX_DATABASE_MAX_CONNECTIONS`
102102

103-
* `min_connections` (type: `int`, default: `16`): The minimum number of connections to keep in the pool.
103+
* `min_connections` (type: `int`, default: `5`): The minimum number of connections to keep in the pool.
104104

105105
*Environment variable* for `Settings.database.min_connections`: `COCOINDEX_DATABASE_MIN_CONNECTIONS`
106106

@@ -134,7 +134,7 @@ This is the list of environment variables, each of which has a corresponding fie
134134
| `COCOINDEX_DATABASE_URL` | `database.url` | Yes |
135135
| `COCOINDEX_DATABASE_USER` | `database.user` | No |
136136
| `COCOINDEX_DATABASE_PASSWORD` | `database.password` | No |
137-
| `COCOINDEX_DATABASE_MAX_CONNECTIONS` | `database.max_connections` | No (default: `64`) |
138-
| `COCOINDEX_DATABASE_MIN_CONNECTIONS` | `database.min_connections` | No (default: `16`) |
137+
| `COCOINDEX_DATABASE_MAX_CONNECTIONS` | `database.max_connections` | No (default: `25`) |
138+
| `COCOINDEX_DATABASE_MIN_CONNECTIONS` | `database.min_connections` | No (default: `5`) |
139139
| `COCOINDEX_SOURCE_MAX_INFLIGHT_ROWS` | `global_execution_options.source_max_inflight_rows` | No (default: `1024`) |
140140
| `COCOINDEX_SOURCE_MAX_INFLIGHT_BYTES` | `global_execution_options.source_max_inflight_bytes` | No |

python/cocoindex/setting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class DatabaseConnectionSpec:
4444
url: str
4545
user: str | None = None
4646
password: str | None = None
47-
max_connections: int = 64
48-
min_connections: int = 16
47+
max_connections: int = 25
48+
min_connections: int = 5
4949

5050

5151
@dataclass

src/lib_context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ impl DbPools {
196196
let pool_options = PgPoolOptions::new()
197197
.max_connections(conn_spec.max_connections)
198198
.min_connections(conn_spec.min_connections)
199-
.acquire_timeout(Duration::from_secs(5 * 60))
200-
.idle_timeout(Duration::from_secs(10 * 60))
201-
.max_lifetime(Duration::from_secs(60 * 60));
199+
.acquire_slow_level(log::LevelFilter::Info)
200+
.acquire_slow_threshold(Duration::from_secs(10))
201+
.acquire_timeout(Duration::from_secs(5 * 60));
202202
let pool = pool_options
203203
.connect_with(pg_options)
204204
.await

0 commit comments

Comments
 (0)