How to affect performance when I use UUIDs as primary keys in MySQL

I would like to know how and how much can affect server performance when I use UUIDs for my primary keys in MySQL.

0


source to share


2 answers


I assume you are using InnoDB (you should still ...)

So read the next chapter: MySQL High Performance 2ed, p.117: http://books.google.com.hk/books?id=BL0NNoFPuAQC&lpg=PA117&ots=COPMBsvA7V&dq=uuid%20innodb%20clustered&20index%20high%20qlformance%20m = PA117 # v = onepage & q & f = false



In general, UUIDs are a poor choice in terms of performance (due to the clustered index) and they have a benchmark to prove it.

+1


source


The UUID is 36 characters long, which means 36 bytes. INT is 4 bytes with variations of TINYINT, MEDIUMINT and BIGINT which are below 36 bytes.

Therefore, for every record you insert, your index will allocate more space. Also, the UUID takes longer to compute the opposite of increasing integers.



In terms of how much this might affect the system, it is difficult to determine the actual numbers as there are various factors - system load, hardware, etc.

+1


source







All Articles