Skip to content

Comment on Things that don’t work well with MySQL’s FOREIGN KEY implementationparent

Comments

I have the strong feeling I would never do this regardless of the DB engine for performance and storage reasons. I would try to hash the blob into a bigint and use that as the PK/FK.

Out of curiosity, is there a scenario you can share in which using a binary blob as a PK/FK would be the best solution?

I'm not talking huge blobs, just (fixed-size) 8- to 16-byte uuid-like fields. You can obviously marshal 8-byte fields to a bigint but you can't do that with 16-byte fields.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.