I'm gonna convert string to integer to optimize group by performance.
What do you guys think of the idea?
If applicable,then is there a built-in function to convert string to a unique integer in PHP?
I'm gonna convert string to integer to optimize group by performance.
What do you guys think of the idea?
If applicable,then is there a built-in function to convert string to a unique integer in PHP?
If all data in that column is int, then it should be int...
The main advantage you get is that a comparison between 2 ints only needs to compare 4 byte. A string that expresses the same number will (usually) be longer. So you should be able to get some performance out of it. But the main reason should be that a column that stoes int should be int.
The group by optimization would fall into the category "premature optimization"... And the main thing that will speed up a group by clause is not the datatype, but the index on the field