문제

I am going to use unique keys for my messages table which will be conbination of three columns fromid, localid and timestamp

I want to ask a question that is the message insertion will get slow or it will perform well?

도움이 되었습니까?

해결책

Compared to what?

Having a primary key or unique index is always going to affect message insertion time, because column values need to be compared to the values in the index. In most environments, the unique index can fit in memory, so this is just a few comparison operations and an insert -- nothing to worry about and much less than either network overhead or disk i/o.

If you have a really large table compared to available memory, then the operations could start to take more time.

If your application needs to enforce this unique index, then you should use it. You probably won't notice the additional overhead for enforcing uniqueness, unless you do very intense performance tests.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top