explain.depesz.com

PostgreSQL's explain analyze made readable

Result: o5Gr

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 5,313.026 ↑ 1.0 100 1

Limit (cost=328,320.09..328,320.34 rows=100 width=141) (actual time=5,312.947..5,313.026 rows=100 loops=1)

2.          

Initplan (forLimit)

3. 37.273 116.058 ↑ 1.0 1 1

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

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

  • Index Cond: (customer_id IS NOT NULL)
  • Heap Fetches: 40655
5. 70.918 5,312.980 ↑ 373.9 100 1

Sort (cost=304,389.67..304,483.15 rows=37,390 width=141) (actual time=5,312.945..5,312.980 rows=100 loops=1)

  • Sort Key: payment.last_status_created DESC
  • Sort Method: top-N heapsort Memory: 52kB
6. 84.621 5,242.062 ↓ 1.8 66,699 1

Hash Left Join (cost=241,301.72..302,960.66 rows=37,390 width=141) (actual time=2,620.516..5,242.062 rows=66,699 loops=1)

  • Hash Cond: (payment.customer_id = list_customer_by_id.id)
7. 26.400 4,681.583 ↓ 1.8 66,699 1

Hash Left Join (cost=241,278.97..298,154.51 rows=37,390 width=126) (actual time=2,144.646..4,681.583 rows=66,699 loops=1)

  • Hash Cond: (payment_card.terminal_id = terminal.id)
8. 34.443 4,655.148 ↓ 1.8 66,699 1

Hash Left Join (cost=241,277.27..297,984.02 rows=37,390 width=121) (actual time=2,144.603..4,655.148 rows=66,699 loops=1)

  • Hash Cond: (payment.id = payment_agent_to_agent.payment_id)
9. 41.023 4,619.013 ↓ 1.8 66,699 1

Hash Left Join (cost=241,187.84..297,796.43 rows=37,390 width=117) (actual time=2,142.900..4,619.013 rows=66,699 loops=1)

  • Hash Cond: (payment.id = payment_transfer.payment_id)
10. 176.280 4,564.922 ↓ 1.8 66,699 1

Hash Left Join (cost=240,583.05..297,046.03 rows=37,390 width=109) (actual time=2,129.758..4,564.922 rows=66,699 loops=1)

  • Hash Cond: (payment.deal_id = deal_customer.deal_id)
11. 154.613 4,235.409 ↓ 1.8 66,699 1

Hash Left Join (cost=232,493.45..286,598.28 rows=37,390 width=92) (actual time=1,976.471..4,235.409 rows=66,699 loops=1)

  • Hash Cond: (payment.id = payment_card.payment_id)
12. 388.610 3,999.831 ↓ 1.8 66,699 1

Hash Left Join (cost=228,632.63..280,952.07 rows=37,390 width=82) (actual time=1,895.420..3,999.831 rows=66,699 loops=1)

  • Hash Cond: (payment.pair_id = payment_pair.id)
13. 948.387 1,912.668 ↓ 1.8 66,699 1

Hash Right Join (cost=81,470.41..127,082.70 rows=37,390 width=78) (actual time=196.776..1,912.668 rows=66,699 loops=1)

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

15. 49.363 196.574 ↓ 1.8 66,699 1

Hash (cost=80,564.03..80,564.03 rows=37,390 width=65) (actual time=196.573..196.574 rows=66,699 loops=1)

  • Buckets: 65536 Batches: 2 Memory Usage: 3166kB
16. 139.091 147.211 ↓ 1.8 66,699 1

Bitmap Heap Scan on payment (cost=4,079.70..80,564.03 rows=37,390 width=65) (actual time=10.713..147.211 rows=66,699 loops=1)

  • Recheck Cond: ((agent_id = 1) AND (office_id = 15))
  • Filter: (last_status_created < '2019-02-06 22:00:00+00'::timestamp with time zone)
  • Heap Blocks: exact=12990
17. 8.120 8.120 ↓ 1.8 66,704 1

Bitmap Index Scan on payment_agent_id_office_id_index (cost=0.00..4,070.36 rows=37,393 width=0) (actual time=8.119..8.120 rows=66,704 loops=1)

  • Index Cond: ((agent_id = 1) AND (office_id = 15))
18. 577.964 1,698.553 ↑ 1.0 1,448,632 1

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

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

20. 45.794 80.965 ↑ 1.0 120,792 1

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

  • Buckets: 131072 Batches: 2 Memory Usage: 3207kB
21. 35.171 35.171 ↑ 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..35.171 rows=120,792 loops=1)

22. 82.073 153.233 ↑ 1.0 198,435 1

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

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

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

24. 7.377 13.068 ↓ 1.0 20,929 1

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

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

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

26. 0.840 1.692 ↓ 1.0 3,176 1

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

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

28. 0.016 0.035 ↑ 1.0 31 1

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

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

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

30. 15.957 475.858 ↓ 42.8 42,846 1

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

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

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