explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vYaY : Optimization for: plan #49Gb

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

WindowAgg (cost=10,598,448.66..10,598,448.72 rows=1 width=148) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Sort (cost=10,598,448.66..10,598,448.66 rows=1 width=199) (actual rows= loops=)

  • Sort Key: c_2.c2g__documentnumber__c, c_5.c2g__enddate__c, c_4.c2g__matchingdate__c, c_4.lastmodifieddate
3. 0.000 0.000 ↓ 0.0

WindowAgg (cost=10,598,448.62..10,598,448.65 rows=1 width=199) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Sort (cost=10,598,448.62..10,598,448.63 rows=1 width=191) (actual rows= loops=)

  • Sort Key: c_2.c2g__documentnumber__c, c_4.c2g__matchingdate__c DESC, c_4.lastmodifieddate DESC
5. 0.000 0.000 ↓ 0.0

WindowAgg (cost=10,598,448.58..10,598,448.61 rows=1 width=191) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Sort (cost=10,598,448.58..10,598,448.59 rows=1 width=183) (actual rows= loops=)

  • Sort Key: c_2.c2g__documentnumber__c, c_5.c2g__enddate__c, c_4.c2g__matchingdate__c DESC, c_4.lastmodifieddate DESC
7. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=5,060,011.13..10,598,448.57 rows=1 width=183) (actual rows= loops=)

  • Join Filter: ((c_9.c2g__transactiontype__c)::text = 'Credit Note'::text)
8. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=5,060,009.76..10,598,428.07 rows=1 width=186) (actual rows= loops=)

  • Join Filter: ((c_9.c2g__transactiontype__c)::text = 'Cash'::text)
9. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=5,060,009.05..10,598,412.08 rows=1 width=197) (actual rows= loops=)

  • Join Filter: ((c_9.c2g__transactiontype__c)::text = ANY ('{"Cash Matching Journal",Journal}'::text[]))
10. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=5,060,008.35..10,598,396.10 rows=1 width=208) (actual rows= loops=)

  • Join Filter: ((c_7.c2g__matchingreference__c)::text = (c_6.id)::text)
11. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=488,112.09..5,443,789.68 rows=1 width=163) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=488,111.66..5,443,781.61 rows=1 width=163) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=488,111.38..5,443,773.71 rows=1 width=178) (actual rows= loops=)

  • Join Filter: ((c_4.c2g__transactionlineitem__c)::text = (c_3.id)::text)
14. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=488,111.38..4,985,712.61 rows=1 width=144) (actual rows= loops=)

  • Join Filter: ((c_1.asset_drop_prior_invoice__c)::text = (c.id)::text)
15. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.91..4,225,851.92 rows=1 width=125) (actual rows= loops=)

  • Join Filter: ((c_3.c2g__transaction__c)::text = (c_2.id)::text)
16. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.91..311,421.06 rows=1 width=78) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.35..311,412.47 rows=1 width=62) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.68..311,403.75 rows=1 width=62) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Seq Scan on c2g__codainvoice__c c (cost=0.00..311,395.03 rows=1 width=62) (actual rows= loops=)

  • Filter: ((NOT isdeleted) AND ((name)::text = 'SIN1555054'::text))
20. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.68..8.71 rows=1 width=19) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Index Only Scan using pk__7_21420__id on _7_21420 a_1 (cost=0.43..8.45 rows=1 width=19) (actual rows= loops=)

  • Index Cond: (id = (c.id)::text)
22. 0.000 0.000 ↓ 0.0

Function Scan on fn_sensitive_method method_1 (cost=0.25..0.26 rows=1 width=0) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.68..8.71 rows=1 width=19) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Index Only Scan using pk__7_21423__id on _7_21423 a (cost=0.43..8.45 rows=1 width=19) (actual rows= loops=)

  • Index Cond: (id = (c.id)::text)
25. 0.000 0.000 ↓ 0.0

Function Scan on fn_sensitive_method method (cost=0.25..0.26 rows=1 width=0) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Index Scan using pk_c2g__codatransaction__c__id on c2g__codatransaction__c c_2 (cost=0.56..8.58 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((id)::text = (c.c2g__transaction__c)::text)
  • Filter: ((NOT isdeleted) AND (c2g__transactiondate__c >= '2017-01-01'::date) AND ((c2g__transactiontype__c)::text = 'Invoice'::text))
27. 0.000 0.000 ↓ 0.0

Seq Scan on c2g__codatransactionlineitem__c c_3 (cost=0.00..3,860,431.65 rows=4,319,937 width=85) (actual rows= loops=)

  • Filter: ((NOT isdeleted) AND ((c2g__linetype__c)::text = 'Account'::text))
28. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=488,109.47..737,739.67 rows=1,769,682 width=19) (actual rows= loops=)

  • Hash Cond: ((c_1.id)::text = (a_3.id)::text)
29. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=342,918.10..528,002.47 rows=1,769,682 width=38) (actual rows= loops=)

  • Hash Cond: ((a_2.id)::text = (c_1.id)::text)
30. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.25..145,875.74 rows=1,769,474 width=19) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Function Scan on fn_sensitive_method method_2 (cost=0.25..0.26 rows=1 width=0) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Seq Scan on _7_21423 a_2 (cost=0.00..128,180.74 rows=1,769,474 width=19) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Hash (cost=306,970.82..306,970.82 rows=1,769,682 width=38) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Seq Scan on c2g__codainvoice__c c_1 (cost=0.00..306,970.82 rows=1,769,682 width=38) (actual rows= loops=)

  • Filter: (NOT isdeleted)
35. 0.000 0.000 ↓ 0.0

Hash (cost=112,725.10..112,725.10 rows=1,768,342 width=19) (actual rows= loops=)

36. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.25..112,725.10 rows=1,768,342 width=19) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Function Scan on fn_sensitive_method method_3 (cost=0.25..0.26 rows=1 width=0) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Seq Scan on _7_21420 a_3 (cost=0.00..95,041.42 rows=1,768,342 width=19) (actual rows= loops=)

39. 0.000 0.000 ↓ 0.0

Seq Scan on c2g__codacashmatchinghistory__c c_4 (cost=0.00..404,673.82 rows=4,270,982 width=72) (actual rows= loops=)

  • Filter: (NOT isdeleted)
40. 0.000 0.000 ↓ 0.0

Index Scan using pk_c2g__codaperiod__c__id on c2g__codaperiod__c c_5 (cost=0.28..7.89 rows=1 width=23) (actual rows= loops=)

  • Index Cond: ((id)::text = (c_4.c2g__period__c)::text)
  • Filter: (NOT isdeleted)
41. 0.000 0.000 ↓ 0.0

Index Scan using pk_c2g__codamatchingreference__c__id on c2g__codamatchingreference__c c_6 (cost=0.43..8.08 rows=1 width=19) (actual rows= loops=)

  • Index Cond: ((id)::text = (c_4.c2g__matchingreference__c)::text)
  • Filter: (NOT isdeleted)
42. 0.000 0.000 ↓ 0.0

Hash Join (cost=4,571,896.25..5,147,310.38 rows=583,683 width=83) (actual rows= loops=)

  • Hash Cond: ((c_8.c2g__transaction__c)::text = (c_9.id)::text)
43. 0.000 0.000 ↓ 0.0

Hash Join (cost=3,948,180.86..4,464,552.01 rows=1,016,372 width=38) (actual rows= loops=)

  • Hash Cond: ((c_7.c2g__transactionlineitem__c)::text = (c_8.id)::text)
44. 0.000 0.000 ↓ 0.0

Seq Scan on c2g__codacashmatchinghistory__c c_7 (cost=0.00..404,673.82 rows=4,270,982 width=38) (actual rows= loops=)

  • Filter: (NOT isdeleted)
45. 0.000 0.000 ↓ 0.0

Hash (cost=3,860,431.65..3,860,431.65 rows=4,319,937 width=38) (actual rows= loops=)

46. 0.000 0.000 ↓ 0.0

Seq Scan on c2g__codatransactionlineitem__c c_8 (cost=0.00..3,860,431.65 rows=4,319,937 width=38) (actual rows= loops=)

  • Filter: ((NOT isdeleted) AND ((c2g__linetype__c)::text = 'Account'::text))
47. 0.000 0.000 ↓ 0.0

Hash (cost=546,200.93..546,200.93 rows=2,961,717 width=83) (actual rows= loops=)

48. 0.000 0.000 ↓ 0.0

Seq Scan on c2g__codatransaction__c c_9 (cost=0.00..546,200.93 rows=2,961,717 width=83) (actual rows= loops=)

  • Filter: ((NOT isdeleted) AND ((c2g__transactiontype__c)::text = ANY ('{"Cash Matching Journal",Cash,"Credit Note",Journal}'::text[])))
49. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.71..15.97 rows=1 width=27) (actual rows= loops=)

50. 0.000 0.000 ↓ 0.0

Index Scan using pk_c2g__codajournal__c__id on c2g__codajournal__c c_12 (cost=0.42..8.07 rows=1 width=42) (actual rows= loops=)

  • Index Cond: ((id)::text = (c_9.c2g__journal__c)::text)
  • Filter: (NOT isdeleted)
51. 0.000 0.000 ↓ 0.0

Index Scan using pk_c2g__codaperiod__c__id on c2g__codaperiod__c c_13 (cost=0.28..7.89 rows=1 width=23) (actual rows= loops=)

  • Index Cond: ((id)::text = (c_12.c2g__period__c)::text)
  • Filter: (NOT isdeleted)
52. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.71..15.97 rows=1 width=27) (actual rows= loops=)

53. 0.000 0.000 ↓ 0.0

Index Scan using pk_c2g__codacashentry__c__id on c2g__codacashentry__c c_10 (cost=0.43..8.08 rows=1 width=42) (actual rows= loops=)

  • Index Cond: ((id)::text = (c_9.c2g__cashentry__c)::text)
  • Filter: (NOT isdeleted)
54. 0.000 0.000 ↓ 0.0

Index Scan using pk_c2g__codaperiod__c__id on c2g__codaperiod__c c_11 (cost=0.28..7.89 rows=1 width=23) (actual rows= loops=)

  • Index Cond: ((id)::text = (c_10.c2g__period__c)::text)
  • Filter: (NOT isdeleted)
55. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.37..20.49 rows=1 width=35) (actual rows= loops=)

56. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.08..12.59 rows=1 width=50) (actual rows= loops=)

57. 0.000 0.000 ↓ 0.0

Index Scan using pk_c2g__codacreditnote__c__id on c2g__codacreditnote__c c_14 (cost=0.42..8.06 rows=1 width=50) (actual rows= loops=)

  • Index Cond: ((id)::text = (c_9.c2g__salescreditnote__c)::text)
  • Filter: (NOT isdeleted)
58. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.67..4.52 rows=1 width=19) (actual rows= loops=)

59. 0.000 0.000 ↓ 0.0

Index Only Scan using pk__1439_21557__id on _1439_21557 a_4 (cost=0.42..4.25 rows=1 width=19) (actual rows= loops=)

  • Index Cond: (id = (c_14.id)::text)
60. 0.000 0.000 ↓ 0.0

Function Scan on fn_sensitive_method method_4 (cost=0.25..0.26 rows=1 width=0) (actual rows= loops=)

61. 0.000 0.000 ↓ 0.0

Index Scan using pk_c2g__codaperiod__c__id on c2g__codaperiod__c c_15 (cost=0.28..7.89 rows=1 width=23) (actual rows= loops=)

  • Index Cond: ((id)::text = (c_14.c2g__period__c)::text)
  • Filter: (NOT isdeleted)