Query performance matters in financial systems because transaction and account tables grow quickly, and slow SQL can affect reporting, reconciliation, and customer-facing workflows.
You are asked to explain how you would optimize a slow PostgreSQL query that joins large PNC Virtual Wallet transaction tables with account and customer data. Describe how you would diagnose the bottleneck, what parts of the query plan you would inspect, and how you would decide between adding indexes, rewriting joins, or restructuring logic with a CTE.
Discuss how filter selectivity, join order, aggregation, and unnecessary scans affect performance on large datasets. You should also explain when an index helps, when it does not, and how EXPLAIN / EXPLAIN ANALYZE guide your decisions.
The interviewer is looking for a practical optimization framework, not just a list of tips. Focus on PostgreSQL-specific reasoning and trade-offs rather than generic database advice.