Loading...

Peak Concurrent Batch Jobs

A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.

Domain
SQL
Difficulty
medium
Seniority
mid, senior

Scenario

Capacity planning: the scheduler has a fixed concurrency limit. If peak concurrency exceeds it, jobs queue and SLAs slip. The team needs to know the historical peak so they can set the limit correctly.

Problem

The platform team wants to right-size the job scheduler. Given a batch_jobs table with started and ended timestamps, find the maximum number of jobs that were running at the same time. A job is considered running from its started timestamp up to but not including its ended timestamp.

Practice This Problem

Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.