Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
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
Get started
Optimizing Distributed Query Performance
00:00
5 left

Optimizing Distributed Query Performance

MediumSQL · PostgreSQL

Problem

How do you optimize query performance in a distributed data environment?

Using the provided tables, write a PostgreSQL query that returns active datasets with at least one failed pipeline run during January 2025.

Output

  1. One row per qualifying dataset with dataset_name, region, failed_runs, and max_duration_seconds
  2. Sort by failed_runs descending, then dataset_name ascending

Schema

datasets
ColumnTypeDescription
dataset_idPKINTUnique dataset identifier
dataset_nameVARCHAR(100)Dataset name
regionVARCHAR(40)Deployment region
owner_teamVARCHAR(80)Owning engineering team
is_activeBOOLEANWhether the dataset is active
pipeline_runs
ColumnTypeDescription
run_idPKINTUnique pipeline run identifier
dataset_idINTDataset processed by the run
statusVARCHAR(20)Pipeline run status
started_atTIMESTAMPPipeline start timestamp
duration_secondsINTRun duration in seconds
Tablesdatasetspipeline_runs
Interviewer

Your question is Optimizing Distributed Query Performance. Start with the requirements and the two tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.