Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Diagnose Holiday Latency Spikes

HardSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Diagnose Holiday Latency Spikes. Start with the requirements and the two tables on the right.

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.

Problem

You are given database telemetry for a customer’s Blue Yonder environment during a holiday peak window. Write a PostgreSQL query that returns the hourly periods where database latency spiked sharply, along with the workload and infrastructure signals most likely associated with the spike. Your result should compare each hour to the previous hour, flag the spike hours, and include the database, hour, latency, query volume, CPU, and active connections.

Schema

db_latency_metrics
ColumnTypeDescription
metric_idPKINTPrimary key for the hourly metric row
database_nameVARCHAR(100)Name of the customer database
metric_hourTIMESTAMPHourly timestamp for the metric snapshot
avg_latency_msNUMERIC(10,2)Average database latency in milliseconds
query_countINTNumber of queries processed in the hour
active_connectionsINTActive database connections during the hour
cpu_utilization_pctNUMERIC(5,2)CPU utilization percentage for the hour
holiday_calendar
ColumnTypeDescription
calendar_datePKDATEHoliday date
holiday_nameVARCHAR(100)Holiday or peak-period label
is_peak_hourBOOLEANWhether the date belongs to the peak holiday window
Tablesdb_latency_metricsholiday_calendar
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results