Re: Json table/column design question

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Json table/column design question
Дата
Msg-id CAKFQuwbDLizRmcrc5=e5AMdsgZ1DrxBNuvrudcrCdeHaOKDPZw@mail.gmail.com
обсуждение исходный текст
Ответ на Json table/column design question  (Skorpeo Skorpeo <skorpeo11@gmail.com>)
Список pgsql-general
On Wednesday, May 22, 2024, Skorpeo Skorpeo <skorpeo11@gmail.com> wrote:
Hi,

I was wondering if having unrelated columns in a table is a sound approach when using json.  In other words, if I have two collections of unrelated json objects, for example "Users" and "Inventory", would it be ok to have one table with a "Users" column and a "Inventory" column?  My concern is that from a row perspective the columns could be different lengths, such as more inventory items as users.  And for any given row the data in one column would have no relation to another column. I would only query a single column at a time.

Would this approach be ok or are there pitfalls such that it would be advantageous/recommended to have a separate table for each column?

Any thoughts/inputs are greatly appreciated.

What do you expect to gain?  The relational model and normalization has earned its longevity, I suggest you learn and apply those techniques.  Which generally means avoiding json as a data type. (The single table abomination you describe isn’t even really on the table - you did a fine job arguing against it yourself.)

David J.

В списке pgsql-general по дате отправления:

Предыдущее
От: Skorpeo Skorpeo
Дата:
Сообщение: Json table/column design question
Следующее
От: Muhammad Salahuddin Manzoor
Дата:
Сообщение: Re: Json table/column design question