For example: I have the table -
table User (id (bigint(20) primary key, session_id (bigint(20), key(varchar(24) )
There is a unique index in that table including both session_id(bigint(20)) and key(varchar(24) ) columns.
Can there be a performance impact to system if I will change 'key' column to varchar(255) (use long values for this column) , since it is a part of a unique index?
I'm using Mysql database(AWS Aurora).
Short Answer: No significant performance impact.
Long Answer:
PRIMARY KEYis aUNIQUEindex; both areINDEXes. (That is, do not make redundant indexes.)VARCUARin an index is mostly based on the average length of the actual strings. The max length does not matter (unless it hits some limit, such as 3072 bytes).