Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> As the PG docs say, there is virtually no performance difference at all between all three

Btw, there is a clear [though infrequent] case where using CHAR(X) vs. VARCHAR(X) may cause huge performance penalty with iron platter HDD. CHAR(X) will always contribute X to the row length (even if data value is Y < X, so VARCHAR(X) with such value would contribute Y) thus making it more probable to have your row TOAST-ed ( i.e. have parts of row stored separately in separate table) thus causing a noticeable (when only few rows are accessed) extra disk head lookup on non-cached data. Similar to C/LOB in-row limit exceeding on other databases.



like I said, don't use CHAR for non-fixed-length data. Use it for short fixed-length strings.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: