explain.depesz.com

PostgreSQL's explain analyze made readable

Result: b1s

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 3,716.745 ↑ 1.0 100 1

Limit (cost=359,763.10..359,763.35 rows=100 width=141) (actual time=3,716.687..3,716.745 rows=100 loops=1)

2.          

Initplan (forLimit)

3. 29.985 99.138 ↑ 1.0 1 1

Aggregate (cost=23,930.41..23,930.42 rows=1 width=32) (actual time=99.138..99.138 rows=1 loops=1)

4. 69.153 69.153 ↓ 1.0 188,989 1

Index Only Scan using payment_customer_id_index on payment payment_1 (cost=0.43..23,465.03 rows=186,149 width=4) (actual time=2.328..69.153 rows=188,989 loops=1)

  • Index Cond: (customer_id IS NOT NULL)
  • Heap Fetches: 40655
5. 41.021 3,716.707 ↑ 680.3 100 1

Sort (cost=335,832.69..336,002.76 rows=68,031 width=141) (actual time=3,716.685..3,716.707 rows=100 loops=1)

  • Sort Key: payment.last_status_created DESC
  • Sort Method: top-N heapsort Memory: 52kB
6. 22.568 3,675.686 ↑ 1.0 66,700 1

Hash Left Join (cost=263,842.73..333,232.59 rows=68,031 width=141) (actual time=2,221.280..3,675.686 rows=66,700 loops=1)

  • Hash Cond: (payment.customer_id = list_customer_by_id.id)
7. 20.599 3,302.705 ↑ 1.0 66,700 1

Hash Left Join (cost=263,819.98..324,506.48 rows=68,031 width=126) (actual time=1,870.848..3,302.705 rows=66,700 loops=1)

  • Hash Cond: (payment_card.terminal_id = terminal.id)
8. 26.806 3,282.074 ↑ 1.0 66,700 1

Hash Left Join (cost=263,818.28..324,197.66 rows=68,031 width=121) (actual time=1,870.808..3,282.074 rows=66,700 loops=1)

  • Hash Cond: (payment.id = payment_agent_to_agent.payment_id)
9. 30.829 3,253.890 ↑ 1.0 66,700 1

Hash Left Join (cost=263,728.84..323,929.65 rows=68,031 width=117) (actual time=1,869.419..3,253.890 rows=66,700 loops=1)

  • Hash Cond: (payment.id = payment_transfer.payment_id)
10. 104.739 3,211.624 ↑ 1.0 66,700 1

Hash Left Join (cost=263,124.05..323,059.91 rows=68,031 width=109) (actual time=1,857.944..3,211.624 rows=66,700 loops=1)

  • Hash Cond: (payment.deal_id = deal_customer.deal_id)
11. 77.927 2,977.713 ↑ 1.0 66,700 1

Hash Left Join (cost=255,034.45..311,633.73 rows=68,031 width=92) (actual time=1,728.723..2,977.713 rows=66,700 loops=1)

  • Hash Cond: (payment.id = payment_card.payment_id)
12. 245.199 2,832.947 ↑ 1.0 66,700 1

Hash Left Join (cost=251,173.63..305,009.06 rows=68,031 width=82) (actual time=1,661.790..2,832.947 rows=66,700 loops=1)

  • Hash Cond: (payment.pair_id = payment_pair.id)
13. 545.644 1,135.592 ↑ 1.0 66,700 1

Hash Right Join (cost=104,011.41..150,281.26 rows=68,031 width=78) (actual time=209.545..1,135.592 rows=66,700 loops=1)

  • Hash Cond: (deal.id = payment.deal_id)
14. 380.657 380.657 ↓ 1.0 1,082,377 1

Seq Scan on deal (cost=0.00..25,360.37 rows=1,082,337 width=17) (actual time=0.022..380.657 rows=1,082,377 loops=1)

15. 42.128 209.291 ↑ 1.0 66,700 1

Hash (cost=102,363.03..102,363.03 rows=68,031 width=65) (actual time=209.291..209.291 rows=66,700 loops=1)

  • Buckets: 65536 Batches: 2 Memory Usage: 3166kB
16. 128.528 167.163 ↑ 1.0 66,700 1

Bitmap Heap Scan on payment (cost=1,275.71..102,363.03 rows=68,031 width=65) (actual time=41.271..167.163 rows=66,700 loops=1)

  • Recheck Cond: (office_id = 15)
  • Filter: (last_status_created < '2019-02-06 22:00:00+00'::timestamp with time zone)
  • Heap Blocks: exact=12990
17. 38.635 38.635 ↑ 1.0 66,700 1

Bitmap Index Scan on payment_office_id_index (cost=0.00..1,258.70 rows=68,037 width=0) (actual time=38.634..38.635 rows=66,700 loops=1)

  • Index Cond: (office_id = 15)
18. 487.892 1,452.156 ↑ 1.0 1,448,632 1

Hash (cost=123,395.32..123,395.32 rows=1,448,632 width=8) (actual time=1,452.156..1,452.156 rows=1,448,632 loops=1)

  • Buckets: 131072 Batches: 32 Memory Usage: 2797kB
19. 964.264 964.264 ↑ 1.0 1,448,632 1

Seq Scan on payment payment_pair (cost=0.00..123,395.32 rows=1,448,632 width=8) (actual time=0.084..964.264 rows=1,448,632 loops=1)

20. 38.412 66.839 ↑ 1.0 120,792 1

Hash (cost=1,760.92..1,760.92 rows=120,792 width=14) (actual time=66.838..66.839 rows=120,792 loops=1)

  • Buckets: 131072 Batches: 2 Memory Usage: 3207kB
21. 28.427 28.427 ↑ 1.0 120,792 1

Seq Scan on payment_card (cost=0.00..1,760.92 rows=120,792 width=14) (actual time=0.031..28.427 rows=120,792 loops=1)

22. 69.914 129.172 ↑ 1.0 198,435 1

Hash (cost=4,443.60..4,443.60 rows=198,560 width=21) (actual time=129.171..129.172 rows=198,435 loops=1)

  • Buckets: 65536 Batches: 4 Memory Usage: 2702kB
23. 59.258 59.258 ↑ 1.0 198,435 1

Seq Scan on deal_customer (cost=0.00..4,443.60 rows=198,560 width=21) (actual time=0.023..59.258 rows=198,435 loops=1)

24. 5.859 11.437 ↓ 1.0 20,929 1

Hash (cost=343.24..343.24 rows=20,924 width=12) (actual time=11.437..11.437 rows=20,929 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1098kB
25. 5.578 5.578 ↓ 1.0 20,929 1

Seq Scan on payment_transfer (cost=0.00..343.24 rows=20,924 width=12) (actual time=0.022..5.578 rows=20,929 loops=1)

26. 0.661 1.378 ↓ 1.0 3,176 1

Hash (cost=49.75..49.75 rows=3,175 width=8) (actual time=1.378..1.378 rows=3,176 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 157kB
27. 0.717 0.717 ↓ 1.0 3,176 1

Seq Scan on payment_agent_to_agent (cost=0.00..49.75 rows=3,175 width=8) (actual time=0.022..0.717 rows=3,176 loops=1)

28. 0.011 0.032 ↑ 1.0 31 1

Hash (cost=1.31..1.31 rows=31 width=25) (actual time=0.031..0.032 rows=31 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
29. 0.021 0.021 ↑ 1.0 31 1

Seq Scan on terminal (cost=0.00..1.31 rows=31 width=25) (actual time=0.015..0.021 rows=31 loops=1)

30. 11.464 350.413 ↓ 42.8 42,846 1

Hash (cost=10.25..10.25 rows=1,000 width=36) (actual time=350.412..350.413 rows=42,846 loops=1)

  • Buckets: 65536 (originally 1024) Batches: 1 (originally 1) Memory Usage: 3031kB
31. 338.949 338.949 ↓ 42.8 42,846 1

Function Scan on list_customer_by_id (cost=0.25..10.25 rows=1,000 width=36) (actual time=331.733..338.949 rows=42,846 loops=1)