top | item 32186072

(no title)

shroompasta | 3 years ago

I'm using a pg json column to store data as a second source of truth for data that is primarily held on a separate microservice.

The schema on that end is pretty intricate but to prevent hitting two services for certain types of data, we just dump it to a json column.

Furthermore, for a personal project of mine to help me with productiving / daily schedules, i'm using a json column for a to-do list in the schema of

{[some_todo_item]: boolean,}

which can't traditionally be represented in pg columns as the to do items are variable.

discuss

order

edmundsauto|3 years ago

Do you need schema to be enforced? I guess my question was: "why use a JSON column with an enforced schema to save data, when perfectly good normal pg schema are available?"

Totally get why you would want to just save data in whatever format you send it in, that's how I prototype as well. But a regular column has the advantage of familiarity with other devs, not to mention better syntax for querying.