Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Char vs Varchar in Index
Message
From
29/10/2003 07:43:45
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00843921
Message ID:
00843990
Views:
17
Hi Mike

>We are putting together a database which will utilise 22 character UIDs as the primary key on most tables. Has anyone done any tests to see if there is a significant performance penalty for using varchar as the datatype for the primary and foreign keys rather than char?

As a general rule, the fastest and most efficient primary key in any database (SQL Server and ORacle included) is an INTEGER. CHAR is also invariably faster than VARCHAR and if you must use a 22-character field as the primary key that would be the better option. However I would still recommend that you keep the primary key on the table as an auto-generated integer since that will generally give you the best performance when dealing with inserts, updates and deletes.
----
Regards
Andy Kramek
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform