add remove split language chart show hidden hide
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
INSERT 0 108000
DELETE 8743
ANALYZE
CREATE FUNCTION
CREATE INDEX
CREATE FUNCTION
QUERY PLAN
Bitmap Heap Scan on event e (cost=9.42..545.71 rows=496 width=8) (actual time=0.038..0.038 rows=0 loops=1)
  Recheck Cond: (((((EXTRACT(month FROM event_date) * '100'::numeric) + EXTRACT(day FROM event_date)))::integer >= (((EXTRACT(month FROM CURRENT_DATE) * '100'::numeric) + EXTRACT(day FROM CURRENT_DATE)))::integer) AND ((((EXTRACT(month FROM event_date) * '100'::numeric) + EXTRACT(day FROM event_date)))::integer <= (((EXTRACT(month FROM (CURRENT_DATE + 14)) * '100'::numeric) + EXTRACT(day FROM (CURRENT_DATE + 14))))::integer))
  -> Bitmap Index Scan on event_mmdd_event_date_idx (cost=0.00..9.29 rows=496 width=0) (actual time=0.035..0.035 rows=0 loops=1)
        Index Cond: (((((EXTRACT(month FROM event_date) * '100'::numeric) + EXTRACT(day FROM event_date)))::integer >= (((EXTRACT(month FROM CURRENT_DATE) * '100'::numeric) + EXTRACT(day FROM CURRENT_DATE)))::integer) AND ((((EXTRACT(month FROM event_date) * '100'::numeric) + EXTRACT(day FROM event_date)))::integer <= (((EXTRACT(month FROM (CURRENT_DATE + 14)) * '100'::numeric) + EXTRACT(day FROM (CURRENT_DATE + 14))))::integer))
Planning Time: 0.564 ms
Execution Time: 0.071 ms
EXPLAIN
QUERY PLAN
Function Scan on f_anniversary (cost=0.25..10.25 rows=1000 width=8) (actual time=48.476..48.691 rows=3852 loops=1)
Planning Time: 0.019 ms
Execution Time: 48.910 ms
EXPLAIN
QUERY PLAN
Function Scan on f_anniversary (cost=0.25..10.25 rows=1000 width=8) (actual time=8.411..8.607 rows=3852 loops=1)
Planning Time: 0.039 ms
Execution Time: 8.780 ms
EXPLAIN
QUERY PLAN
Hash Join (cost=5066.14..8948.63 rows=50877 width=8) (actual time=207.459..269.719 rows=4140 loops=1)
  Hash Cond: ((((CURRENT_DATE + d.d) - ('1 year'::interval * ((generate_series(((EXTRACT(year FROM age(((now())::date)::timestamp with time zone, (max(event.event_date))::timestamp with time zone)))::integer), ((EXTRACT(year FROM age((((now())::date + 14))::timestamp with time zone, (min(event.event_date))::timestamp with time zone)))::integer))))::double precision)))::date = e.event_date)
  -> Nested Loop (cost=1966.86..2172.07 rows=15000 width=8) (actual time=71.155..71.480 rows=1530 loops=1)
        -> Function Scan on generate_series d (cost=0.00..0.15 rows=15 width=4) (actual time=0.018..0.022 rows=15 loops=1)
        -> Materialize (cost=1966.86..1986.92 rows=1000 width=4) (actual time=4.742..4.751 rows=102 loops=15)
              -> ProjectSet (cost=1966.86..1971.92 rows=1000 width=4) (actual time=71.125..71.141 rows=102 loops=1)
                    -> Aggregate (cost=1966.86..1966.90 rows=1 width=8) (actual time=71.120..71.121 rows=1 loops=1)
                          -> Seq Scan on event (cost=0.00..1470.57 rows=99257 width=4) (actual time=0.014..7.988 rows=99257 loops=1)
  -> Hash (cost=1470.57..1470.57 rows=99257 width=8) (actual time=136.188..136.189 rows=99257 loops=1)
        Buckets: 131072 Batches: 2 Memory Usage: 2966kB
        -> Seq Scan on event e (cost=0.00..1470.57 rows=99257 width=8) (actual time=0.015..8.830 rows=99257 loops=1)
Planning Time: 0.358 ms
Execution Time: 269.982 ms
EXPLAIN
QUERY PLAN
Hash Join (cost=5066.14..8571.24 rows=50877 width=8) (actual time=233.334..295.858 rows=4115 loops=1)
  Hash Cond: (((('2012-12-25'::date + (generate_series(0, 14))) - ('1 year'::interval * ((generate_series(((EXTRACT(year FROM age(('2012-12-25'::date)::timestamp with time zone, (max(event.event_date))::timestamp with time zone)))::integer), ((EXTRACT(year FROM age(('2013-01-08'::date)::timestamp with time zone, (min(event.event_date))::timestamp with time zone)))::integer))))::double precision)))::date = e.event_date)
  -> Nested Loop (cost=1966.86..2169.69 rows=15000 width=8) (actual time=76.871..77.167 rows=1530 loops=1)
        -> ProjectSet (cost=1966.86..1971.91 rows=1000 width=4) (actual time=76.859..76.874 rows=102 loops=1)
              -> Aggregate (cost=1966.86..1966.89 rows=1 width=8) (actual time=76.854..76.855 rows=1 loops=1)
                    -> Seq Scan on event (cost=0.00..1470.57 rows=99257 width=4) (actual time=0.013..7.830 rows=99257 loops=1)
        -> Materialize (cost=0.00..0.32 rows=15 width=4) (actual time=0.000..0.001 rows=15 loops=102)
              -> ProjectSet (cost=0.00..0.09 rows=15 width=4) (actual time=0.003..0.006 rows=15 loops=1)
                    -> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=1)
  -> Hash (cost=1470.57..1470.57 rows=99257 width=8) (actual time=156.265..156.266 rows=99257 loops=1)
        Buckets: 131072 Batches: 2 Memory Usage: 2966kB
        -> Seq Scan on event e (cost=0.00..1470.57 rows=99257 width=8) (actual time=0.019..85.687 rows=99257 loops=1)
Planning Time: 0.306 ms
Execution Time: 296.055 ms
EXPLAIN