Dosu LogoDosu Logo
Ask
Join our Discord
Organization avatar
HelmorPublic
Caspian's Workspace
DocumentsHelmor
conn-limits
conn-limits
Type
External
Status
Published
Created
Jul 14, 2026
Updated
Jul 14, 2026
Source
.agents/skills/supabase-postgres-best-practices/rules/conn-limits.md

Set Appropriate Connection Limits#

Too many connections exhaust memory and degrade performance. Set limits based on available resources.

Incorrect (unlimited or excessive connections):

-- Default max_connections = 100, but often increased blindly
show max_connections; -- 500 (way too high for 4GB RAM)

-- Each connection uses 1-3MB RAM
-- 500 connections * 2MB = 1GB just for connections!
-- Out of memory errors under load

Correct (calculate based on resources):

-- Formula: max_connections = (RAM in MB / 5MB per connection) - reserved
-- For 4GB RAM: (4096 / 5) - 10 = ~800 theoretical max
-- But practically, 100-200 is better for query performance

-- Recommended settings for 4GB RAM
alter system set max_connections = 100;

-- Also set work_mem appropriately
-- work_mem * max_connections should not exceed 25% of RAM
alter system set work_mem = '8MB'; -- 8MB * 100 = 800MB max

Monitor connection usage:

select count(*), state from pg_stat_activity group by state;

Reference: Database Connections

Documents
01 - Get Started
01 - Introduction
02 - Install Helmor
03 - Add a Repository
04 - Create a Workspace
05 - Send Your First Agent Task
02 - Core Concepts
01 - Repository
02 - Workspace
03 - Session
04 - Agent
05 - Changes and Review
06 - GitHub Integration
03 - User Workflows
01 - Start a New Task
02 - Review Agent Changes
03 - Continue an Existing Session
04 - Commit and Ship Work
05 - Use Multiple Agents Safely
04 - Developer Setup
01 - Local Development Setup
02 - Architecture Overview
03 - Frontend Overview
04 - Backend Overview
05 - Sidecar Overview
06 - Testing Guide
07 - Debugging Guide
05 - Troubleshooting
01 - Agent Not Responding
02 - GitHub Authentication Issues
03 - Workspace Errors
04 - Sidecar and CLI Issues
05 - Logs and Diagnostics
7-data-driven-checks-to-ensure-your-documentation-roi-is-high
AGENTS
AGENTS
AGENTS
CHANGELOG
CLAUDE
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
README
SKILL
SKILL
SKILL
STRIPE_README
[tag]
_template
advanced-full-text-search
advanced-jsonb-indexing
ai-contributions-open-source
ai-is-better-at-maintaing-docs-than-humans
april-2025-newsletter-dosu-does-docs
august-2025-dosu-drop
automating-github-issue-triage
better-agent-testing-with-distributed-dependency-injection
blog_template
building-the-future-of-knowledge-management-june-dosu-drop
celery-preserializers-a-low-friction-path-to-pydantic-support
channel-creation-github-repository
channel-creation-slack-channel
ci-jobs
cncf-dosu-case-study
combating-open-source-maintainer-burnout-with-automation
concepts-channel
concepts-data-sources
concepts-interactions
configuration
confluence_edited_markdown
confluence_original_markdown
conn-idle-timeout
conn-limits
conn-pooling
conn-prepared-statements
data-batch-inserts
data-n-plus-one
data-pagination
data-upsert
december-2025-dosu-drop
default
devin
docling-open-source-growth-with-dosu
dosus-new-fact-based-reasoning-agent-is-generally-available
features-auto-labeling
features-generate-docs
features-issue-triage-qa
features-maintain-docs
february-2025-newsletter-introducing-spaces
from-maintenance-to-innovation-freeing-developers-with-ai-automation
george-xu
github-configuration
github-features-dosu-in-first-awesome-continuous-ai-list
github-installation
how-dosu-used-langsmith-to-achieve-a-30-accuracy-improvement-with-no-prompt-engineering
how-lancedb-supercharged-our-knowledge-graph
how-preset-keeps-apache-superset-healthy
how-triliumnext-revitalized-an-abandoned-open-source-project-with-dosus-help
index
index
internal-vs-external-documentation-audience-first
iterating-towards-llm-reliability-with-evaluation-driven-development
january-2026-dosu-drop
july-dosu-drop-public-spaces-enter-the-chat
knowledge-management-in-the-ai-era-why-documentation-is-more-critical-than-ever
li-zheng
lock-advisory
lock-deadlock-prevention
lock-short-transactions
lock-skip-locked
march-2025-newsletter-dosu-knows
marcos
markdown
mastering-auto-labeling-taming-the-backlog-with-intelligent-labels
may-2025-dosu-drop-new-agent-self-serve-pricing-fresh-look
member-invitation
michael-ludden
michael-mangus
migrate-celery-to-dbos-dosu
monitor-explain-analyze
monitor-pg-stat-statements
monitor-vacuum-analyze
notion_edited_markdown
notion_original_markdown
november-2025-dosu-drop
october-2025-dosu-drop
onboarding-introduction
onboarding-key-concepts
onboarding-quickstart
open-source-labeling-best-practices
page
page
pages
photos
pull_request_template
query-composite-indexes
query-covering-indexes
query-index-types
query-missing-indexes
query-partial-indexes
reliable-data-orchestration-for-ai-applications
response-previews
scaling-support-and-documentation-at-Dify-one-of-the-fastest-growing-oss-projects
schema-data-types
schema-foreign-key-indexes
schema-lowercase-identifiers
schema-partitioning
schema-primary-keys
security-privileges
security-rls-basics
security-rls-performance
september-2025-dosu-drop
settings
slack-configuration
slack-installation
sparrowhawk
taylor-dolezal
the-code-understanding-paradox-when-ai-makes-writing-code-fast-but-understanding-it-slow
top-5-zombie-problems-resurrected-by-ai-tools
using-ai-to-generate-and-maintain-documentation
what-lodashs-issue-backlog-reveals-about-oss-burnout
what-the-mythical-man-month-got-right-about-documentation
word2vec-to-transformers-ai-evolution