3.9 KiB
Fix: Database Size Quota Exceeded
Problem
Your Supabase project has been restricted due to exceeding the database size quota:
Service for this project is restricted due to the following violations: exceed_db_size_quota
Immediate Solutions
Option 1: Contact Supabase Support (Recommended)
- Go to Supabase Support: https://supabase.help
- Explain your situation - You need access restored
- Request options:
- Temporary quota increase while you clean up
- Upgrade to a paid plan
- Guidance on reducing database size
Option 2: Upgrade Your Plan
- Go to Supabase Dashboard → Settings → Billing
- Upgrade to a paid plan with higher storage limits
- This will immediately restore access
Option 3: Reduce Database Size
If you have access to the dashboard, you can:
-
Check current database size:
- Go to Database → Database Size
- See which tables are using the most space
-
Clean up old data:
-- Example: Delete old options flow data (older than 90 days) DELETE FROM "OptionsFlow_monthly" WHERE "CreatedDate" < NOW() - INTERVAL '90 days'; -- Example: Delete old price data (keep only last 30 days) DELETE FROM prices_intraday_1m WHERE ts < NOW() - INTERVAL '30 days'; -
Archive instead of delete:
- Move old data to archive tables
- Or export to external storage (S3, etc.)
-
Optimize tables:
-- Vacuum to reclaim space VACUUM FULL; -- Reindex tables REINDEX DATABASE postgres; -
Check for large indexes:
-- Find large indexes SELECT schemaname, tablename, indexname, pg_size_pretty(pg_relation_size(indexrelid)) AS index_size FROM pg_stat_user_indexes ORDER BY pg_relation_size(indexrelid) DESC LIMIT 20;
Temporary Workaround: Use Supabase Client
While waiting for quota resolution, you can try using the Supabase client with API keys (if the API is still accessible):
-
Get your API keys:
- Go to Supabase Dashboard → Settings → API
- Copy:
- Project URL:
https://mycttyevrycmkhlvwgfk.supabase.co - service_role key
- Project URL:
-
Update
backend/.env:# Remove DATABASE_URL (direct connection won't work) # DATABASE_URL=... # Use Supabase client SUPABASE_URL=https://mycttyevrycmkhlvwgfk.supabase.co SUPABASE_SERVICE_KEY=your_service_role_key_here PORT=3010 NODE_ENV=development CORS_ORIGIN=http://localhost:5173
Note: This may still not work if the entire project is restricted, but it's worth trying.
Prevention: Monitor Database Size
Once access is restored, set up monitoring:
-
Create a monitoring query:
SELECT pg_database.datname, pg_size_pretty(pg_database_size(pg_database.datname)) AS size FROM pg_database ORDER BY pg_database_size(pg_database.datname) DESC; -
Set up alerts in Supabase Dashboard for database size
-
Implement data retention policies:
- Automatically archive/delete old data
- Keep only necessary historical data
- Use partitioning for large tables
Recommended Data Retention Strategy
For a trading system, consider:
- Options Flow: Keep last 90 days active, archive older
- Price Data (1m): Keep last 30 days, aggregate to 5m/15m for older
- Daily Data: Keep indefinitely (small size)
- Alerts: Keep last 90 days, archive older
Next Steps
- ✅ Immediate: Contact Supabase support at https://supabase.help
- ✅ Short-term: Clean up old data if you can access the database
- ✅ Long-term: Upgrade plan or implement data retention policies
Supabase Plan Limits
Check your current plan limits:
- Free Plan: 500 MB database size
- Pro Plan: 8 GB database size
- Team Plan: 8 GB database size (with more features)
Consider upgrading if you need more storage for historical trading data.