I wrote a query which uses two columns and each of those columns come from different tables. How can I make an index for these columns and is it even possible?
select countryName, balance
from main.country c
join main.person p on (c.countryId = p.countryId)
where balance = (select MAX(balance)
from main.person p2
join main.country c2 on (c2.countryId = p2.countryId)
where c.countryId = c2.countryId
and p.countryId = p2.countryId)
order by countryName;