Menu

1 / 2

I added a grid_size column. Two months later I dropped it. What I learned about derived state in Postgres.

DEV Community·Forrest Miller·6 months ago
#WYbovb1l
#postgres#database#grid_size#board#column
Reading 0:00
15s threshold

TL;DR : a grid_size INT column on three tables (rooms, players, card_templates) looked like a sane denormalization for a multiplayer bingo game. Two months later I deleted it on all three tables, because the value is tautologically encoded in another column already in those rows. Derived state at read time was simpler, smaller, and less buggy. Here's the trail.

The setup

I'm building BingWow, a free real-time multiplayer bingo platform. Each player has a board JSONB column that stores their cells: clue ids, positions, and image references. Boards are 3×3 (9 cells), 4×4 (16), or 5×5 (25).…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.