EPISODE · Jun 26, 2026 · 6 MIN
Why Database Indexes on JSON Fields Fail in Production
from Database Tech with Fexingo: SQL, NoSQL, and Data Storage Conversations · host Fexingo
Lucas and Luna dig into a subtle database pitfall: indexing JSON fields inside Postgres and MySQL. They walk through a real production case where a developer added a GIN index on a JSONB column, only to find query times actually increased for certain lookup patterns. The problem: JSON indexes don't behave like simple B-tree indexes; they store the entire JSON structure, and queries that don't use the right operators or that touch only a few keys can still trigger full scans. Lucas explains the difference between GIN and B-tree indexes, the role of JSON path operators, and why the query planner sometimes chooses a sequential scan even with an index present. Luna brings up a practical example from an e-commerce catalog where millions of rows with JSON attributes caused mysterious slowdowns. They also discuss alternatives: extracted generated columns, partial indexes, and when it's better to normalize the JSON keys into separate columns. The takeaway: JSON indexes can help, but only if you understand the query patterns and index types involved. Otherwise, they add overhead without benefit. #JSONIndexing #PostgreSQL #MySQL #GIN #BTree #QueryOptimization #DatabasePerformance #IndexDesign #GeneratedColumns #PartialIndex #Normalization #Ecommerce #ProductionDebug #Technology #DataEngineering #FexingoBusiness #BusinessPodcast #DatabaseTech Keep every episode free: buymeacoffee.com/fexingo
Embed this episode
Ready to play
Why Database Indexes on JSON Fields Fail in Production
No transcript for this episode yet
Similar Episodes
No similar episodes found.
Similar Podcasts
No similar podcasts found.