Mysql Integer id and uuid difference

Daily development, it was often used as the primary key UUID to the database. Such conventional integer primary key and what is different? Look at the data to speak:
Integer and uuid difference
Summary: Use uuid cause sharp increase in the index of storage space, as well as extended storage time.
Reasons: partly because the primary key field is too long, the second is due to a page split and debris caused. In innoDB, the will to do it according to the primary key clustered index, the index and the corresponding data stored in rows on leaf pages, written using the uuid is disordered, InnoDB to write data, can only continue to be frequent page split operations to allocate space for the new line. Due to frequent pages division will lead to filling pages become sparse is irregular, so in the end resulted in a large amount of data fragmentation.

Guess you like

Origin blog.csdn.net/weixin_38608626/article/details/90167510