How optimal is it to have a primary key on 3 or 4 fields? If the table has say millions of records, is it going to be heavy on the server running a query such as:
Select * from my_table where field1='123' and field_2='123' and field_3='hours'
The primary key is created on these fields: field_1 int(11) field_2 int(11) field_3 varchar(20)
What I'm considering doing as an alternative is have those fields store the data with a primary key on a separate field which has an md5 hash of the data such as "md5(field_1+'-'+field_2+'-'+field_3) and then my script just queries one field such as:
Select * from my_table where field_hash=MD5('123-123-hours')
So basically I'm just wondering if method 1 is just as optimal as method 2 with a table with millions of records.