php - In mysql, is it more efficient to use int type as a primary key field than char type?
黄舟
黄舟 2017-05-25 15:08:20
0
2
823

In mysql, is it more efficient to use int type as a primary key field than char type?

Due to business requirements, it is necessary to use a timestamp and a 2-digit random number to form the ID.
For example: 149561542040, a total of 12 digits.
If the ID field uses integer bigint, will it be more efficient than using char?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
黄舟

In terms of space, BIGINT occupies 8 bytes and CHAR occupies 12 bytes.
The difference is obvious in massive data. In terms of efficiency, INT is more efficient

过去多啦不再A梦

Personally, I feel there is a difference in efficiency.
Integer types have efficient methods for sorting and searching.
Char should be much weaker

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template