Large Text Indexes in Postgres

1 · Andrew Kane · Oct. 7, 2016, 7 a.m.
Note: This article was written for Postgres 9.6 and below. For Postgres 10+, use hash indexes instead. An index on a sufficiently large text column can take up more space than the table itself. If you only need to check for equality, you can significantly reduce the size of the index. At first glance, a hash index seem perfect for this. However, you shouldn’t use them since they are not currently WAL-logged. Instead, use an expression index: CREATE INDEX CONCURRENTLY ON table_name (CAST(md5(co...