add batch remove batch split batch show hidden batches hide batch
db<>fiddle
feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
1000 rows affected
81083 rows affected
QUERY PLAN
GroupAggregate (cost=0.57..6392.08 rows=200 width=12) (actual time=0.335..363.095 rows=854 loops=1)
  Group Key: sales_periods.product_id
  -> Nested Loop (cost=0.57..5957.53 rows=86511 width=8) (actual time=0.074..256.922 rows=243454 loops=1)
        -> Index Scan using index_ranges on sales_periods (cost=0.28..93.78 rows=1700 width=12) (actual time=0.011..25.926 rows=1000 loops=1)
        -> Index Only Scan using days_index on calendar (cost=0.29..2.94 rows=51 width=4) (actual time=0.026..0.164 rows=243 loops=1000)
              Index Cond: ((day >= sales_periods.since) AND (day <= sales_periods.till) AND (day >= '2021-04-14'::date) AND (day <= '2022-04-13'::date))
              Heap Fetches: 243454
Planning Time: 0.655 ms
Execution Time: 363.420 ms