Database Issues
This guide covers common database and storage problems.PostgreSQL Connection Failed
Symptom:psycopg2.OperationalError: could not connect to server
Solutions:
1. Cloud SQL Proxy Not Running
2. Wrong Connection String
3. SSL Mode Mismatch
4. Database Does Not Exist
Redis Out of Memory
Symptom:OOM command not allowed when used memory > 'maxmemory'
Solutions:
1. Increase Memory Limit
2. Configure Eviction Policy
3. Use Redis Persistence
4. Clear Unnecessary Keys
Redis Connection Errors
Symptom:redis.exceptions.ConnectionError: Error connecting to redis
Diagnosis:
1. Wrong Redis URL
2. Redis Not Ready
3. Authentication Required
Session Storage Failures
Symptom: Sessions lost between requests or not persisting Diagnosis:1. Session TTL Too Short
2. Session Serialization Error
3. Redis Eviction
Database Migration Failures
Symptom:alembic.util.exc.CommandError: Can't locate revision
Solutions:
1. Run Pending Migrations
2. Reset Migration State (Development Only)
3. Missing Migration Files
Connection Pool Exhaustion
Symptom:TimeoutError: QueuePool limit of X overflow Y reached
Solutions:
1. Increase Pool Size
2. Connection Leak
3. Long-Running Transactions
Slow Database Queries
Symptom: Queries taking seconds to complete Diagnosis:1. Add Missing Indexes
2. Optimize Query
3. Enable Query Caching
Still Having Issues?
For advanced database troubleshooting:- Enable Query Logging: Set
SQLALCHEMY_ECHO=True - Check Connection Count:
SELECT count(*) FROM pg_stat_activity; - Review Documentation: See deployment guide
- Report Bug: Create an issue