On 05/04/17 09:00 AM, Monty Taylor wrote:
>
> Please do NOT use uuid as a primary key in MySQL:
>
> * UUID has 36 characters which makes it bulky.

you can store it as a binary if space is a concern.

> * InnoDB stores data in the PRIMARY KEY order and all the secondary keys
> also contain PRIMARY KEY. So having UUID as PRIMARY KEY makes the index
> bigger which can not be fit into the memory
> * Inserts are random and the data is scattered.

can store a ordered uuid (uuid1) for performance but arguably not much 
diff from just autoincrement

>
> In cases where data has a large natural key (like a uuid) It is
> considered a best practice to use an auto-increment integer as the
> primary key and to put a second column in the table to store the uuid,
> potentially with a unique index applied to it for consistency.
>
> That way the external identifier for things like gnocchi can still be
> the UUID, but the internal id for the database can be an efficient
> auto-increment primary key.

very good points. i guess ultimately should probably just test to the 
scale you hope for

cheers,

-- 
gord
__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to