PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/System Design/Instacart

Design a hierarchical catalog service

Last updated: Mar 29, 2026

Quick Overview

This question evaluates system design and data modeling skills for hierarchical data, covering relational schema design, API surface definition, query performance, caching, and data integrity concerns in a product catalog context.

  • hard
  • Instacart
  • System Design
  • Software Engineer

Design a hierarchical catalog service

Company: Instacart

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Onsite

Design a product catalog service that supports hierarchical categories implemented with a self-referencing table. Requirements: ( 1) Define the core read/write APIs (e.g., createCategory, moveCategory, listChildren, getBreadcrumbs, createProduct, updateAttributes, attachProductToCategory, search/filter/paginate products within a category). ( 2) Propose the relational schema, including a Categories table with a self-join (id, parent_id, name, path/slug, sort_order), a Products table (id, sku, name, attributes JSON, status), and a ProductCategory join table; discuss indexes required for fast tree traversal and product listing. ( 3) Explain strategies to query the full subtree efficiently (e.g., adjacency list with recursive CTEs vs. materialized paths vs. closure tables) and the trade-offs among them. ( 4) Address scaling: caching hot category pages, pagination, denormalized search indexes, consistency choices, write patterns (bulk imports), and multi-region read replicas. ( 5) Cover data integrity (cycles prevention, referential constraints), API versioning, and rollout plans for schema changes.

Quick Answer: This question evaluates system design and data modeling skills for hierarchical data, covering relational schema design, API surface definition, query performance, caching, and data integrity concerns in a product catalog context.

Related Interview Questions

  • Design an inventory management system - Instacart (medium)
  • Design cloud storage with quotas and compression - Instacart (hard)
  • Design an e-commerce catalog - Instacart (medium)
  • Design scalable inventory system and avoid races - Instacart (hard)
  • Design an inventory system - Instacart (medium)
Instacart logo
Instacart
Jul 31, 2025, 12:00 AM
Software Engineer
Onsite
System Design
9
0

Design a Product Catalog Service with Hierarchical Categories

Context

Design a read-heavy product catalog for an e-commerce application. Categories are hierarchical (tree) and implemented using a self-referencing relational table. Products can belong to one or more categories. The service must expose read/write APIs, support efficient subtree queries, and scale for high-traffic browsing.

Assumptions (you may refine during discussion):

  • Primary database is relational (e.g., PostgreSQL/MySQL).
  • Category updates are infrequent compared to reads; product updates are moderate; product browsing is heavy.
  • Soft-deletes preferred; strong consistency for writes within the database; eventually consistent caches/search.

Requirements

  1. Define core APIs (read/write):
    • createCategory, updateCategory, moveCategory, deleteCategory
    • listChildren, getBreadcrumbs, getSubtreeSummary
    • createProduct, updateAttributes
    • attachProductToCategory, detachProductFromCategory
    • search/filter/paginate products within a category (optionally include descendants)
  2. Propose a relational schema:
    • Categories table with self-join: id, parent_id, name, slug, path/materialized identifier, sort_order
    • Products table: id, sku, name, attributes JSON, status
    • ProductCategory join table
    • Describe indexes for fast tree traversal and product listing
  3. Explain subtree query strategies and trade-offs:
    • Adjacency list with recursive CTEs
    • Materialized paths
    • Closure tables (ancestor/descendant pairs)
  4. Address scaling:
    • Caching hot category pages and product lists
    • Pagination approach
    • Denormalized search indexes
    • Consistency choices
    • Write patterns (bulk imports)
    • Multi-region read replicas
  5. Cover data integrity and change management:
    • Prevent cycles; enforce referential integrity
    • API versioning
    • Rollout plans for schema changes

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Instacart•More Software Engineer•Instacart Software Engineer•Instacart System Design•Software Engineer System Design
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.