TLDR · PROGRAMMING, DESIGN & DATA SCIENCE

HANDLING UNIQUE INDEXES ON LARGE DATA IN POSTGRESQL

volodymyrpotiichuk.com10 min read

Summary from the TLDR newsletter

PostgreSQL has a limitation on unique index entries larger than 1/3 of a buffer page. The 1/3 page size limit exists to ensure efficient page splitting. To overcome the restriction, introduce a new field that stores a hash of the large field. This allows you to store really large data inside databases, even with unique constraints.