Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Database Trade-Offs for Detection
00:00
5 left

Database Trade-Offs for Detection

HardSQL · PostgreSQL

Problem

Explain the trade-offs between different database architectures in the context of a financial crime detection system.

Write a SQL query that summarizes completed detection runs for each architecture and exposes comparable operational trade-offs through latency, alerts, cost, and throughput metrics.

Output

  1. One row per architecture, including architectures with no completed runs.
  2. Columns: architecture_name, run_count, avg_latency_ms, total_alerts, avg_cost_usd, and avg_throughput_tx_per_sec.
  3. Sort by average latency ascending, place missing latency values last, then sort by architecture name.

Schema

architectures
ColumnTypeDescription
architecture_idPKINTUnique architecture identifier
architecture_nameVARCHAR(100)Architecture name
architecture_typeVARCHAR(50)Broad database architecture category
detection_runs
ColumnTypeDescription
run_idPKINTUnique detection run identifier
architecture_idINTReferenced architecture
statusVARCHAR(20)Run status
latency_msDECIMAL(10,2)End-to-end detection latency in milliseconds
alert_countINTNumber of alerts generated
cost_usdDECIMAL(10,2)Estimated run cost in US dollars
transactions_processedBIGINTNumber of transactions processed
runtime_secondsDECIMAL(10,2)Run duration in seconds
Tablesarchitecturesdetection_runs
Interviewer

Your question is Database Trade-Offs for Detection. 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.