General information
Category:
Coding, syntax & commands
>>>>
>>>> >>>I have a system where new records are being added to tables
>>>> >>>and receive sequential ID numbers which are the primary
>>>> >>>keys. Is there a difference between using numeric and
>>>> >>>integer types for these fields?
>>>> >>
>>>> >>Consider using a character type for your system generated key? I used a system generated key in some tables that is C(4) and stored like
>>>(0001, 0002, 0003).
>>>> >
>>>> >
>>>> >which works faster w/ seeks, char, numeric or integer? i've read about studies on this but can't remember...
>>>>
>>>> Integer. Reason - Takes up only 4 bytes so that index files are smaller. Also, I believe I heard that the engine is optimized for
>>>Integer keys (don't hold to
>>>>
>>>> -Doug-
>>>
>>>To be on the safe side, I would go for a character key, be it only
>>>because you might want to concatenate the key in a composite secundary
>>>key, in which case, if you take an integer, you would loose the
>>>advantage of optimization.
>>>
>>>My 2 BEF.
>>>
>>>Regards,
>>>
>>>Marc
>>
>>U got it. That's why I am currently using a character!
>
>i also use a char string -- was just curious.
I used to use solely Character keys also. However, in addition to the other benefits, I have found that using Integers helps keep my primary keys data independent thus avoiding long concatenated keys. I also use a lot of views which I think makes having data independent keys easy to work with.
Just my $.02...
-Doug-
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only