explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JNZ : _sg_table

Settings
# exclusive inclusive rows x rows loops node
1. 625.985 11,114,329.610 ↑ 2.1 688,436 1

Unique (cost=1,540,749,950.46..1,540,782,925.07 rows=1,465,538 width=116) (actual time=11,111,562.761..11,114,329.610 rows=688,436 loops=1)

2. 9,719.821 11,113,703.625 ↑ 1.1 1,336,949 1

Sort (cost=1,540,749,950.46..1,540,753,614.31 rows=1,465,538 width=116) (actual time=11,111,562.737..11,113,703.625 rows=1,336,949 loops=1)

  • Sort Key: sa.base, sa.variant, (COALESCE(sa.bid_item_id, tb.bid_item_id)), (COALESCE(sa.entity_type, tb.entity_type)), (COALESCE(sa.entity_id, tb.entity_id)), tb.task_id, tb.bid_id, tb.bid_adjustment_id
  • Sort Method: external merge Disk: 65304kB
3. 227.294 11,103,983.804 ↑ 1.1 1,336,949 1

Append (cost=14,197.67..1,540,419,523.40 rows=1,465,538 width=116) (actual time=26.569..11,103,983.804 rows=1,336,949 loops=1)

4. 917.287 823,740.985 ↑ 1.1 673,022 1

Nested Loop Left Join (cost=14,197.67..832,569,107.03 rows=732,769 width=73) (actual time=26.568..823,740.985 rows=673,022 loops=1)

5. 83.178 83.178 ↑ 1.0 57,470 1

Seq Scan on _shots_and_assets sa (cost=0.00..1,045.70 rows=57,470 width=34) (actual time=0.016..83.178 rows=57,470 loops=1)

6. 229,017.950 822,740.520 ↓ 2.2 11 57,470

Bitmap Heap Scan on _tasks_and_bids tb (cost=14,197.67..14,486.95 rows=5 width=25) (actual time=12.089..14.316 rows=11 loops=57,470)

  • Recheck Cond: (((sa.entity_id = entity_id) AND ((sa.entity_type)::text = (entity_type)::text)) OR (entity_type IS NULL))
  • Filter: ((((sa.entity_type)::text = (entity_type)::text) AND (sa.entity_id = entity_id)) OR ((entity_type IS NULL) AND (sa.bid_item_id = bid_item_id)))
  • Rows Removed by Filter: 16068
  • Heap Blocks: exact=7397818
7. 172.410 593,722.570 ↓ 0.0 0 57,470

BitmapOr (cost=14,197.67..14,197.67 rows=16,302 width=0) (actual time=10.331..10.331 rows=0 loops=57,470)

8. 804.580 804.580 ↓ 2.5 10 57,470

Bitmap Index Scan on ix_tasks_and_bids_entity_type4 (cost=0.00..0.63 rows=4 width=0) (actual time=0.014..0.014 rows=10 loops=57,470)

  • Index Cond: ((sa.entity_id = entity_id) AND ((sa.entity_type)::text = (entity_type)::text))
9. 592,745.580 592,745.580 ↑ 1.0 16,069 57,470

Bitmap Index Scan on ix_tasks_and_bids_entity_type4 (cost=0.00..14,043.08 rows=16,299 width=0) (actual time=10.314..10.314 rows=16,069 loops=57,470)

  • Index Cond: (entity_type IS NULL)
10. 6,164,745.886 10,280,015.525 ↑ 1.1 663,927 1

Nested Loop Left Join (cost=0.00..707,835,760.99 rows=732,769 width=73) (actual time=31.678..10,280,015.525 rows=663,927 loops=1)

  • Join Filter: ((((sa_1.entity_type)::text = (tb_1.entity_type)::text) AND (sa_1.entity_id = tb_1.entity_id)) OR ((tb_1.entity_type IS NULL) AND (sa_1.bid_item_id = tb_1.bid_item_id)))
  • Rows Removed by Join Filter: 35390584357
11. 353.717 353.717 ↑ 1.0 615,821 1

Seq Scan on _tasks_and_bids tb_1 (cost=0.00..9,914.21 rows=615,821 width=25) (actual time=0.016..353.717 rows=615,821 loops=1)

12. 4,114,908.279 4,114,915.922 ↑ 1.0 57,470 615,821

Materialize (cost=0.00..1,333.05 rows=57,470 width=34) (actual time=0.002..6.682 rows=57,470 loops=615,821)

13. 7.643 7.643 ↑ 1.0 57,470 1

Seq Scan on _shots_and_assets sa_1 (cost=0.00..1,045.70 rows=57,470 width=34) (actual time=0.009..7.643 rows=57,470 loops=1)

Planning time : 1.080 ms
Execution time : 11,115,265.891 ms