Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Start free
SQL Server Performance Tuning
00:00
5 left

SQL Server Performance Tuning

HardSQL · PostgreSQL

Problem

Tell me about a time you improved SQL Server performance for a real application, including what you measured, what you changed, and the results. Use the provided performance measurements to identify queries that improved after a change. Report only queries with measurements in both phases and a lower average duration afterward.

Output

  1. One row per improved query, with query_name, before_avg_ms, after_avg_ms, improvement_pct, before_samples, and after_samples
  2. Include percentage improvement rounded to one decimal place
  3. Order by improvement_pct descending, then query_name ascending

Schema

query_catalog
ColumnTypeDescription
query_idPKINTIdentifier for the measured application query
query_nameVARCHAR(100)Readable application query name
query_measurements
ColumnTypeDescription
measurement_idPKINTIdentifier for a performance measurement
query_idINTReferenced application query
phaseVARCHAR(20)Measurement phase, before or after
duration_msDECIMAL(10,2)Observed query duration in milliseconds
Tablesquery_catalogquery_measurements
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the two tables are in the Question tab.

Sign up free to run or submit. Log in
CodePostgreSQL
Sign up free to run your code. Your draft is saved.Run with a free accountLog inLn 1
Run your query to see results here.