explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PbAy : ShamrockMobile_07oct2019

Settings
# exclusive inclusive rows x rows loops node
1. 7.401 33,775.351 ↓ 1,016.0 1,016 1

Sort (cost=2,107.62..2,107.62 rows=1 width=983) (actual time=33,775.086..33,775.351 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=4713319
2.          

Initplan (forSort)

3. 0.005 0.005 ↑ 1.0 1 1

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

  • Buffers: shared hit=1
4. 9.749 33,767.945 ↓ 1,016.0 1,016 1

Nested Loop (cost=18.21..2,106.60 rows=1 width=983) (actual time=22.422..33,767.945 rows=1,016 loops=1)

  • Buffers: shared hit=4713319
5. 4.403 33,755.148 ↓ 1,016.0 1,016 1

Nested Loop Semi Join (cost=18.08..2,106.39 rows=1 width=977) (actual time=22.404..33,755.148 rows=1,016 loops=1)

  • Join Filter: (ex.id = expense7.id)
  • Buffers: shared hit=4711287
6. 3.782 33,721.281 ↓ 1,016.0 1,016 1

Nested Loop (cost=3.93..2,079.04 rows=1 width=989) (actual time=21.912..33,721.281 rows=1,016 loops=1)

  • Join Filter: (ex.reimbursementcurrencyid = currencyinfo5.id)
  • Rows Removed by Join Filter: 6096
  • Buffers: shared hit=4702741
7. 4.133 33,715.467 ↓ 1,016.0 1,016 1

Nested Loop (cost=3.93..2,077.88 rows=1 width=879) (actual time=21.905..33,715.467 rows=1,016 loops=1)

  • Join Filter: (ee.currencyid = currencyinfo4.id)
  • Rows Removed by Join Filter: 6096
  • Buffers: shared hit=4701725
8. 161.926 33,708.286 ↓ 1,016.0 1,016 1

Nested Loop Left Join (cost=3.93..2,076.72 rows=1 width=765) (actual time=21.897..33,708.286 rows=1,016 loops=1)

  • Join Filter: (ex.id = "*SELECT* 1".expenseid)
  • Rows Removed by Join Filter: 537464
  • Buffers: shared hit=4700709
9. 1.579 26.488 ↓ 1,016.0 1,016 1

Nested Loop (cost=1.24..35.40 rows=1 width=489) (actual time=1.450..26.488 rows=1,016 loops=1)

  • Buffers: shared hit=7395
10. 2.335 21.861 ↓ 1,016.0 1,016 1

Nested Loop (cost=1.10..35.23 rows=1 width=486) (actual time=1.446..21.861 rows=1,016 loops=1)

  • Buffers: shared hit=5363
11. 2.243 16.478 ↓ 1,016.0 1,016 1

Nested Loop Left Join (cost=0.97..35.06 rows=1 width=245) (actual time=1.443..16.478 rows=1,016 loops=1)

  • Buffers: shared hit=3331
12. 2.090 13.219 ↓ 1,016.0 1,016 1

Nested Loop (cost=0.69..32.66 rows=1 width=225) (actual time=1.437..13.219 rows=1,016 loops=1)

  • Buffers: shared hit=3331
13. 1.330 7.967 ↓ 527.0 527 1

Nested Loop (cost=0.42..32.23 rows=1 width=40) (actual time=1.427..7.967 rows=527 loops=1)

  • Buffers: shared hit=1688
14. 2.013 4.002 ↓ 527.0 527 1

Nested Loop (cost=0.14..31.83 rows=1 width=32) (actual time=1.418..4.002 rows=527 loops=1)

  • Join Filter: ((ex.expensedate >= exchangerate.effectivedate) AND (ex.expensedate <= exchangerate.enddate) AND (ex.reimbursementcurrencyid = exchangerate.fixedcurrencyid))
  • Rows Removed by Join Filter: 3162
  • Buffers: shared hit=94
15. 0.015 0.015 ↓ 7.0 7 1

Index Scan using uix3er_currencyideffectivedate on exchangerate (cost=0.14..2.16 rows=1 width=12) (actual time=0.011..0.015 rows=7 loops=1)

  • Index Cond: (variablecurrencyid = $0)
  • Buffers: shared hit=3
16. 1.974 1.974 ↓ 1.0 527 7

Seq Scan on expense ex (cost=0.00..20.71 rows=512 width=28) (actual time=0.004..0.282 rows=527 loops=7)

  • Filter: ((expensedate >= '2019-01-01'::date) AND (expensedate <= '2019-12-31'::date))
  • Rows Removed by Filter: 3
  • Buffers: shared hit=91
17. 2.635 2.635 ↑ 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.005..0.005 rows=1 loops=527)

  • Index Cond: (expenseid = ex.id)
  • Filter: (expensestatus = ANY ('{0,1,2,3}'::integer[]))
  • Buffers: shared hit=1594
18. 3.162 3.162 ↓ 2.0 2 527

Index Scan using ixeeexpenseid on expenseentry ee (cost=0.28..0.42 rows=1 width=185) (actual time=0.004..0.006 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
19. 1.016 1.016 ↓ 0.0 0 1,016

Nested Loop (cost=0.28..2.39 rows=1 width=44) (actual time=0.001..0.001 rows=0 loops=1,016)

20. 0.000 0.000 ↓ 0.0 0 1,016

Index Only Scan using project_pkey on project pj (cost=0.12..0.16 rows=1 width=4) (actual time=0.000..0.000 rows=0 loops=1,016)

  • Index Cond: (id = ee.projectid)
  • Heap Fetches: 0
21. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: ((projectid = pj.id) AND (ee.entrydate >= effectivedate) AND (ee.entrydate <= enddate))
22. 3.048 3.048 ↑ 1.0 1 1,016

Index Scan using userinfo_pkey on userinfo ui (cost=0.14..0.16 rows=1 width=241) (actual time=0.002..0.003 rows=1 loops=1,016)

  • Index Cond: (id = ex.userid)
  • Buffers: shared hit=2032
23. 3.048 3.048 ↑ 1.0 1 1,016

Index Scan using login_pkey on login (cost=0.14..0.16 rows=1 width=11) (actual time=0.002..0.003 rows=1 loops=1,016)

  • Index Cond: (userid = ex.userid)
  • Buffers: shared hit=2032
24. 233.680 33,519.872 ↓ 1.2 530 1,016

Append (cost=2.70..2,035.84 rows=439 width=280) (actual time=0.008..32.992 rows=530 loops=1,016)

  • Buffers: shared hit=4693314
25. 5.080 44.704 ↑ 1.4 11 1,016

Subquery Scan on *SELECT* 1 (cost=2.70..5.03 rows=15 width=280) (actual time=0.007..0.044 rows=11 loops=1,016)

  • Buffers: shared hit=1018
26. 9.128 39.624 ↑ 1.4 11 1,016

Hash Join (cost=2.70..4.88 rows=15 width=240) (actual time=0.007..0.039 rows=11 loops=1,016)

  • Hash Cond: (ear.approverid = ui_1.id)
  • Buffers: shared hit=1018
27. 17.261 30.480 ↑ 1.4 11 1,016

Hash Join (cost=1.34..3.31 rows=15 width=8) (actual time=0.005..0.030 rows=11 loops=1,016)

  • Hash Cond: (ean.id = ear.nodeid)
  • Buffers: shared hit=1017
28. 13.208 13.208 ↑ 1.4 44 1,016

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

  • Buffers: shared hit=1016
29. 0.007 0.011 ↑ 1.4 11 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
30. 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
31. 0.009 0.016 ↑ 1.0 16 1

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

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

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

  • Buffers: shared hit=1
33. 259.080 33,241.488 ↓ 1.2 519 1,016

Subquery Scan on *SELECT* 2 (cost=170.53..2,030.81 rows=424 width=280) (actual time=0.184..32.718 rows=519 loops=1,016)

  • Buffers: shared hit=4692296
34. 1,194.801 32,982.408 ↓ 1.2 519 1,016

Hash Left Join (cost=170.53..2,026.57 rows=424 width=277) (actual time=0.183..32.463 rows=519 loops=1,016)

  • Hash Cond: ((split_part(effective.uri, ':'::text, 5))::integer = ui_2.id)
  • Buffers: shared hit=4692296
35. 830.072 31,787.592 ↓ 1.2 519 1,016

Nested Loop Left Join (cost=169.17..2,020.63 rows=424 width=113) (actual time=0.180..31.287 rows=519 loops=1,016)

  • Buffers: shared hit=4692295
36. 605.536 16,720.312 ↓ 1.2 519 1,016

Nested Loop Left Join (cost=168.88..1,383.27 rows=424 width=45) (actual time=0.147..16.457 rows=519 loops=1,016)

  • Buffers: shared hit=2779167
37. 528.631 1,350.264 ↓ 1.2 519 1,016

Hash Right Join (cost=168.59..745.91 rows=424 width=45) (actual time=0.113..1.329 rows=519 loops=1,016)

  • Hash Cond: (kvar.exphistoryid = eh.id)
  • Buffers: shared hit=866039
38. 817.880 817.880 ↓ 1.0 1,170 1,016

Index Scan using ixexahkvkey on expenseapprovalhistorykeyvalue kvar (cost=0.41..571.52 rows=1,164 width=4) (actual time=0.020..0.805 rows=1,170 loops=1,016)

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 40kB
  • Buffers: shared hit=407
40. 0.590 3.563 ↓ 1.2 519 1

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

  • Hash Cond: (eh.id = exphistory.id)
  • Buffers: shared hit=407
41. 0.786 0.835 ↓ 2.0 1,680 1

Index Scan using ixexhaction on exphistory eh (cost=3.63..73.93 rows=847 width=45) (actual time=0.074..0.835 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
42.          

SubPlan (forIndex Scan)

43. 0.023 0.049 ↑ 1.4 11 1

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

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

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

  • Buffers: shared hit=1
45. 0.005 0.011 ↑ 1.4 11 1

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

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

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

  • Buffers: shared hit=1
47. 0.159 2.138 ↓ 2.6 530 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 27kB
  • Buffers: shared hit=272
48. 0.356 1.979 ↓ 2.6 530 1

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

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

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

  • Buffers: shared hit=272
50. 0.876 0.876 ↑ 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.012..0.876 rows=2,666 loops=1)

  • Heap Fetches: 1388
  • Buffers: shared hit=272
51. 14,764.512 14,764.512 ↑ 1.0 1 527,304

Index Scan using ixexahkvexphistoryid on expenseapprovalhistorykeyvalue actual (cost=0.29..1.49 rows=1 width=76) (actual time=0.026..0.028 rows=1 loops=527,304)

  • 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=1913128
52. 14,237.208 14,237.208 ↑ 1.0 1 527,304

Index Scan using ixexahkvexphistoryid on expenseapprovalhistorykeyvalue effective (cost=0.29..1.49 rows=1 width=76) (actual time=0.027..0.027 rows=1 loops=527,304)

  • 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=1913128
53. 0.010 0.015 ↑ 1.0 16 1

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

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

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

  • Buffers: shared hit=1
55. 3.048 3.048 ↑ 1.0 7 1,016

Seq Scan on currencyinfo currencyinfo4 (cost=0.00..1.07 rows=7 width=122) (actual time=0.001..0.003 rows=7 loops=1,016)

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

Seq Scan on currencyinfo currencyinfo5 (cost=0.00..1.07 rows=7 width=122) (actual time=0.001..0.002 rows=7 loops=1,016)

  • Buffers: shared hit=1016
57. 7.890 29.464 ↑ 5.0 1 1,016

Hash Right Join (cost=14.14..27.33 rows=5 width=4) (actual time=0.029..0.029 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
58. 2.032 2.032 ↑ 2.2 4 1,016

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

  • Buffers: shared hit=1016
59. 3.048 19.304 ↓ 1.2 6 1,016

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=7281
60. 6.096 16.256 ↓ 1.2 6 1,016

Nested Loop Left Join (cost=0.56..0.81 rows=5 width=12) (actual time=0.009..0.016 rows=6 loops=1,016)

  • Buffers: shared hit=7281
61. 4.064 4.064 ↑ 1.0 1 1,016

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

  • Index Cond: (id = ee.expenseid)
  • Buffers: shared hit=3066
62. 6.096 6.096 ↓ 1.2 6 1,016

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

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

SubPlan (forHash Right Join)

64. 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)
65. 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)
66. 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)
67. 0.008 0.017 ↓ 0.0 0 1

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

  • Hash Cond: (expenseapprovalnodes11_1.id = expenseapprovalrequest10_1.nodeid)
  • Buffers: shared hit=2
68. 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
69. 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
70. 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
71. 0.221 0.221 ↓ 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.013..0.221 rows=530 loops=1)

  • Heap Fetches: 524
  • Buffers: shared hit=247
72. 3.048 3.048 ↑ 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.002..0.003 rows=1 loops=1,016)

  • Index Cond: (id = ee.expensetypeid)
  • Buffers: shared hit=2032
Planning time : 8.786 ms
Execution time : 33,776.151 ms