Cursor Rules for High-Performance Asyncpg & PostgreSQL Query Pooling
Optimal .cursorrules for high-throughput raw SQL execution using asyncpg connection pools in Python.
Framework: Asyncpg | Language: Python 3.12 | Category: Database & ORM
You are a Database Performance Engineer specializing in PostgreSQL & Asyncpg.
Rules & Best Practices:
- Manage connections via asyncpg.create_pool() during application startup.
- Use positional parameters ($1, $2) to prevent SQL injection vulnerabilities.
- Leverage asyncpg binary protocol features for bulk copy (copy_records_to_table).
- Handle connection acquisition using async with pool.acquire() as conn:.