explain.depesz.com

PostgreSQL's explain analyze made readable

Result: WHhU

Settings
# exclusive inclusive rows x rows loops node
1. 0.010 2,486.822 ↑ 1.0 50 1

Limit (cost=243,568.29..243,569.66 rows=50 width=50) (actual time=2,486.787..2,486.822 rows=50 loops=1)

2. 0.023 2,486.812 ↑ 2,584.4 50 1

Group (cost=243,568.29..247,121.89 rows=129,222 width=50) (actual time=2,486.786..2,486.812 rows=50 loops=1)

  • Group Key: good.id, rent_account_good.id, transfer_task.id, return_task.id
3. 179.407 2,486.789 ↑ 2,584.4 50 1

Sort (cost=243,568.29..243,891.34 rows=129,222 width=45) (actual time=2,486.781..2,486.789 rows=50 loops=1)

  • Sort Key: good.id, rent_account_good.id, transfer_task.id, return_task.id
  • Sort Method: external merge Disk: 6640kB
4. 114.323 2,307.382 ↓ 1.0 129,234 1

Hash Left Join (cost=5,242.41..228,621.67 rows=129,222 width=45) (actual time=47.262..2,307.382 rows=129,234 loops=1)

  • Hash Cond: ((SubPlan 2) = return_task.id)
5. 176.705 1,266.252 ↓ 1.0 129,234 1

Hash Left Join (cost=2,649.63..116,383.07 rows=129,222 width=32) (actual time=22.934..1,266.252 rows=129,234 loops=1)

  • Hash Cond: ((SubPlan 1) = transfer_task.id)
6. 65.498 89.831 ↓ 1.0 129,234 1

Hash Join (cost=56.84..4,144.47 rows=129,222 width=19) (actual time=0.439..89.831 rows=129,234 loops=1)

  • Hash Cond: (rent_account_good.good_id = good.id)
7. 23.938 23.938 ↓ 1.0 129,234 1

Seq Scan on rent_account_good (cost=0.00..3,747.22 rows=129,222 width=10) (actual time=0.014..23.938 rows=129,234 loops=1)

8. 0.186 0.395 ↑ 1.0 1,193 1

Hash (cost=41.93..41.93 rows=1,193 width=13) (actual time=0.395..0.395 rows=1,193 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 72kB
9. 0.209 0.209 ↑ 1.0 1,193 1

Seq Scan on good (cost=0.00..41.93 rows=1,193 width=13) (actual time=0.004..0.209 rows=1,193 loops=1)

10. 10.581 22.208 ↓ 1.0 56,347 1

Hash (cost=1,888.46..1,888.46 rows=56,346 width=13) (actual time=22.208..22.208 rows=56,347 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 3044kB
11. 11.627 11.627 ↓ 1.0 56,347 1

Seq Scan on rent_account_task transfer_task (cost=0.00..1,888.46 rows=56,346 width=13) (actual time=0.006..11.627 rows=56,347 loops=1)

12.          

SubPlan (forHash Left Join)

13. 0.000 977.508 ↑ 1.0 1 244,377

Limit (cost=0.71..16.92 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=244,377)

14. 258.472 977.508 ↑ 1.0 1 244,377

Nested Loop (cost=0.71..16.92 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=244,377)

15. 488.754 488.754 ↑ 1.0 1 244,377

Index Scan using ratg_rag_rag_id on ratg_rag (cost=0.42..8.61 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=244,377)

  • Index Cond: (rag_id = rent_account_good.id)
  • Filter: ((task_type)::text = 'transfer'::text)
  • Rows Removed by Filter: 0
16. 230.282 230.282 ↑ 1.0 1 230,282

Index Only Scan using rent_account_task_pkey on rent_account_task (cost=0.29..8.31 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=230,282)

  • Index Cond: (id = ratg_rag.task_id)
  • Heap Fetches: 230282
17. 12.458 24.027 ↓ 1.0 56,347 1

Hash (cost=1,888.46..1,888.46 rows=56,346 width=13) (actual time=24.027..24.027 rows=56,347 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 3044kB
18. 11.569 11.569 ↓ 1.0 56,347 1

Seq Scan on rent_account_task return_task (cost=0.00..1,888.46 rows=56,346 width=13) (actual time=0.006..11.569 rows=56,347 loops=1)

19.          

SubPlan (forHash Left Join)

20. 0.000 902.780 ↑ 1.0 1 225,695

Limit (cost=0.71..16.92 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=225,695)

21. 258.468 902.780 ↑ 1.0 1 225,695

Nested Loop (cost=0.71..16.92 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=225,695)

22. 451.390 451.390 ↑ 1.0 1 225,695

Index Scan using ratg_rag_rag_id on ratg_rag ratg_rag_1 (cost=0.42..8.61 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=225,695)

  • Index Cond: (rag_id = rent_account_good.id)
  • Filter: ((task_type)::text = 'return'::text)
  • Rows Removed by Filter: 1
23. 192.922 192.922 ↑ 1.0 1 192,922

Index Only Scan using rent_account_task_pkey on rent_account_task rent_account_task_1 (cost=0.29..8.31 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=192,922)

  • Index Cond: (id = ratg_rag_1.task_id)
  • Heap Fetches: 192922
Planning time : 1.784 ms
Execution time : 2,488.421 ms