Overview
Percify performance strategy focuses on query consolidation, targeted indexing, and selective caching. Internal improvements documented in feed and dashboard optimization guides are summarized here for end users and integrators.Key Improvements
| Area | Technique | Result |
|---|---|---|
| Dashboard Counts | UNION + filtered COUNT | 800ms → ~150ms |
| Feed/Explore Query | 9 targeted indexes | 1900ms → 500–700ms |
| Caching | CDN + stale-while-revalidate | Cache hits ~50–100ms |
| Counting Strategy | Approx reltuples estimates | Reduced expensive window functions |
Dashboard Aggregation Pattern
Feed Query Principles
| Principle | Benefit |
|---|---|
| Remove COUNT(*) OVER | Avoid full-table scans |
| Replace EXISTS with LEFT JOIN | Utilize composite indexes |
| Partial indexes on visibility | Reduce filtered row set |
| Separate trending index | Faster popularity sorting |
Caching Strategy
| Header | Value |
|---|---|
Cache-Control | public, max-age=300, stale-while-revalidate=600 |
Vary | Accept-Encoding |
Monitoring Recommendations
- Log query durations >500ms
- Record generation job queue latency percentiles
- Track cache hit ratios per endpoint
Scalability Tips for Integrators
| Scenario | Recommendation |
|---|---|
| Burst avatar generation | Queue jobs + show optimistic UI |
| Large feed pagination | Use estimated total counts for infinite scroll |
| High video durations | Batch long renders off peak |
| Heavy audio synthesis | Reuse voice profiles to skip cloning cost |
Future Enhancements
- Materialized view fallback for extreme volumes
- Adaptive cost suggestions (dynamic UX based on balance)
- Background warm-up of popular assets
Troubleshooting
| Symptom | Cause | Action |
|---|---|---|
| Slow dashboard load | Missing indexes | Re-run optimization migration |
| Feed latency spikes | Cold cache / index bloat | VACUUM ANALYZE + ensure CDN caching |
| Generation queue delays | Concurrency saturation | Increase worker pool or throttle client |
Related Pages
- [/percify/architecture]
- [/percify/credits]
- [/percify/faq]
Have questions? See [/percify/faq].