Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Numerical vs. Character Indexes
I'm counting the net wisdom here in CDOS to help settle an argument.
There is a prevailing sense around my department that indexing character
keys are a bad thing, and that such indexes are drastically less efficient
than numerical ones. This is resulting in people inventing all kinds of
kludgy workarounds to circumvent character based indexes.
Their argument, of course, is that the CPU can natively compare numbers in a single instruction, but there is no hardware mechanism for comparing strings. I believe this argument falls apart at the RDBMS level, as Oracle is doing millions of other operations for that query besides a tiny little compare.
Here's my reasoning:
NUMBER(10) vs. VARCHAR2(10) -- both unique indexes -- Should there be a difference?
NUMBER(10) vs. DATE -- both non-unique indexes -- Any difference?
Does anyone want to voice their opinions here? I'm in favor of numerical keys, but in some places it's just far more convienant to use varchar keys. Of course long varchar indexes will be slower, but we're talking 10 or 20 byte varchar's at most.
Comments anyone? Received on Sun Jan 23 2000 - 20:20:57 CST
![]() |
![]() |