I'm working in a system that is using MySQL as primary DB. One of the biggest tables is almost 1TB in size, others are around 100-300 GBs.
Queries started to be really slow.
I search some info, and I was planning to use partitioning by ID or by the created timestamp, but I dont really know what or how to do it.
I was thinking something like this (this is my local environment)
ALTER TABLE records
PARTITION BY RANGE (id) (
PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION p2 VALUES LESS THAN (300),
PARTITION p3 VALUES LESS THAN MAXVALUE
);
but I get Foreign keys are not yet supported in conjunction with partitioning.
So, I dont really know what to do now. I dont know if droping the FK is a good idea, specially for this kind of systems. Any help?
Also, I thought of migrating to something like PostGres or other engine that could help me of maintaining partitioning easily, but we really need to use Django ORM to query in our system. (Because all aplication is build on top of the ORM).
Thanks for reading. Any help would be appreciated.