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
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess 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
Build my plan
Indexing Trade-offs for Writes vs Reads
00:00
5 left

Indexing Trade-offs for Writes vs Reads

HardSQL · PostgreSQL

Problem

Explain the impact of indexing strategies on write performance versus read performance in relational and analytical databases. Using the supplied workload and index metadata, write a SQL query that summarizes this tradeoff for active database tables and classifies each table's indexing profile.

Output

  1. One row per active table with both workload and index metadata
  2. Columns: table_name, database_type, read_operations, write_operations, read_write_ratio, index_count, avg_write_amplification_pct, best_read_latency_ms, and indexing_profile
  3. Exclude inactive tables and tables missing either workload or index metadata
  4. Sort by read_write_ratio descending, then table_name ascending

Schema

database_tables
ColumnTypeDescription
table_namePKVARCHAR(100)Database table name
database_typeVARCHAR(30)Relational or analytical database classification
is_activeBOOLEANWhether the table is currently active
index_strategies
ColumnTypeDescription
strategy_idPKINTIndex strategy identifier
table_nameVARCHAR(100)Referenced database table
index_countINTNumber of indexes represented by the strategy
write_amplification_pctDECIMAL(6,2)Estimated additional write work caused by indexing
best_read_latency_msDECIMAL(8,2)Best observed read latency in milliseconds
workload_metrics
ColumnTypeDescription
metric_idPKINTWorkload measurement identifier
table_nameVARCHAR(100)Referenced database table
read_operationsBIGINTObserved read operations
write_operationsBIGINTObserved write operations
Tablesdatabase_tablesindex_strategiesworkload_metrics
Interviewer

Your question is Indexing Trade-offs for Writes vs Reads. Start with the requirements and the three 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.