I have a table
A that has a couple of other tables (
C) attached to it (many rows in
C for one row in
I'm having performance problems with
A, so I thought I would partition it using a
date_deleted column (
NOT NULL) into 2 tables
Data flow is as follows:
- Records are created at a rate 10k per day, inserted into
- After 2 months records are moved to
- Records are never un-deleted
- Nothing is ever hard deleted, currently there are 1.3M rows
I have written a full script to split my
A_deleted, create triggers for inserts and updates, but I'm at a loss about the foreign keys.
Should I create
B_deleted? The triggers will get super complex.
Should I create 2 FKs from
B? One to
A_active, one to
A_deleted? Triggers will also be very complex.
Should I scrape this idea altogether? I kind of like the idea of having a dedicated table for historic records. It will simplify my selects.