Compress MySQL rows that are duplicates into a linking PK & FK table?

时间:2018-06-04 17:09:42

标签: mysql

Problem.
So I have 3 Tables. these tables exist from parsing Midi Files into the DB. so the relationship is below

File -1-2-Many-> Tracks -1-2-Many-> Messages

So each Midi File can have multiple midi tracks "Tracks" and each of the Tracks can have multiple Messages.

The way I link the File to multiple Tracks is using an FK I also use an FK to link a single Track to each of the Messages within that track.

I have noticed in Messages that a lot of the data is duplicates and the only difference is the track to which they are linked to.

My Question.
Is it possible to automatically tell MySQL to find the duplicates in Messages and then only create 1 instance of the row and create a linking table to each track so it will remove duplicates?

My Aim.
I want to try and reduce the 900 million rows to as little as possible since I'm only on a laptop and it takes forever to scan.

Thanks.

0 个答案:

没有答案