1
I wanted to know the practical difference between this, in Mysql:
ALTER TABLE `tabela` ADD INDEX `col1` (`col1`);
ALTER TABLE `tabela` ADD INDEX `col2` (`col2`);
For this:
ALTER TABLE `tabela` ADD INDEX `col1col2` (`col1`, `col2`);
Since in both cases the INDEX is affecting both columns required.
If, for example, you use:
$mysqli->query("SELECT id FROM tabela WHERE col1 = 'qualquer' AND col2 > 0");
Would there be a difference in performance in using the separate INDEX method or together?
If there are both (separated and together) would have some benefit in this case, or would have to manually define the query()
to use INDEX "united"?
The ideal is to save the two types. After 10 days of use I checked this. Simply the index joined took 3 SECONDS to complete the query. I added two Dexes alone. Puf. Lowered to 0.156 seconds. A reasonable result.
– Inkeliz
No doubt it would increase the processing, this type of index, because it is a string. unlike the numeral that corresponds to an integer.
– Ruggi