explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xkWd

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

Limit (cost=359,594.27..359,594.52 rows=100 width=141) (actual time=3,448.916..3,448.964 rows=100 loops=1)

2.          

Initplan (forLimit)

3. 28.719 91.279 ↑ 1.0 1 1

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

4. 62.560 62.560 ↓ 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=0.042..62.560 rows=188,989 loops=1)

  • Index Cond: (customer_id IS NOT NULL)
  • Heap Fetches: 40655
5. 40.894 3,448.934 ↑ 680.4 100 1

Sort (cost=335,663.85..335,833.94 rows=68,037 width=141) (actual time=3,448.915..3,448.934 rows=100 loops=1)

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

Hash Left Join (cost=263,672.71..333,063.52 rows=68,037 width=141) (actual time=1,890.596..3,408.040 rows=66,700 loops=1)

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

Hash Left Join (cost=263,649.96..324,336.64 rows=68,037 width=126) (actual time=1,606.440..3,101.252 rows=66,700 loops=1)

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

Hash Left Join (cost=263,648.27..324,027.80 rows=68,037 width=121) (actual time=1,606.399..3,080.487 rows=66,700 loops=1)

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

Hash Left Join (cost=263,558.83..323,759.77 rows=68,037 width=117) (actual time=1,604.968..3,051.997 rows=66,700 loops=1)

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

Hash Left Join (cost=262,954.04..322,890.01 rows=68,037 width=109) (actual time=1,593.932..3,009.624 rows=66,700 loops=1)

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

Hash Left Join (cost=254,864.44..311,463.81 rows=68,037 width=92) (actual time=1,465.989..2,778.166 rows=66,700 loops=1)

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

Hash Left Join (cost=251,003.62..304,839.12 rows=68,037 width=82) (actual time=1,399.605..2,637.079 rows=66,700 loops=1)

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

Hash Right Join (cost=103,841.40..150,111.30 rows=68,037 width=78) (actual time=139.592..978.242 rows=66,700 loops=1)

  • Hash Cond: (deal.id = payment.deal_id)
14. 376.904 376.904 ↓ 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.017..376.904 rows=1,082,377 loops=1)

15. 32.235 139.410 ↑ 1.0 66,700 1

Hash (cost=102,192.94..102,192.94 rows=68,037 width=65) (actual time=139.410..139.410 rows=66,700 loops=1)

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

Bitmap Heap Scan on payment (cost=1,275.71..102,192.94 rows=68,037 width=65) (actual time=6.791..107.175 rows=66,700 loops=1)

  • Recheck Cond: (office_id = 15)
  • Heap Blocks: exact=12990
17. 4.885 4.885 ↑ 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=4.885..4.885 rows=66,700 loops=1)

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

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

  • Buckets: 131072 Batches: 32 Memory Usage: 2797kB
19. 863.168 863.168 ↑ 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.029..863.168 rows=1,448,632 loops=1)

20. 38.950 66.300 ↑ 1.0 120,792 1

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

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

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

22. 69.034 127.893 ↑ 1.0 198,435 1

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

  • Buckets: 65536 Batches: 4 Memory Usage: 2702kB
23. 58.859 58.859 ↑ 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..58.859 rows=198,435 loops=1)

24. 5.699 11.003 ↓ 1.0 20,929 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 1098kB
25. 5.304 5.304 ↓ 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.304 rows=20,929 loops=1)

26. 0.703 1.421 ↓ 1.0 3,176 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 157kB
27. 0.718 0.718 ↓ 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.021..0.718 rows=3,176 loops=1)

28. 0.011 0.033 ↑ 1.0 31 1

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

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

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

30. 10.402 284.134 ↓ 42.8 42,846 1

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

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

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