From: | "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Ensuring Rifferential Integrity |
Date: | 2023-09-17 20:54:35 |
Message-ID: | 20230917205435.bzysckh6ah6mjfjv@hjp.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2023-09-17 19:24:52 +0200, Anthony Apollis wrote:
> I brought in the Primary/Secondary/Foreign keys because it does not exist in
> the Fact/Dimension tables.
>
> The Fact tables contain 6 million records and the dimension tables are tiny.
> Because some columns don't exist in the Fact and Dimension table I can not
> update the Foreign Keys in the Fact table to ensure relationship integrity.
>
> e.g Say I have a Fact table containing Apple's Sales; one of the Dimension
> tables is Apple Type. Since the two tables don't contain an Apple Type column
> in both I won't be able to enforce referention integrity. If my Apple Sales
> table contains 6 million + sales, I won't be able to break it down Apple sales
> by Type.
Can you illustrate this with a simple example? I don't think I
understood what you're trying to say.
> That is the problem I am sitting with. My fact Table is not able to give me
> unique Foreign Key columns. I read about a Mapping table.
Foreign key columns aren't normally supposed to be unique. You want to
reference the same thing (e.g. your apple type) from many columns (the
same type of apple will be sold in many stores every day).
> ” UPDATE system."IMETA_ZTRB_MP$F_ZTBR_TA_BW" AS A
>
> SET "Master_BRACS_Secondary_Key" = B."Primary_ZTBR_TransactionCode"
>
> FROM dim."IMETA_Master_BRACS_to_SAP_Data_TA_BR_" AS B
>
> WHERE A."ZTBR_TransactionCode" = B."Primary_ZTBR_TransactionCode";”
Isn't that basically the same as
UPDATE system."IMETA_ZTRB_MP$F_ZTBR_TA_BW"
SET "Master_BRACS_Secondary_Key" = "ZTBR_TransactionCode";
?
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
From | Date | Subject | |
---|---|---|---|
Next Message | Utku | 2023-09-18 08:03:20 | How to synchronize the read/write DB on my laptop with the read-only DB on cloud (primary on premises, replica on cloud)? |
Previous Message | Anthony Apollis | 2023-09-17 17:24:52 | Ensuring Rifferential Integrity |