Connection pooling ચાર પણ ક્લાયંટ રિક્વેસ્ટમાં ડેટાબેસ કનેક્શનના એક નાના સમૂહનો પુનઃઉપયોગ કરે છે, તેના બદલે પ્રતિ રિક્વેસ્ટ એક નવું કનેક્શન ખોલે છે. PostgreSQL કનેક્શનો મોંઘા છે (દરેક એક અલગ પ્રક્રિયા છે જે નોંધપાત્ર મેમરી ઉપયોગ કરે છે), તેથી લોડ હેઠળ કામગીરી અને સ્કેલેબિલિટી માટે પૂલિંગ આવશ્યક છે. PgBouncer એ માનક પૂલર છે.
સમસ્યા: PostgreSQL કનેક્શનો મોંઘા છે
Each PostgreSQL connection = a separate OS PROCESS, using ~5-10MB of memory.
✗ Opening a connection has overhead (process creation, auth, setup)
✗ Many connections (e.g. 1000s from a busy app) → huge memory use, contention
✗ Postgres has a max_connections limit (often ~100); exceeding it = errors
→ Opening/closing a connection per request, or holding thousands open, doesn't scale.
