I have to constantly sort a table by a field that has a decimal datatype. I have added an index but I am not too sure how effective that is.
Would it be better to store the decimal as an integer, as the precision is not too necessary? Alternatively, I can simply increase the percentage until the smallest percentages can be rounded to more than 1 percent, and then round them, store them as integers, and sort them.
Which is faster, in order, and by how much?
Storing it as integer, with 2 decimal places or with multiple decimal places.
Store it as integers….This would mean that you would have a smaller index for the overlapping numbers as the percentages would go upto 100% and that would mean that lookups would be faster. Decimals are like storing long intergers in binary form.