Performance Issues
Optimize Supamode performance for large datasets. Add indexes, configure pagination, and reduce query complexity.
If Supamode feels slow when loading tables, searching, or navigating, this guide helps identify and fix performance bottlenecks.
Slow Table Loading
Symptoms
- Data Explorer takes several seconds to load a table
- Spinner shows for extended periods
- Browser becomes unresponsive
Diagnosis
- Open browser DevTools → Network tab
- Reload the page
- Look for slow API requests (sort by Time column)
- Check the request time in the Timing tab
Fixes
1. Add database indexes
For columns you frequently filter or sort on, add indexes:
-- Add index for commonly filtered columnCREATE INDEX idx_orders_status ON orders(status);-- Add index for date columns used in filtersCREATE INDEX idx_orders_created_at ON orders(created_at);-- Composite index for common filter combinationsCREATE INDEX idx_orders_status_created ON orders(status, created_at);2. Limit default data
Configure the table to show fewer records by default. In Settings > Tables, set a default filter or limit.
3. Disable full-text search on large tables
In Settings > Tables, disable searchability for tables with millions of rows. Use specific filters instead.
Slow Global Search
Cause
Global search queries all searchable tables. With many tables or large datasets, this becomes slow.
Fixes
1. Disable search on non-essential tables
In Settings > Tables, disable searchability for:
- Audit logs
- System tables
- Large historical data tables
2. Add text search indexes
For tables that need search, add GIN indexes:
-- Full-text search indexCREATE INDEX idx_posts_search ON postsUSING GIN (to_tsvector('english', title || ' ' || content));Slow Record Detail View
Cause
Loading a record with many relationships (one-to-many, many-to-many) triggers multiple queries.
Fixes
1. Check relationship cardinality
If a record has thousands of related records, consider:
- Paginating relationship views
- Hiding high-cardinality relationships in the detail view
2. Add foreign key indexes
Ensure foreign keys have indexes:
-- Index on foreign key columnsCREATE INDEX idx_order_items_order_id ON order_items(order_id);CREATE INDEX idx_posts_author_id ON posts(author_id);Slow Dashboard Widgets
Symptoms
Dashboard widgets show stale data or take long to refresh.
Fixes
1. Add time-based filters
When creating widgets, add filters like "last 30 days" to limit the data scanned.
2. Create materialized views for complex metrics
For dashboards with complex aggregations:
-- Materialized view for daily metricsCREATE MATERIALIZED VIEW daily_order_stats ASSELECT date_trunc('day', created_at) as day, COUNT(*) as order_count, SUM(total) as revenueFROM ordersGROUP BY 1;-- Refresh periodicallyREFRESH MATERIALIZED VIEW daily_order_stats;Then sync this view into Supamode and use it for widgets.
API Server Performance
Symptoms
- High latency on all requests
- Server CPU or memory usage is high
Diagnosis
Enable performance logging:
# In apps/api/.envPERF_LOG_LEVEL=detailedFixes
1. Use connection pooling
Use Supabase's connection pooler (Supavisor) instead of direct connections:
# Use pooler URLSUPABASE_DATABASE_URL=postgresql://postgres.YOUR_PROJECT:PASSWORD@aws-0-us-east-1.pooler.supabase.com:5432/postgres2. Scale horizontally
For production, run multiple API instances behind a load balancer.
3. Add caching
Supamode caches some queries. For custom implementations, consider Redis for frequently accessed data.
Database-Level Optimization
Check Slow Queries
Use PostgreSQL's query analyzer:
-- Enable query loggingALTER SYSTEM SET log_min_duration_statement = 1000; -- Log queries > 1s-- Find slow queriesSELECT query, calls, mean_time, total_timeFROM pg_stat_statementsORDER BY mean_time DESCLIMIT 10;Analyze Query Plans
For specific slow queries:
EXPLAIN ANALYZESELECT * FROM ordersWHERE status = 'pending'ORDER BY created_at DESCLIMIT 100;Look for:
- Sequential scans on large tables (add index)
- High row estimates (add filters)
- Nested loops (check join conditions)
Vacuum and Analyze
Keep table statistics updated:
-- Update statistics for query plannerANALYZE orders;-- Clean up dead tuplesVACUUM orders;-- Or do bothVACUUM ANALYZE orders;Browser Performance
Symptoms
- UI is sluggish even after data loads
- Scrolling is choppy
- High memory usage
Fixes
1. Reduce visible columns
In table settings, hide columns users don't need. Fewer columns means less rendering.
2. Use pagination
Avoid loading thousands of records. Use pagination controls to limit visible data.
3. Clear browser cache
Sometimes stale cached data causes issues:
Cmd+Shift+R (Mac) or Ctrl+Shift+R (Windows) for hard refreshMonitoring
Track Performance Over Time
- Use Supabase Dashboard → Reports for database metrics
- Check API response times in your hosting platform's metrics
- Set up alerting for slow responses
Performance Checklist
Before production:
- [ ] All filtered columns have indexes
- [ ] Foreign keys have indexes
- [ ] Searchability disabled on large tables
- [ ] Connection pooling enabled
- [ ] Time-based filters on dashboard widgets
- [ ] Pagination configured for large tables