Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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 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
Build my plan
PostgreSQL Indexing Trade-Offs
00:00
5 left

PostgreSQL Indexing Trade-Offs

HardSQL · PostgreSQL

Problem

Explain the performance trade-offs between different indexing strategies in PostgreSQL.

Compare B-tree, Hash, GIN, GiST, BRIN, multicolumn, partial, and covering indexes. Relate the choices to the representative query and explain read performance, write overhead, storage, selectivity, and maintenance considerations.

Output

  1. Return one row per qualifying asset with asset_id, owner_id, created_at, event_type, and event_time.
  2. Include active assets owned by owner_id 101 whose metadata contains {"channel": "web"}. Preserve assets without a matching event.
  3. Order by created_at descending, then asset_id ascending.

Schema

assets
ColumnTypeDescription
idPKINTAsset identifier
owner_idINTOwning account identifier
statusVARCHAR(20)Current asset status
created_atTIMESTAMPAsset creation timestamp
metadataJSONBSearchable asset metadata
asset_events
ColumnTypeDescription
idPKINTEvent identifier
asset_idINTReferenced asset
event_typeVARCHAR(30)Event classification
event_timeTIMESTAMPEvent timestamp
Tablesassetsasset_events
Interviewer

Your question is PostgreSQL Indexing Trade-Offs. 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.