Which is better?

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

Hello everyone,
Can you advise me on a performance issue. I've got a
field in a table that is currently set as a text field
with a maximum of 5 characters. My instinct tells me it
would be more efficient to change it to a number field
(the field only ever contains numbers between the range
10001 and 90001). Am I right to do this?
The database has large amounts of data in it and any
performance benefit would be worth having.

Regards,

Lee
 
It would save 1 byte per record.
A Long takes up 4 bytes whereas a string takes 1 byte per
characters
 
Hello everyone,
Can you advise me on a performance issue. I've got a
field in a table that is currently set as a text field
with a maximum of 5 characters. My instinct tells me it
would be more efficient to change it to a number field
(the field only ever contains numbers between the range
10001 and 90001). Am I right to do this?
The database has large amounts of data in it and any
performance benefit would be worth having.

I'd leave it as text, frankly. The one-byte difference in fieldsize
will be very minor. I suppose you could try creating a 10,000,000 row
table (which is what I'd call "large amounts", not sure of your
definition) with (obviously repeating) random values in Text and
Number/Long Integer fields, and time searching for a single value
and/or sorting the table by the field; but my guess is that the
difference will be minor.
 
Back
Top