Varchars Versus Char Data Types

Question: How much Varchars cost in Performance?

I'd like to be able to take advantage of varchars instead of chars to save on disk space, but I'm concerned about a possible performance loss. How much will varchars cost me?

Answer: Somewhat less Performance with Varchars.

This is one of those "your mileage may vary" answers, but in general, varchars are compressed character fields. Your engine knows where the field starts, but it has to make some calculations in order to find out where the field ends. With fixed-length character fields in your table, it is relatively easy for the engine to parse the row into fields. It's a little more CPU-intensive with varchars, as each field depends upon the amount of data in ...

Get Informix DBA Survival Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.