public inbox for [email protected]
help / color / mirror / Atom feedFrom: David G. Johnston <[email protected]>
To: Norbert Sándor <[email protected]>
Cc: [email protected] <[email protected]>
Subject: query multiple schemas
Date: Sun, 21 Apr 2024 13:41:23 -0700
Message-ID: <CAKFQuwYLpVCeOaAo6X8yCw02JAtRT+yiLZ2Gc-N_UJyJAv-V6A@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
On Sunday, April 21, 2024, Norbert Sándor <[email protected]>
wrote:
>
>
> The structure of each schema is identical, the tenant ID is the name of
> the schema.
>
You’ve hit the main reason why the scheme you choose is usually avoided.
Better to just add tenant_id to your tables in the first place. And use
partitioned tables if you desire physical separation.
> The above solution seems to work, my questions are:
>
> 1. Is there a better way to achieve the same functionality? Maybe
> without using JSON as an intermediate representation?
>
>
In-database, I doubt it (though I didn’t study your specific solution in
depth). Json provides the easiest way to generate the virtual tables you
need.
Otherwise maybe try something with say bash scripting and psql scripts; or
some other client-side setup where you separate the query and the metadata
lookups so the queries just return normal results and the client takes them
are merges them.
David J.
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: query multiple schemas
In-Reply-To: <CAKFQuwYLpVCeOaAo6X8yCw02JAtRT+yiLZ2Gc-N_UJyJAv-V6A@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox