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
ExperiencesCoaching
New
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
Get started
Choose PostgreSQL Indexing Strategies
00:00
5 left

Choose PostgreSQL Indexing Strategies

HardSQL · PostgreSQL

Problem

A PostgreSQL system contains entity, record, and event data with JSONB attributes, status values, and timestamp-based access patterns. Create the recommended indexes for these workload patterns, then return their catalog definitions.

Output

  1. Return one row per requested index.
  2. Return columns index_name and index_definition.
  3. Include the five requested indexes, ordered alphabetically by index name.
  4. The index definitions must show the verification schema used by the PostgreSQL catalog.

Schema

entities
ColumnTypeDescription
entity_idPKINTEntity identifier
external_codeVARCHAR(40)Unique external lookup code
entity_typeVARCHAR(30)Entity classification
attributesJSONBFlexible entity attributes
records
ColumnTypeDescription
record_idPKINTRecord identifier
entity_idINTReferenced entity
statusVARCHAR(20)Record status
created_atTIMESTAMPRecord creation timestamp
payloadJSONBRecord payload
events
ColumnTypeDescription
event_idPKINTEvent identifier
record_idINTReferenced record
event_typeVARCHAR(30)Event classification
occurred_atTIMESTAMPEvent timestamp
detailsJSONBEvent details
Tablesentitiesrecordsevents
Interviewer

Your question is Choose PostgreSQL Indexing Strategies. 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.