MySQL Forums
Forum List  »  Newbie

Re: Clustered primary key question
Posted by: Rick James
Date: August 19, 2015 08:27PM

GUIDs/UUIDs/Digests are terribly bad as keys (PRIMARY or otherwise) in _huge_ tables. This is because they are terribly random, hence the next GUID you fetch (or insert) is likely to not be cached. That leads to a disk hit, which makes the queries slow.

More discussion here: http://mysql.rjweb.org/doc.php/uuid

Keep in mind that _any_ multi-master solution must perform all writes on all Masters. That makes writes inherently not scalable. (Reads can be scaled by having more Slaves.)

The only way to really scale (beyond millions) GUIDs is to "shard" the data into many _separate_ masters. There is no automatic sharding in _standard_ mysql.

But... Do you really have a zillion rows indexed by GUIDs? If not, just make sure you always have enough RAM to cache all of the table(s) or index(es) that depend on GUIDs. 1K rows is no problem. 1M rows is probably no problem. 1B rows is deadly.

Options: ReplyQuote


Subject
Written By
Posted
Re: Clustered primary key question
August 19, 2015 08:27PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.