Whenever you're ready, walk me through how you'd approach this.
How do you approach optimizing query performance for large datasets?
Discuss how you diagnose bottlenecks, improve query design, evaluate indexes, and validate that changes help. Include relevant PostgreSQL tools, trade-offs, and risks such as stale statistics, inefficient joins, and excessive memory or disk usage.