I have a legacy schema (disclaimer!) that uses a hash-based generated id for the primary key for all tables (there are many). An example of such an id is:
922475bb-ad93-43ee-9487-d2671b886479
There is no possible hope of changing this approach, however performance with index access is poor. Setting aside the myriad of reasons this might be, there is one thing I noticed that seemed less than optimal - despite all id values in all many tables being exactly 36 characters in length, the column type is varchar(36)
, not char(36)
.
Would altering the column types to fixed length char(36)
offer any significant index performance benefits, beyond the very small increase in the number of entries per index page etc?
Ie does postgres perform much faster when dealing with fixed-length types than with variable length types?
Please don't mention the minuscule storage saving - that's not going be matter compared with the surgery required to make the change to the columns.