June 29, 2005 at 6:33 am
Hi,
I have a few question about index on a varchar columns.
Is it a good practice to create index on varchar columns? any performance issues (Does a char index perform better than a varchar index)?
Thanks a lot,
Eric
June 29, 2005 at 7:13 am
The question really is, does that column need an index (or unique constraint)? If not then it's a complete waste of resources, but if it does the you need to put one .
I would suspect that varchar(50) would perform slightly better than char(50) because the char(50) index would contain more data. Therefore requiring more i/0, more pages reads, more text to parse... This is assuming that the column doesn't have 50 characters per row.
On a final note, you should always use the best datatype for the data based on the needs of the data, not the indexing. They often go hand in hand, but I wouldn't convert all my date columns to int/decimal just because the indexing might be faster. This can be applied once in a while but it's not the rule of thumb.
June 30, 2005 at 6:35 am
welcome to the world of proper indexes. I suggest you jump in feet first. there is a LOT of help in this forum, you should do some searches. Also, no matter how much I've read and gotten advice on, sometimes you have to jump in a test it out yourself. No one else knows your data like you do, and you'll gain the knowledge. Turn on the trace in QA to measure the effect of the indexes.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply