I've got a huge data set. The dwelling looks something similar to this:

K_Field1, K_Field2, K_Field3, K_Field4, D_Field5, D_Field6, D_Field7, D_field8

However , just the first 4 area (K_Field1,K_Field2,K_Field3,K_Field4) together identify a row distinctively. I produced one table, with such fields since it's fields.

Let us say I've a million rows within the table by using their structure. Basically import a brand new record, I must determine if it's already within the database. If it's, then I must update it, otherwise, then I have to place a brand new row.

To achieve that, I have to put a multiple area index around the first 4 posts, that is - I am afraid - not the very best solution. It is possible to better database structure to keep and check for the reason that data, or I must accept the 4-fielded index?

I am using MySQL

There is nothing wrong with creating a catalog around the first 4 posts, actually you need to:

create unique index mytable_key on mytable(K_Field1,K_Field2,K_Field3,K_Field4);

because that's a realistic look at your circumstances.

It's also the "correct" solution.