Archiving old data when foreign keys involved

From: Albin Ary <albinary10(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Archiving old data when foreign keys involved
Date: 2023-02-03 16:11:23
Message-ID: CAGCWzULJ4nGDVNv+xmmTfpnrth9TRH=qDyJ26pee80c4DuROzA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello,
I am writing to ask for your advice regarding the deletion of old data when
foreign keys are involved.

I have this database which has quite a complex schema (generated by ORM),
very normalized with a lot of foreign key relationships for some tables.

So the situation is that some certain tables reference columns from other
tables and also have columns which are being referenced from certain other
tables.

Because some tables are getting big and this is affecting the overall
performance (mainly insert performance) I was thinking of creating some
denormalized tables in which I will keep the necessary relevant data and
delete older records afterwards. This is ok for the app from a business
point of view, but technically I am not sure how it could be tackled.

Is there any tool which might help with this kind of situation?

Not sure if it makes a difference anyway this is Postgresql 14.5.

Many thanks!

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ron 2023-02-03 16:36:43 Re: Archiving old data when foreign keys involved
Previous Message Daniel RC 2023-02-03 15:12:59 Re: Performance Tool - PostgreSQL