explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JjGT

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 18.624 ↑ 1.0 20 1

Limit (cost=14,666.96..14,667.01 rows=20 width=157) (actual time=18.615..18.624 rows=20 loops=1)

2. 0.991 18.621 ↑ 59.8 20 1

Sort (cost=14,666.96..14,669.95 rows=1,196 width=157) (actual time=18.614..18.621 rows=20 loops=1)

  • Sort Key: b1.batch_end
  • Sort Method: top-N heapsort Memory: 30kB
3. 0.705 17.630 ↓ 1.0 1,210 1

Hash Left Join (cost=422.53..14,635.14 rows=1,196 width=157) (actual time=3.974..17.630 rows=1,210 loops=1)

  • Hash Cond: (batch.id = b1.id)
4. 0.693 13.016 ↓ 1.0 1,210 1

Nested Loop Left Join (cost=11.82..14,207.98 rows=1,196 width=165) (actual time=0.047..13.016 rows=1,210 loops=1)

5. 0.223 0.223 ↓ 1.0 1,210 1

Seq Scan on fraud_data fd (cost=0.00..40.96 rows=1,196 width=141) (actual time=0.008..0.223 rows=1,210 loops=1)

6. 0.000 12.100 ↑ 1.0 1 1,210

Limit (cost=11.82..11.83 rows=1 width=45) (actual time=0.010..0.010 rows=1 loops=1,210)

7. 1.210 12.100 ↑ 1.0 1 1,210

Unique (cost=11.82..11.83 rows=1 width=45) (actual time=0.009..0.010 rows=1 loops=1,210)

8. 3.630 10.890 ↑ 1.0 1 1,210

Sort (cost=11.82..11.83 rows=1 width=45) (actual time=0.009..0.009 rows=1 loops=1,210)

  • Sort Key: batch.charging DESC, batch.batch_number
  • Sort Method: quicksort Memory: 25kB
9. 3.630 7.260 ↑ 1.0 1 1,210

Bitmap Heap Scan on batch (cost=4.30..11.81 rows=1 width=45) (actual time=0.005..0.006 rows=1 loops=1,210)

  • Recheck Cond: (fd.campaign_id = campaign_id)
  • Filter: ((total_products_sold > 0) AND (charging OR (batch_end > ('now'::cstring)::date)))
  • Rows Removed by Filter: 1
  • Heap Blocks: exact=2,797
10. 3.630 3.630 ↓ 1.5 3 1,210

Bitmap Index Scan on "batch__campaign_id-charging" (cost=0.00..4.30 rows=2 width=0) (actual time=0.003..0.003 rows=3 loops=1,210)

  • Index Cond: (fd.campaign_id = campaign_id)
11. 1.169 3.909 ↓ 1.0 6,973 1

Hash (cost=323.65..323.65 rows=6,965 width=24) (actual time=3.908..3.909 rows=6,973 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 418kB
12. 2.740 2.740 ↓ 1.0 6,973 1

Seq Scan on batch b1 (cost=0.00..323.65 rows=6,965 width=24) (actual time=0.010..2.740 rows=6,973 loops=1)