better idea is to re-design the db model to avoid cursor or looping...
botoom line to create index is selectivity. if your year and iid column has many duplicated record (means bad selectivity), then you will not benefit too much from creating index on these column.
create index on column that is highly selective. you can find selectivity by running
select year, iid, count(*) from table_name group by year,iid
or
select unique year, iid from table_name
look at other column's selectivity and see if you can benefit from creating index on them.
botoom line to create index is selectivity. if your year and iid column has many duplicated record (means bad selectivity), then you will not benefit too much from creating index on these column.
create index on column that is highly selective. you can find selectivity by running
select year, iid, count(*) from table_name group by year,iid
or
select unique year, iid from table_name
look at other column's selectivity and see if you can benefit from creating index on them.