indexing - Sequential UID set generation for MySQL Char() or other Field -
tried googling but:
question: best way externally generate sequential uid values mysql field must representable string.
reason:
generic sequential uuid-ish values on-disk-order/page-appending inserts performance of writes , date prefixing read speed when searching index of field char[0] forward. column indexed, looking best data increase index read , table write performance rather plain-old-uuid.
my initial thought date granularity (possibly padded epoch) appended or replacing portion of uuidv4 generated string ie [unix epoch][remaining uuid4]
in fixed-width char field, unsure if have desired in-page/disk ordering result , index-searching result. example be:
12904645950049bceba1cc24e80806dd
the values must independent of mysql itself, hence using uuids , timestamps rather variation of auto-incrementing.
anyone knows internals of mysql indexes have suggestions (for innodb tables) ?
aiden
might bit offtopic, have @ twitter's snowflake. it's:
- (roughly) time ordered (helps lot avoid expensive random primary key btree updates)
- directly sortable
- compact
not mention other features (ha, etc.). can either nick algorithm or use stands.
the whole uid uses 64 bits of space guess quite effective index - see http://www.mysqlperformanceblog.com/2006/10/03/long-primary-key-for-innodb-tables/ (a counter example).
Comments
Post a Comment