explain.depesz.com

PostgreSQL's explain analyze made readable

Result: BjN4

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.004 4.069 ↑ 1.0 20 1

Limit (cost=394.08..394.13 rows=20 width=44) (actual time=4.065..4.069 rows=20 loops=1)

2. 0.201 4.065 ↑ 9.2 20 1

Sort (cost=394.08..394.55 rows=185 width=44) (actual time=4.065..4.065 rows=20 loops=1)

  • Sort Key: ccc.batch_end
  • Sort Method: top-N heapsort Memory: 26kB
3. 0.122 3.864 ↓ 5.9 1,091 1

Subquery Scan on ccc (cost=386.39..389.16 rows=185 width=44) (actual time=3.364..3.864 rows=1,091 loops=1)

4. 0.218 3.742 ↓ 5.9 1,091 1

Unique (cost=386.39..387.31 rows=185 width=49) (actual time=3.362..3.742 rows=1,091 loops=1)

5. 1.068 3.524 ↓ 9.7 1,786 1

Sort (cost=386.39..386.85 rows=185 width=49) (actual time=3.362..3.524 rows=1,786 loops=1)

  • Sort Key: batch.campaign_id, batch.charging DESC, batch.batch_number
  • Sort Method: quicksort Memory: 300kB
6. 0.575 2.456 ↓ 9.7 1,786 1

Hash Join (cost=110.19..379.42 rows=185 width=49) (actual time=0.735..2.456 rows=1,786 loops=1)

  • Hash Cond: (batch.campaign_id = fd.campaign_id)
7. 1.198 1.413 ↓ 3.2 1,790 1

Bitmap Heap Scan on batch (cost=54.28..319.58 rows=555 width=29) (actual time=0.249..1.413 rows=1,790 loops=1)

  • Recheck Cond: (((total_products_sold > 0) AND charging) OR (batch_end > ('now'::cstring)::date))
  • Filter: ((total_products_sold > 0) AND (charging OR (batch_end > ('now'::cstring)::date)))
  • Rows Removed by Filter: 31
  • Heap Blocks: exact=246
8. 0.001 0.215 ↓ 0.0 0 1

BitmapOr (cost=54.28..54.28 rows=565 width=0) (actual time=0.215..0.215 rows=0 loops=1)

9. 0.201 0.201 ↓ 3.2 1,788 1

Bitmap Index Scan on "batch__tps-charging" (cost=0.00..49.62 rows=552 width=0) (actual time=0.201..0.201 rows=1,788 loops=1)

  • Index Cond: ((total_products_sold > 0) AND (charging = true))
10. 0.013 0.013 ↓ 4.2 51 1

Bitmap Index Scan on batch__batch_end (cost=0.00..4.38 rows=12 width=0) (actual time=0.013..0.013 rows=51 loops=1)

  • Index Cond: (batch_end > ('now'::cstring)::date)
11. 0.246 0.468 ↓ 1.0 1,210 1

Hash (cost=40.96..40.96 rows=1,196 width=32) (actual time=0.468..0.468 rows=1,210 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 92kB
12. 0.222 0.222 ↓ 1.0 1,210 1

Seq Scan on fraud_data fd (cost=0.00..40.96 rows=1,196 width=32) (actual time=0.009..0.222 rows=1,210 loops=1)

Planning time : 0.658 ms
Execution time : 4.133 ms