
Query tuning matters because slow SQL can become the main bottleneck in ETL jobs, dashboards, and operational reporting. For a data engineer, the interviewer usually wants a practical, repeatable approach rather than isolated tips.
Explain how you approach performance tuning for a slow SQL query in PostgreSQL. You should cover how you identify the bottleneck, what you inspect in the execution plan, how you reason about joins and filtering, when you add or change indexes, and how you decide whether a CTE or query rewrite will help.
Answer at a medium level: show a step-by-step process, mention concrete PostgreSQL tools such as EXPLAIN (ANALYZE, BUFFERS), and discuss trade-offs. You do not need to go deep into server configuration, but you should show that you can move from symptom to root cause and validate that a change actually improves performance.