I've written and spoke a lot about using short PRIMARY KEYs with Innodb tables due to the fact all other key will refer to the rows by primary key. I also recommended to use sequential primary keys so you do not end up having random primary key BTREE updates which can be very expensive.
Today I would like to share practical example when you may use
long primary key with value distribution far from
sequential.
For one of the projects I had the task to store meta data about thumbnails for images retrieved from various web sites in the Internet. Thumbnails themselves were stored on the disk of course but meta data such as original image sizes, file size as well as thumbnail location on the disk were stored in the database:
PLAIN TEXT SQL:
- CREATE TABLE `imagecache` (
- `url` varchar(255) character SET latin1 NOT NULL DEFAULT '',
- `thumb_width` …