Alex Rivera | Logout

PostgreSQL JSONB vs normalized tables for multi-tenant event metadata

Asked 2026-05-03T11:45:00Z by Alex Rivera
72
We're designing an events table for a multi-tenant SaaS app. Each tenant has different metadata schemas for their events. Option A is a JSONB column with GIN index. Option B is a normalized EAV pattern. We expect ~100M events/month across 500 tenants. What are the query performance trade-offs?
Edit
Report

1 Answer

67
Accepted
At 100M events/month across 500 tenants, JSONB with a GIN index will serve you well - we run a very similar setup at my company. Key tips: (1) Use a partial GIN index per high-volume tenant if query patterns vary. (2) Use jsonb_path_query for complex filters instead of nested -> operators. (3) Partition by tenant_id + month for manageable table sizes. The EAV pattern falls apart at this scale because joins become the bottleneck. One gotcha: JSONB GIN indexes don't help with range queries on nested values - for those you'll need expression indexes.
answered 2026-05-03T15:30:00Z by Alex Rivera

Your Answer