4 ms·
Seems likely that the substring gives a hint to the optimizer/executor about the size of the field, otherwise it could be whatever the max varchar size is. The
by orf 2y ago
Seems likely that the substring gives a hint to the optimizer/executor about the size of the field, otherwise it could be whatever the max varchar size is.
There are likely specialisations for text fields under 256 bytes (and more generally, all common fixed-sized subsets of variable-length fields) which are made available when substr is used. For example, these values could be stack allocated rather than read from the heap.