Trying different methods, discovered that extract(year from current_date)
function was not using the indexedindex of the year column, so declared a cast to int and works pretty fine. Using extract(year from current_date)::int
had returned results in 2.5 min, before was returning around 11-13 min.
Tks to J.D. .