5 ms·
I could be wrong, but I thought UUIDs could cause some performance troubles for larger table when there is an index on it? edit: This explains it a bit > When
by grep_it 6y ago
I could be wrong, but I thought UUIDs could cause some performance troubles for larger table when there is an index on it?
edit: This explains it a bit
> When you insert a new row with a random primary key value, InnoDB has to find the page where the row belongs, load it in the buffer pool if it is not already there, insert the row and then, eventually, flush the page back to disk. With purely random values and large tables, all b-tree leaf pages are susceptible to receive the new row, there are no hot pages. Rows inserted out of the primary key order cause page splits causing a low filling factor. For tables much larger than the buffer pool, an insert will very likely need to read a table page from disk. The page in the buffer pool where the new row has been inserted will then be dirty. The odds the page will receive a second row before it needs to be flushed to disk are very low. Most of the time, every insert will cause two IOPs – one read and one write. The first major impact is on the rate of IOPs and it is a major limiting factor for scalability. [1]
1: https://www.percona.com/blog/2019/11/22/uuids-are-popular-but-bad-for-performance-lets-discuss/ https://www.percona.com/blog/2019/11/22/uuids-are-popular-bu...
- remus 6y agoOP mentioned they are using one of the sequential UUID variants so this is not an issue.
- dx034 6y agoI believe they still use the MAC address? If the master node changes, the number could suddenly start at a different block, causing massive performance impacts. If they're purely sequential you can as well use a 64 bit int.
- lmm 6y ago> If the master node changes, the number could suddenly start at a different block, causing massive performance impacts. What massive performance impact? You'd have one extra IOP, total, as it loaded the page for the new mac address, and then it would carry on as normal. It would be no different from when a sequential ID crosses a page boundary.