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 INDEX is affecting both of the required columns.
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 you have any benefit in this case, or would you have to manually set query()
to use INDEX "joined"?