RE: Using Varchar
Posted in 2000
Topics: Data Types & Schema Design
Can you explain why a column of varchar performs more quickly than a column of char(x)? -Thomas Tatum > -----Original Message----- > From: owner-informix-list@iiug.org > [mailto:owner-informix-list@iiug.org]On Behalf Of Rob Wilson > Sent: Thursday, March 09, 2000 2:30 PM > To: informix-list@iiug.org > Subject: Re: Using Varchar > > > Nuno Andr' (na.airc@esoterica.pt) wrote: > : Is there any limitation on using the datatype varchar? > : Can we use it in any former char columns or only for those > column that have > : more than a certain number of chars? > > > : Thanks for your help, > > Sure, limited to 255 bytes. Otherwise you _can_ use it on a column > that was defined as a char(<255) but it may not perform as quickly. > > If you are on 9.2 or better you get lvarchar (which gives you a > whoooole bunch of characters). >
Thomas Tatum (ttatum@koz.com) wrote: : Can you explain why a column of varchar performs more quickly than a column : of char(x)? : -Thomas Tatum A column of char(x) would perform more quickly than a varchar(x) column. Simply because the engine has to figure out how long the string is for a varchar. I do not know why a char(x) would ever be faster, I think the decision to go with varchar over char is usually more related to something like 'we have a description field that is empty 90% of the time but can contain up to 200 characters'. Then disk storage will usually win. With varchar's you also have the problem of row sizes changing and possibly not fitting on the page they used to fit on, so the engine has to find a new page to put them in. : > -----Original Message----- : > From: owner-informix-list@iiug.org : > [mailto:owner-informix-list@iiug.org]On Behalf Of Rob Wilson : > Sent: Thursday, March 09, 2000 2:30 PM : > To: informix-list@iiug.org : > Subject: Re: Using Varchar : > : > : > Nuno Andr' (na.airc@esoterica.pt) wrote: : > : Is there any limitation on using the datatype varchar? : > : Can we use it in any former char columns or only for those : > column that have : > : more than a certain number of chars? : > : > : > : Thanks for your help, : > : > Sure, limited to 255 bytes. Otherwise you _can_ use it on a column : > that was defined as a char(<255) but it may not perform as quickly. : > : > If you are on 9.2 or better you get lvarchar (which gives you a : > whoooole bunch of characters). : > -- Rob Wilson rwilson@ntsource.com