Large analytical tables can make even correct SQL perform poorly if the query scans unnecessary data, joins inefficiently, or aggregates at the wrong stage. Interviewers want to hear how you reason about both SQL structure and execution behavior.
You are asked to explain how you would optimize a query that is running slowly on a multi-terabyte analytics table, such as a Google Ads impression or click fact table. Describe how you would diagnose the bottleneck, rewrite the SQL to reduce work, and decide whether to change table design, indexing, partitioning, or pre-aggregation. You should also explain how you would validate that the optimized query is still correct.
Go beyond generic advice like "add an index" or "use partitioning." A strong answer should cover query-shape improvements, join and aggregation strategy, filtering selectivity, execution-plan analysis, and trade-offs between one-time SQL rewrites and longer-term data-model changes.