Skip to content

Instantly share code, notes, and snippets.

@jmccartie
jmccartie / numeric_vs_uuid
Last active October 22, 2015 04:34 — forked from jgaskins/numeric_vs_uuid
Comparing numeric vs UUID in Postgres. Rehearsal benchmarks are thrown out. Only the second run is kept. Insertions are done all in one query to minimize the impact of I/O. This is harder to do with retrieval, but the ids are randomized in each one to minimize the effects of caching inside the database.
# First
Inserting
user system total real
Numeric 0.060000 0.020000 0.080000 ( 0.977884)
UUID 0.070000 0.010000 0.080000 ( 1.147398)
Retrieving by id
user system total real
Numeric 0.640000 0.920000 1.560000 ( 9.457490)