explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3vHt

Settings
# exclusive inclusive rows x rows loops node
1. 0.016 8.801 ↑ 1.0 50 1

Limit (cost=321.79..321.92 rows=50 width=527) (actual time=8.784..8.801 rows=50 loops=1)

2. 0.064 8.785 ↑ 12.0 50 1

Sort (cost=321.79..323.29 rows=600 width=527) (actual time=8.783..8.785 rows=50 loops=1)

  • Sort Key: client_contract.creation_date DESC
  • Sort Method: quicksort Memory: 85kB
3. 0.891 8.721 ↑ 7.0 86 1

Hash Right Join (cost=215.06..301.86 rows=600 width=527) (actual time=8.663..8.721 rows=86 loops=1)

  • Hash Cond: ((assigned_territories.uuid)::text = lbto.office_uuid)
4. 0.372 0.372 ↓ 1.0 2,825 1

Index Only Scan using idx_assigned_territories_uuid on assigned_territories (cost=0.28..55.17 rows=2,706 width=16) (actual time=0.024..0.372 rows=2,825 loops=1)

  • Heap Fetches: 0
5. 0.088 7.458 ↑ 1.2 86 1

Hash (cost=213.50..213.50 rows=102 width=540) (actual time=7.457..7.458 rows=86 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 50kB
6. 0.051 7.370 ↑ 1.2 86 1

Nested Loop Left Join (cost=6.57..213.50 rows=102 width=540) (actual time=0.284..7.370 rows=86 loops=1)

7. 0.078 7.061 ↓ 10.8 86 1

Nested Loop Left Join (cost=6.29..211.13 rows=8 width=531) (actual time=0.272..7.061 rows=86 loops=1)

8. 0.720 6.811 ↓ 10.8 86 1

Nested Loop Left Join (cost=6.02..191.18 rows=8 width=498) (actual time=0.263..6.811 rows=86 loops=1)

9. 0.044 5.919 ↓ 10.8 86 1

Nested Loop Left Join (cost=4.03..166.26 rows=8 width=492) (actual time=0.232..5.919 rows=86 loops=1)

10. 0.019 5.531 ↓ 10.8 86 1

Nested Loop Left Join (cost=3.62..145.22 rows=8 width=458) (actual time=0.216..5.531 rows=86 loops=1)

11. 0.019 5.168 ↓ 10.8 86 1

Nested Loop Left Join (cost=3.33..125.18 rows=8 width=431) (actual time=0.204..5.168 rows=86 loops=1)

12. 0.037 4.977 ↓ 10.8 86 1

Nested Loop Left Join (cost=3.06..113.30 rows=8 width=431) (actual time=0.193..4.977 rows=86 loops=1)

13. 0.073 4.510 ↓ 10.8 86 1

Nested Loop (cost=2.64..100.90 rows=8 width=429) (actual time=0.156..4.510 rows=86 loops=1)

14. 0.063 4.007 ↓ 86.0 86 1

Nested Loop Left Join (cost=2.09..90.28 rows=1 width=407) (actual time=0.132..4.007 rows=86 loops=1)

15. 0.015 3.600 ↓ 86.0 86 1

Nested Loop (cost=1.67..87.64 rows=1 width=365) (actual time=0.128..3.600 rows=86 loops=1)

16. 0.042 3.241 ↓ 86.0 86 1

Nested Loop (cost=1.39..85.13 rows=1 width=338) (actual time=0.111..3.241 rows=86 loops=1)

17. 0.112 2.769 ↓ 86.0 86 1

Nested Loop Left Join (cost=0.97..82.48 rows=1 width=292) (actual time=0.093..2.769 rows=86 loops=1)

  • Join Filter: (contract_status.code = client_contract.status_id)
  • Rows Removed by Join Filter: 225
18. 0.117 2.571 ↓ 86.0 86 1

Nested Loop Left Join (cost=0.97..81.21 rows=1 width=228) (actual time=0.086..2.571 rows=86 loops=1)

  • Join Filter: (contract_type.code = client_contract.type_id)
  • Rows Removed by Join Filter: 94
19. 0.096 2.368 ↓ 86.0 86 1

Nested Loop (cost=0.97..80.08 rows=1 width=134) (actual time=0.076..2.368 rows=86 loops=1)

20. 0.298 0.298 ↓ 31.3 94 1

Index Scan using idx_client_contract_creator on client_contract (cost=0.42..71.76 rows=3 width=82) (actual time=0.037..0.298 rows=94 loops=1)

  • Index Cond: (creator_id = '31399'::text)
  • Filter: ((responsible_office_id = '1210'::text) OR (responsible_office_id = '44'::text))
21. 1.974 1.974 ↑ 1.0 1 94

Index Scan using contragent_pkey on contragent (cost=0.55..2.78 rows=1 width=84) (actual time=0.021..0.021 rows=1 loops=94)

  • Index Cond: ((id = client_contract.contragent_id) AND (lang = 'rus'::text))
  • Filter: (city_code = '44'::text)
  • Rows Removed by Filter: 0
22. 0.086 0.086 ↓ 2.0 2 86

Seq Scan on contract_type (cost=0.00..1.11 rows=1 width=96) (actual time=0.001..0.001 rows=2 loops=86)

  • Filter: (lang = 'rus'::text)
23. 0.086 0.086 ↓ 4.0 4 86

Seq Scan on contract_status (cost=0.00..1.26 rows=1 width=96) (actual time=0.001..0.001 rows=4 loops=86)

  • Filter: (lang = 'rus'::text)
24. 0.430 0.430 ↑ 1.0 1 86

Index Scan using users_catalog_code_lang_key on users_catalog creator (cost=0.41..2.64 rows=1 width=56) (actual time=0.005..0.005 rows=1 loops=86)

  • Index Cond: ((code = '31399'::text) AND (lang = 'rus'::text))
  • Filter: (subdivision_id = '458'::text)
25. 0.344 0.344 ↑ 1.0 1 86

Index Scan using subdivision_code_lang_key on subdivision creatorsubdivision (cost=0.29..2.50 rows=1 width=35) (actual time=0.003..0.004 rows=1 loops=86)

  • Index Cond: ((code = '458'::text) AND (lang = 'rus'::text))
26. 0.344 0.344 ↑ 1.0 1 86

Index Scan using users_catalog_code_lang_key on users_catalog auditor (cost=0.41..2.63 rows=1 width=52) (actual time=0.004..0.004 rows=1 loops=86)

  • Index Cond: ((code = client_contract.auditor_id) AND (lang = 'rus'::text))
27. 0.430 0.430 ↑ 8.0 1 86

Index Scan using city_code_lang_key on city contragentcity (cost=0.55..10.54 rows=8 width=30) (actual time=0.005..0.005 rows=1 loops=86)

  • Index Cond: ((code = '44'::text) AND (lang = 'rus'::text))
28. 0.430 0.430 ↑ 1.0 1 86

Index Only Scan using contracts_currencies_pkey on contracts_currencies (cost=0.42..1.54 rows=1 width=6) (actual time=0.004..0.005 rows=1 loops=86)

  • Index Cond: (contract_id = client_contract.id)
  • Heap Fetches: 0
29. 0.172 0.172 ↓ 0.0 0 86

Index Only Scan using contracts_reverse_rule_idx on contracts_reverse_rule (cost=0.28..1.44 rows=4 width=4) (actual time=0.002..0.002 rows=0 loops=86)

  • Index Cond: (contract_id = client_contract.id)
  • Heap Fetches: 0
30. 0.344 0.344 ↑ 1.0 1 86

Index Scan using subdivision_code_lang_key on subdivision (cost=0.29..2.50 rows=1 width=35) (actual time=0.004..0.004 rows=1 loops=86)

  • Index Cond: ((code = client_contract.subdivision_id) AND (lang = 'rus'::text))
31. 0.344 0.344 ↑ 1.0 1 86

Index Scan using branch_code_lang_key on branch responsible_office (cost=0.41..2.63 rows=1 width=39) (actual time=0.004..0.004 rows=1 loops=86)

  • Index Cond: ((code = client_contract.responsible_office_id) AND (lang = 'rus'::text))
32. 0.000 0.172 ↑ 1.0 1 86

Index Only Scan using contract_id_status_code_change_date_unique on contract_status_history csh (cost=1.99..3.12 rows=1 width=14) (actual time=0.002..0.002 rows=1 loops=86)

  • Index Cond: ((contract_id = client_contract.id) AND (status_code = client_contract.status_id) AND (change_date = (SubPlan 2)))
  • Heap Fetches: 0
33.          

SubPlan (for Index Only Scan)

34. 0.086 0.602 ↑ 1.0 1 86

Result (cost=1.55..1.56 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=86)

35.          

Initplan (for Result)

36. 0.000 0.516 ↑ 1.0 1 86

Limit (cost=0.43..1.55 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=86)

37. 0.516 0.516 ↑ 1.0 1 86

Index Only Scan Backward using contract_id_status_code_change_date_unique on contract_status_history cshi (cost=0.43..1.55 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=86)

  • Index Cond: ((contract_id = client_contract.id) AND (status_code = client_contract.status_id) AND (change_date IS NOT NULL))
  • Heap Fetches: 0
38. 0.172 0.172 ↓ 0.0 0 86

Index Scan using link_branch_to_office_branch_code_key on link_branch_to_office lbto (cost=0.27..2.49 rows=1 width=42) (actual time=0.002..0.002 rows=0 loops=86)

  • Index Cond: (branch_code = client_contract.responsible_office_id)
  • Filter: (lang = 'rus'::text)
39. 0.258 0.258 ↑ 1.0 1 86

Index Scan using currency_code_lang_key on currency (cost=0.28..0.30 rows=1 width=13) (actual time=0.003..0.003 rows=1 loops=86)

  • Index Cond: ((code = contracts_currencies.currency_id) AND (lang = 'rus'::text))
Planning time : 45.502 ms
Execution time : 9.156 ms