slack status without the slack status.zzstoatzz.io/
quickslice

fix: add database indexes for performance optimization

Closes #1

Add two indexes to improve query performance:
- idx_status_startedAt: Speeds up feed queries that ORDER BY startedAt DESC
- idx_status_authorDid_startedAt: Speeds up user status queries with WHERE authorDid = ? ORDER BY startedAt DESC

These indexes will significantly improve performance as the status table grows,
especially important now with infinite scrolling on the feed page.

+16
+16
src/db.rs
··· 50 50 .unwrap(); 51 51 52 52 // Note: custom_emojis table removed - we serve emojis directly from static/emojis/ directory 53 + 54 + // Add indexes for performance optimization 55 + // Index on startedAt for feed queries (ORDER BY startedAt DESC) 56 + conn.execute( 57 + "CREATE INDEX IF NOT EXISTS idx_status_startedAt ON status(startedAt DESC)", 58 + [], 59 + ) 60 + .unwrap(); 61 + 62 + // Composite index for user status queries (WHERE authorDid = ? ORDER BY startedAt DESC) 63 + conn.execute( 64 + "CREATE INDEX IF NOT EXISTS idx_status_authorDid_startedAt ON status(authorDid, startedAt DESC)", 65 + [], 66 + ) 67 + .unwrap(); 68 + 53 69 Ok(()) 54 70 }) 55 71 .await?;