Let's say I have a table with millions of rows in which I have 3 integral variables: x,y and z against which I do my searching in a SELECT... WHERE x=a and y=b and z=c
Which would be faster / more efficient?
combining the 3 fields into a separate string column "x_y_z" (e.g. 1231_3242_6864) and indexing it
Making a 3 column index against the three integers?
No it would be worst, string comparaison are much slower. You could eventually (if really needed, I wouldn't recommend it) combine the 3 integers in one integer but only IF THEY FIT.
However, to solve your index, problem the easiest would be to create a composite index on x,y and z.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With