← All questions
System DesignHard· hybrid architecture· question routing· schema maintenance cost

The data team wants the tables extracted into a warehou...

Refuse the framing that one approach must win. Partition by question type using the derivation: lookup questions name a row and a column and can be answered from a header‑repeated row, so retrieval serves them at about 420 pre‑fill tokens. Aggregation questions involve column‑level properties and cannot be served by retrieval at any k. The decisive cost is not compute but the need to maintain a schema per table shape in the warehouse; this pays off when a few table shapes cover most numeric traffic and collapses when the corpus has hundreds of one‑off layouts. Propose an honest hybrid: extract recurring table shapes into the warehouse, leave the long tail in the vector index, and route queries based on their type.

Code playground (Python)