explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QlL7 : ShamrockMobile_07oct2019_after analyze

Settings
# exclusive inclusive rows x rows loops node
1. 6.232 88.355 ↓ 14.7 1,016 1

Sort (cost=2,524.34..2,524.51 rows=69 width=305) (actual time=88.098..88.355 rows=1,016 loops=1)

  • Sort Key: ((ui.lastname)::character varying(50)) COLLATE "en_US", ((ui.firstname)::character varying(50)) COLLATE "en_US", ui.duplicatename, ((login.loginname)::character varying(255)) COLLATE "en_US", ((ex.trackingnumber)::character varying(50)) COLLATE "en_US", ex.expensedate, ((ee.description)::character varying(255)) COLLATE "en_US", ((expensetype3.name)::character varying(50)) COLLATE "en_US", ee.billtoclient, ex.paid, (("*SELECT* 1".approverlastname)::character varying(50)) COLLATE "en_US", (("*SELECT* 1".approverfirstname)::character varying(50)) COLLATE "en_US", elf.expensestatus, "*SELECT* 1".effectivedateutc, (("*SELECT* 1".approvalcomments)::text) COLLATE "en_US
  • Sort Method: quicksort Memory: 328kB
  • Buffers: shared hit=18864
2.          

Initplan (forSort)

3. 0.003 0.003 ↑ 1.0 1 1

Seq Scan on systeminformation (cost=0.00..1.01 rows=1 width=4) (actual time=0.002..0.003 rows=1 loops=1)

  • Buffers: shared hit=1
4. 5.379 82.120 ↓ 14.7 1,016 1

Nested Loop (cost=110.37..2,521.22 rows=69 width=305) (actual time=6.681..82.120 rows=1,016 loops=1)

  • Join Filter: (ex.reimbursementcurrencyid = currencyinfo5.id)
  • Rows Removed by Join Filter: 6096
  • Buffers: shared hit=18864
5. 2.405 74.709 ↓ 14.7 1,016 1

Nested Loop (cost=110.37..2,510.13 rows=69 width=309) (actual time=6.660..74.709 rows=1,016 loops=1)

  • Join Filter: (ee.currencyid = currencyinfo4.id)
  • Rows Removed by Join Filter: 6096
  • Buffers: shared hit=18863
6. 1.042 70.272 ↓ 14.7 1,016 1

Nested Loop (cost=110.37..2,501.79 rows=69 width=309) (actual time=6.649..70.272 rows=1,016 loops=1)

  • Buffers: shared hit=18862
7. 2.225 67.198 ↓ 14.7 1,016 1

Nested Loop Semi Join (cost=110.24..2,490.29 rows=69 width=303) (actual time=6.645..67.198 rows=1,016 loops=1)

  • Buffers: shared hit=16830
8. 1.035 46.685 ↓ 14.7 1,016 1

Hash Right Join (cost=96.09..2,140.01 rows=69 width=315) (actual time=6.613..46.685 rows=1,016 loops=1)

  • Hash Cond: ("*SELECT* 1".expenseid = ex.id)
  • Buffers: shared hit=8284
9. 0.270 39.111 ↓ 1.2 530 1

Append (cost=2.70..2,044.38 rows=439 width=55) (actual time=0.062..39.111 rows=530 loops=1)

  • Buffers: shared hit=5029
10. 0.008 0.105 ↑ 1.4 11 1

Subquery Scan on *SELECT* 1 (cost=2.70..5.03 rows=15 width=55) (actual time=0.061..0.105 rows=11 loops=1)

  • Buffers: shared hit=3
11. 0.022 0.097 ↑ 1.4 11 1

Hash Join (cost=2.70..4.88 rows=15 width=15) (actual time=0.060..0.097 rows=11 loops=1)

  • Hash Cond: (ear.approverid = ui_1.id)
  • Buffers: shared hit=3
12. 0.034 0.060 ↑ 1.4 11 1

Hash Join (cost=1.34..3.31 rows=15 width=8) (actual time=0.032..0.060 rows=11 loops=1)

  • Hash Cond: (ean.id = ear.nodeid)
  • Buffers: shared hit=2
13. 0.014 0.014 ↑ 1.4 44 1

Seq Scan on expenseapprovalnodes ean (cost=0.00..1.60 rows=60 width=20) (actual time=0.003..0.014 rows=44 loops=1)

  • Buffers: shared hit=1
14. 0.008 0.012 ↑ 1.4 11 1

Hash (cost=1.15..1.15 rows=15 width=20) (actual time=0.012..0.012 rows=11 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
15. 0.004 0.004 ↑ 1.4 11 1

Seq Scan on expenseapprovalrequest ear (cost=0.00..1.15 rows=15 width=20) (actual time=0.002..0.004 rows=11 loops=1)

  • Buffers: shared hit=1
16. 0.010 0.015 ↑ 1.0 16 1

Hash (cost=1.16..1.16 rows=16 width=15) (actual time=0.015..0.015 rows=16 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
17. 0.005 0.005 ↑ 1.0 16 1

Seq Scan on userinfo ui_1 (cost=0.00..1.16 rows=16 width=15) (actual time=0.001..0.005 rows=16 loops=1)

  • Buffers: shared hit=1
18. 0.270 38.736 ↓ 1.2 519 1

Subquery Scan on *SELECT* 2 (cost=170.53..2,039.35 rows=424 width=55) (actual time=4.030..38.736 rows=519 loops=1)

  • Buffers: shared hit=5026
19. 1.541 38.466 ↓ 1.2 519 1

Hash Left Join (cost=170.53..2,035.11 rows=424 width=52) (actual time=4.030..38.466 rows=519 loops=1)

  • Hash Cond: ((split_part(effective.uri, ':'::text, 5))::integer = ui_2.id)
  • Buffers: shared hit=5026
20. 0.515 36.911 ↓ 1.2 519 1

Nested Loop Left Join (cost=169.17..2,029.17 rows=424 width=113) (actual time=3.994..36.911 rows=519 loops=1)

  • Buffers: shared hit=5025
21. 0.856 21.864 ↓ 1.2 519 1

Nested Loop Left Join (cost=168.88..1,388.49 rows=424 width=45) (actual time=3.957..21.864 rows=519 loops=1)

  • Buffers: shared hit=3142
22. 0.630 5.438 ↓ 1.2 519 1

Hash Right Join (cost=168.59..747.82 rows=424 width=45) (actual time=3.917..5.438 rows=519 loops=1)

  • Hash Cond: (kvar.exphistoryid = eh.id)
  • Buffers: shared hit=1259
23. 1.035 1.035 ↑ 1.0 1,170 1

Index Scan using ixexahkvkey on expenseapprovalhistorykeyvalue kvar (cost=0.41..573.40 rows=1,170 width=4) (actual time=0.024..1.035 rows=1,170 loops=1)

  • Index Cond: (upper(key) = 'URN:REPLICON:APPROVAL-HISTORICAL-ACTION-DATA-KEY:COMPLETED-APPROVAL-REQUEST-APPROVAL-AGENT-DESCRIPTION-APPROVER-ROLE'::text)
  • Buffers: shared hit=852
24. 0.185 3.773 ↓ 1.2 519 1

Hash (cost=162.87..162.87 rows=424 width=45) (actual time=3.773..3.773 rows=519 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 40kB
  • Buffers: shared hit=407
25. 0.606 3.588 ↓ 1.2 519 1

Hash Join (cost=88.77..162.87 rows=424 width=45) (actual time=2.301..3.588 rows=519 loops=1)

  • Hash Cond: (eh.id = exphistory.id)
  • Buffers: shared hit=407
26. 0.789 0.839 ↓ 2.0 1,680 1

Index Scan using ixexhaction on exphistory eh (cost=3.63..73.93 rows=847 width=45) (actual time=0.073..0.839 rows=1,680 loops=1)

  • Index Cond: (action = ANY ('{2,3,6}'::integer[]))
  • Filter: (NOT (hashed SubPlan 5))
  • Rows Removed by Filter: 21
  • Buffers: shared hit=135
27.          

SubPlan (forIndex Scan)

28. 0.030 0.050 ↑ 1.4 11 1

Hash Join (cost=1.34..3.31 rows=15 width=4) (actual time=0.024..0.050 rows=11 loops=1)

  • Hash Cond: (ean_1.id = ear_1.nodeid)
  • Buffers: shared hit=2
29. 0.010 0.010 ↑ 1.4 44 1

Seq Scan on expenseapprovalnodes ean_1 (cost=0.00..1.60 rows=60 width=20) (actual time=0.002..0.010 rows=44 loops=1)

  • Buffers: shared hit=1
30. 0.007 0.010 ↑ 1.4 11 1

Hash (cost=1.15..1.15 rows=15 width=16) (actual time=0.010..0.010 rows=11 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
31. 0.003 0.003 ↑ 1.4 11 1

Seq Scan on expenseapprovalrequest ear_1 (cost=0.00..1.15 rows=15 width=16) (actual time=0.001..0.003 rows=11 loops=1)

  • Buffers: shared hit=1
32. 0.149 2.143 ↓ 2.6 530 1

Hash (cost=82.64..82.64 rows=200 width=4) (actual time=2.143..2.143 rows=530 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 27kB
  • Buffers: shared hit=272
33. 0.336 1.994 ↓ 2.6 530 1

HashAggregate (cost=80.64..82.64 rows=200 width=4) (actual time=1.854..1.994 rows=530 loops=1)

  • Group Key: exphistory.id
  • Buffers: shared hit=272
34. 0.747 1.658 ↑ 1.0 530 1

Unique (cost=0.28..73.99 rows=532 width=8) (actual time=0.009..1.658 rows=530 loops=1)

  • Buffers: shared hit=272
35. 0.911 0.911 ↑ 1.0 2,666 1

Index Only Scan using ix2exhexpenseidid on exphistory (cost=0.28..67.31 rows=2,669 width=8) (actual time=0.008..0.911 rows=2,666 loops=1)

  • Heap Fetches: 1388
  • Buffers: shared hit=272
36. 15.570 15.570 ↑ 1.0 1 519

Index Scan using ixexahkvexphistoryid on expenseapprovalhistorykeyvalue actual (cost=0.29..1.50 rows=1 width=76) (actual time=0.028..0.030 rows=1 loops=519)

  • Index Cond: (exphistoryid = eh.id)
  • Filter: (upper(key) = 'URN:REPLICON:APPROVAL-HISTORICAL-ACTION-DATA-KEY:ACTING-ACTUAL-USER'::text)
  • Rows Removed by Filter: 18
  • Buffers: shared hit=1883
37. 14.532 14.532 ↑ 1.0 1 519

Index Scan using ixexahkvexphistoryid on expenseapprovalhistorykeyvalue effective (cost=0.29..1.50 rows=1 width=76) (actual time=0.027..0.028 rows=1 loops=519)

  • Index Cond: (exphistoryid = eh.id)
  • Filter: (upper(key) = 'URN:REPLICON:APPROVAL-HISTORICAL-ACTION-DATA-KEY:ACTING-EFFECTIVE-USER'::text)
  • Rows Removed by Filter: 18
  • Buffers: shared hit=1883
38. 0.008 0.014 ↑ 1.0 16 1

Hash (cost=1.16..1.16 rows=16 width=15) (actual time=0.014..0.014 rows=16 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
39. 0.006 0.006 ↑ 1.0 16 1

Seq Scan on userinfo ui_2 (cost=0.00..1.16 rows=16 width=15) (actual time=0.002..0.006 rows=16 loops=1)

  • Buffers: shared hit=1
40. 0.781 6.539 ↓ 14.7 1,016 1

Hash (cost=92.53..92.53 rows=69 width=264) (actual time=6.539..6.539 rows=1,016 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 208kB
  • Buffers: shared hit=3255
41. 0.606 5.758 ↓ 14.7 1,016 1

Hash Left Join (cost=12.46..92.53 rows=69 width=264) (actual time=0.138..5.758 rows=1,016 loops=1)

  • Hash Cond: (ee.projectid = pj.id)
  • Join Filter: ((ee.entrydate >= pc.effectivedate) AND (ee.entrydate <= pc.enddate))
  • Buffers: shared hit=3255
42. 1.084 5.150 ↓ 14.7 1,016 1

Nested Loop (cost=4.97..84.76 rows=69 width=244) (actual time=0.123..5.150 rows=1,016 loops=1)

  • Buffers: shared hit=3254
43. 0.359 3.012 ↓ 10.3 527 1

Hash Join (cost=4.70..62.73 rows=51 width=59) (actual time=0.116..3.012 rows=527 loops=1)

  • Hash Cond: (ex.userid = login.userid)
  • Buffers: shared hit=1611
44. 0.339 2.632 ↓ 10.3 527 1

Hash Join (cost=3.33..60.67 rows=51 width=56) (actual time=0.084..2.632 rows=527 loops=1)

  • Hash Cond: (ex.userid = ui.id)
  • Buffers: shared hit=1610
45. 0.546 2.273 ↓ 10.3 527 1

Nested Loop (cost=1.98..58.61 rows=51 width=40) (actual time=0.052..2.273 rows=527 loops=1)

  • Buffers: shared hit=1609
46. 0.399 0.673 ↓ 9.2 527 1

Hash Join (cost=1.70..35.85 rows=57 width=32) (actual time=0.042..0.673 rows=527 loops=1)

  • Hash Cond: (ex.reimbursementcurrencyid = exchangerate.fixedcurrencyid)
  • Join Filter: ((ex.expensedate >= exchangerate.effectivedate) AND (ex.expensedate <= exchangerate.enddate))
  • Buffers: shared hit=15
47. 0.255 0.255 ↓ 1.0 527 1

Seq Scan on expense ex (cost=0.00..20.71 rows=512 width=28) (actual time=0.008..0.255 rows=527 loops=1)

  • Filter: ((expensedate >= '2019-01-01'::date) AND (expensedate <= '2019-12-31'::date))
  • Rows Removed by Filter: 3
  • Buffers: shared hit=13
48. 0.002 0.019 ↑ 1.0 7 1

Hash (cost=1.61..1.61 rows=7 width=12) (actual time=0.019..0.019 rows=7 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=2
49. 0.017 0.017 ↑ 1.0 7 1

Seq Scan on exchangerate (cost=0.00..1.61 rows=7 width=12) (actual time=0.010..0.017 rows=7 loops=1)

  • Filter: (variablecurrencyid = $0)
  • Rows Removed by Filter: 42
  • Buffers: shared hit=2
50. 1.054 1.054 ↑ 1.0 1 527

Index Scan using dm_expenselist_facts_pkey on dm_expenselist_facts elf (cost=0.28..0.39 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=527)

  • Index Cond: (expenseid = ex.id)
  • Filter: (expensestatus = ANY ('{0,1,2,3}'::integer[]))
  • Buffers: shared hit=1594
51. 0.011 0.020 ↑ 1.0 16 1

Hash (cost=1.16..1.16 rows=16 width=16) (actual time=0.020..0.020 rows=16 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
52. 0.009 0.009 ↑ 1.0 16 1

Seq Scan on userinfo ui (cost=0.00..1.16 rows=16 width=16) (actual time=0.002..0.009 rows=16 loops=1)

  • Buffers: shared hit=1
53. 0.013 0.021 ↑ 1.0 16 1

Hash (cost=1.16..1.16 rows=16 width=11) (actual time=0.021..0.021 rows=16 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
54. 0.008 0.008 ↑ 1.0 16 1

Seq Scan on login (cost=0.00..1.16 rows=16 width=11) (actual time=0.004..0.008 rows=16 loops=1)

  • Buffers: shared hit=1
55. 1.054 1.054 ↓ 2.0 2 527

Index Scan using ixeeexpenseid on expenseentry ee (cost=0.28..0.42 rows=1 width=185) (actual time=0.001..0.002 rows=2 loops=527)

  • Index Cond: (expenseid = ex.id)
  • Filter: (expensetypeid = ANY ('{8,15,11,14,16,3,12,2,5,6,7,10,9,19,1,18,13,4}'::integer[]))
  • Buffers: shared hit=1643
56. 0.000 0.002 ↓ 0.0 0 1

Hash (cost=7.43..7.43 rows=5 width=44) (actual time=0.002..0.002 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
  • Buffers: shared hit=1
57. 0.000 0.002 ↓ 0.0 0 1

Nested Loop (cost=0.28..7.43 rows=5 width=44) (actual time=0.002..0.002 rows=0 loops=1)

  • Buffers: shared hit=1
58. 0.002 0.002 ↓ 0.0 0 1

Index Only Scan using project_pkey on project pj (cost=0.12..2.14 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=1)

  • Heap Fetches: 0
  • Buffers: shared hit=1
59. 0.000 0.000 ↓ 0.0 0

Index Scan using uix4pc_projectclienteffectiveend on projectclient pc (cost=0.15..5.24 rows=5 width=44) (never executed)

  • Index Cond: (projectid = pj.id)
60. 4.839 18.288 ↑ 5.0 1 1,016

Hash Right Join (cost=14.15..27.34 rows=5 width=4) (actual time=0.018..0.018 rows=1 loops=1,016)

  • Hash Cond: (userhierarchy8.userid = expense7.userid)
  • Filter: ((expense7.userid = 6) OR ((userhierarchy8.supervisorid = 6) AND ((userhierarchy8.startdate IS NULL) OR (userhierarchy8.startdate <= '2019-10-07'::date)) AND ((userhierarchy8.enddate IS NULL) OR (userhierarchy8.enddate >= '2019-10-07'::date))) OR (alternatives: SubPlan 2 or hashed SubPlan 3) OR (exphistory9.userid = 6) OR (hashed SubPlan 4))
  • Buffers: shared hit=8546
61. 1.016 1.016 ↑ 2.2 4 1,016

Seq Scan on userhierarchy userhierarchy8 (cost=0.00..1.09 rows=9 width=24) (actual time=0.001..0.001 rows=4 loops=1,016)

  • Buffers: shared hit=1016
62. 2.032 12.192 ↓ 1.2 6 1,016

Hash (cost=0.82..0.82 rows=5 width=12) (actual time=0.012..0.012 rows=6 loops=1,016)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=7281
63. 4.064 10.160 ↓ 1.2 6 1,016

Nested Loop Left Join (cost=0.56..0.82 rows=5 width=12) (actual time=0.005..0.010 rows=6 loops=1,016)

  • Buffers: shared hit=7281
64. 2.032 2.032 ↑ 1.0 1 1,016

Index Scan using expense_pkey on expense expense7 (cost=0.28..0.33 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=1,016)

  • Index Cond: (id = ex.id)
  • Buffers: shared hit=3066
65. 4.064 4.064 ↓ 1.2 6 1,016

Index Scan using ix2exhexpenseidid on exphistory exphistory9 (cost=0.28..0.45 rows=5 width=8) (actual time=0.002..0.004 rows=6 loops=1,016)

  • Index Cond: (expenseid = expense7.id)
  • Buffers: shared hit=4215
66.          

SubPlan (forHash Right Join)

67. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.00..2.99 rows=1 width=0) (never executed)

  • Join Filter: (expenseapprovalrequest10.nodeid = expenseapprovalnodes11.id)
68. 0.000 0.000 ↓ 0.0 0

Seq Scan on expenseapprovalrequest expenseapprovalrequest10 (cost=0.00..1.19 rows=1 width=16) (never executed)

  • Filter: (approverid = 6)
69. 0.000 0.000 ↓ 0.0 0

Seq Scan on expenseapprovalnodes expenseapprovalnodes11 (cost=0.00..1.75 rows=4 width=16) (never executed)

  • Filter: (expenseid = expense7.id)
70. 0.009 0.018 ↓ 0.0 0 1

Hash Join (cost=1.20..3.04 rows=1 width=4) (actual time=0.018..0.018 rows=0 loops=1)

  • Hash Cond: (expenseapprovalnodes11_1.id = expenseapprovalrequest10_1.nodeid)
  • Buffers: shared hit=2
71. 0.003 0.003 ↑ 60.0 1 1

Seq Scan on expenseapprovalnodes expenseapprovalnodes11_1 (cost=0.00..1.60 rows=60 width=20) (actual time=0.003..0.003 rows=1 loops=1)

  • Buffers: shared hit=1
72. 0.001 0.006 ↓ 0.0 0 1

Hash (cost=1.19..1.19 rows=1 width=16) (actual time=0.006..0.006 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
  • Buffers: shared hit=1
73. 0.005 0.005 ↓ 0.0 0 1

Seq Scan on expenseapprovalrequest expenseapprovalrequest10_1 (cost=0.00..1.19 rows=1 width=16) (actual time=0.005..0.005 rows=0 loops=1)

  • Filter: (approverid = 6)
  • Rows Removed by Filter: 11
  • Buffers: shared hit=1
74. 0.223 0.223 ↓ 1.0 530 1

Index Only Scan using expense_pkey on expense expense12 (cost=0.28..11.99 rows=514 width=4) (actual time=0.009..0.223 rows=530 loops=1)

  • Heap Fetches: 524
  • Buffers: shared hit=247
75. 2.032 2.032 ↑ 1.0 1 1,016

Index Scan using expensetype_pkey on expensetype expensetype3 (cost=0.14..0.16 rows=1 width=14) (actual time=0.001..0.002 rows=1 loops=1,016)

  • Index Cond: (id = ee.expensetypeid)
  • Buffers: shared hit=2032
76. 2.027 2.032 ↑ 1.0 7 1,016

Materialize (cost=0.00..1.10 rows=7 width=8) (actual time=0.000..0.002 rows=7 loops=1,016)

  • Buffers: shared hit=1
77. 0.005 0.005 ↑ 1.0 7 1

Seq Scan on currencyinfo currencyinfo4 (cost=0.00..1.07 rows=7 width=8) (actual time=0.001..0.005 rows=7 loops=1)

  • Buffers: shared hit=1
78. 2.032 2.032 ↑ 1.0 7 1,016

Materialize (cost=0.00..1.10 rows=7 width=8) (actual time=0.000..0.002 rows=7 loops=1,016)

  • Buffers: shared hit=1
79. 0.000 0.000 ↑ 1.0 7 1

Seq Scan on currencyinfo currencyinfo5 (cost=0.00..1.07 rows=7 width=8) (actual time=0.000..0.000 rows=7 loops=1)

  • Buffers: shared hit=1
Planning time : 8.916 ms
Execution time : 89.214 ms