explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PiRQ : Optimization for: plan #RbaB

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.110 25.027 ↓ 0.0 0 1

Hash Join (cost=2,049.52..4,051.05 rows=276 width=27) (actual time=25.027..25.027 rows=0 loops=1)

  • Hash Cond: (broadcasts.facebook_page_id = facebook_pages.id)
2. 4.821 5.998 ↑ 59.4 10 1

Bitmap Heap Scan on broadcasts (cost=28.47..2,025.01 rows=594 width=27) (actual time=1.424..5.998 rows=10 loops=1)

  • Recheck Cond: ((is_sent_now AND (status = 2)) OR (((status = 2) AND (schedule_time <= '2019-04-02 14:50:06'::timestamp without time zone)) OR ((NOT is_sent_now) AND (status = 3))))
  • Filter: ((is_sent_now AND (status = 2)) OR ((NOT is_sent_now) AND (((status = 2) AND (schedule_time <= '2019-04-02 14:50:06'::timestamp without time zone)) OR ((status = 3) AND (sent_day_time <= 62320) AND ((last_sent_at + ('01:00:00'::interval * (loop_hours)::double precision)) <= '2019-04-02 14:50:06'::timestamp without time zone) AND (((repeat_type = 4) AND (2 = ANY (days))) OR ((repeat_type = ANY ('{2,3,5}'::integer[])) AND (3 = ANY (days))))))))
  • Rows Removed by Filter: 385
  • Heap Blocks: exact=889
3. 0.097 1.177 ↓ 0.0 0 1

BitmapOr (cost=28.47..28.47 rows=652 width=0) (actual time=1.177..1.177 rows=0 loops=1)

4. 0.262 0.262 ↓ 1.3 797 1

Bitmap Index Scan on broadcasts_is_sent_now_status_index (cost=0.00..18.35 rows=593 width=0) (actual time=0.262..0.262 rows=797 loops=1)

  • Index Cond: ((is_sent_now = true) AND (status = 2))
5. 0.000 0.818 ↓ 0.0 0 1

BitmapOr (cost=9.72..9.72 rows=59 width=0) (actual time=0.818..0.818 rows=0 loops=1)

6. 0.042 0.042 ↓ 0.0 0 1

Bitmap Index Scan on broadcasts_status_schedule_time_index (cost=0.00..4.54 rows=12 width=0) (actual time=0.042..0.042 rows=0 loops=1)

  • Index Cond: ((status = 2) AND (schedule_time <= '2019-04-02 14:50:06'::timestamp without time zone))
7. 0.776 0.776 ↓ 34.9 1,605 1

Bitmap Index Scan on broadcasts_is_sent_now_status_index (cost=0.00..4.88 rows=46 width=0) (actual time=0.776..0.776 rows=1,605 loops=1)

  • Index Cond: ((is_sent_now = false) AND (status = 3))
8. 2.630 18.919 ↓ 1.2 14,654 1

Hash (cost=1,865.09..1,865.09 rows=12,477 width=4) (actual time=18.919..18.919 rows=14,654 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 644kB
9. 16.289 16.289 ↓ 1.2 14,654 1

Seq Scan on facebook_pages (cost=0.00..1,865.09 rows=12,477 width=4) (actual time=0.016..16.289 rows=14,654 loops=1)

  • Filter: ((deleted_at IS NULL) AND is_token_valid)
  • Rows Removed by Filter: 12315
Planning time : 1.430 ms
Execution time : 25.216 ms