Re: Json table/column design question

From: Muhammad Salahuddin Manzoor <salahuddin(dot)m(at)bitnine(dot)net>
To: Skorpeo Skorpeo <skorpeo11(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Json table/column design question
Date: 2024-05-23 04:01:16
Message-ID: CAKD7CD=aoXdRMLjOWR-S+TPgMqWGiY9Wn7RgTG4nkVgwgBR99w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings,
Storing unrelated JSON objects in the same table with distinct columns for
each type (e.g., "Users" and "Inventory") is generally not a sound good
approach may affect Query Performance and Optimization, Storage Efficiency,
scalability and Maintenance, Data Integrity.
Recommended approach is to have separate tables.

*Salahuddin (살라후딘*
*)*

On Thu, 23 May 2024 at 08:39, Skorpeo Skorpeo <skorpeo11(at)gmail(dot)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.
>
> Many thanks.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message sud 2024-05-23 04:48:39 Re: Long running query causing XID limit breach
Previous Message David G. Johnston 2024-05-23 03:50:47 Re: Json table/column design question