Awesome Reviewers

Default schemas should be designed for (a) correct capacity/performance assumptions and (b) efficient, queryable storage.

1) Use correct cardinality math for sizing

2) Prefer JSONB for “array-like” / structured columns you will query

Example (JSONB-backed tags):

CREATE TABLE orders (
  order_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  tenant_id VARCHAR(255) NOT NULL,
  status VARCHAR(50) NOT NULL,
  tags JSONB,
  metadata JSONB
);

-- Query JSONB array contents
-- (works directly on JSONB)
SELECT jsonb_array_elements_text(tags);

-- Filter by array containment
SELECT *
FROM orders
WHERE tags @> '["urgent"]';

-- Key-existence checks
SELECT *
FROM orders
WHERE tags ? 'shipped';

Practical checks