Documentation Index
Fetch the complete documentation index at: https://cekolah.help/llms.txt
Use this file to discover all available pages before exploring further.
Connection Pooling
Vercel menggunakan serverless functions — setiap request bisa membuat koneksi database baru. Tanpa pooling, ini bisa menyebabkan terlalu banyak koneksi ke database. PlanetScale sudah menyediakan PgBouncer (connection pooler) secara bawaan. Kamu cukup menggunakan URL yang tepat.Kenapa Perlu Connection Pooling?
Cara Menggunakan Pooled Connection
Tambahkan?pgbouncer=true ke connection string:
Rekomendasi untuk Project Cekolah
| Environment | Tipe Connection | Alasan |
|---|---|---|
| Vercel Production | Pooled | Serverless, banyak request concurrent |
| Vercel Preview | Pooled | Sama seperti production |
| Development lokal | Direct | bun dev punya koneksi persistent |
| Migrations | Direct | PgBouncer tidak support prepared statements yang dibutuhkan migrations |
| Drizzle Studio | Direct | Butuh koneksi langsung |
Tips
- PlanetScale plan gratis memiliki batas koneksi. Selalu gunakan pooled connection di production.
- Batas koneksi Drizzle di project ini: 2 untuk production, 10 untuk development.
- Jika dapat error
too many connections, periksa apakah kamu menggunakan pooled URL.