no, you can't do that. It is simply impossible to apply an arithmetic operation when creating an index.
if it is VERY necessary, you can make a new column that you will update with the values of col1 + col2 and make it an index.
values> N choose it.
you can make a composite index (col1, col2), but it will be slower than the index on the column in which the amount is already stored.
create table v (a int, b int, key (a,b)); insert into v values(1,2); explain select a+b from v; +----+-------------+-------+------------+-------+---------------+------+---------+------+------+----------+-------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+-------+------------+-------+---------------+------+---------+------+------+----------+-------------+ | 1 | SIMPLE | v | NULL | index | NULL | a | 10 | NULL | 1 | 100.00 | Using index | +----+-------------+-------+------------+-------+---------------+------+---------+------+------+----------+-------------+ alter table v drop index a; Query OK, 0 rows affected (0.14 sec) explain select a+b from v; +----+-------------+-------+------------+------+---------------+------+---------+------+------+----------+-------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+-------+------------+------+---------------+------+---------+------+------+----------+-------+ | 1 | SIMPLE | v | NULL | ALL | NULL | NULL | NULL | NULL | 1 | 100.00 | NULL | +----+-------------+-------+------------+------+---------------+------+---------+------+------+----------+-------+
notice the difference in two explain
It all depends on your requirements.
Without (composite) index - adishche.
With a composite index is better. // see postscript, maybe I'm not quite right, depends on the request
With a new column, there are more hdd losses and slower when inserting data, but much faster when reading.
PS even more dependent on the request, see the answer @Firepro and comments to it.