0282NAME IS NULL
2017/05/03(水) 17:47:31.47ID:???create index hoge_idx on hoge(year, month);
select year, month, sum(amount)
from hoge where (year = 2017 and month > 3) or (year = 2018 and month < 4)
group by year, month;
実行計画:
https://explain.depesz.com/s/rwx