Given the next SQL statement:
Select *
from A join B
on A.id1=B.id1 and
A.id2=B.id2
where A.year=2016
and B.year=2016
and knowing table A
is much smaller than table B
, so I need the database first to access A
table by year, then join, then filter B
table by year, my question is:
does it make sense to create an index over B
like (id1,id2,year)
for improve performance?
Many thanks!