explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bBL

Settings
# exclusive inclusive rows x rows loops node
1. 59.317 1,508.154 ↓ 1.0 34,535 1

Nested Loop (cost=1,753.17..1,571,359.18 rows=34,510 width=2,289) (actual time=23.016..1,508.154 rows=34,535 loops=1)

  • Join Filter: (note."CompanyId" = "note.Company"."Id")
2. 0.020 0.020 ↑ 1.0 1 1

Seq Scan on "Companies" "note.Company" (cost=0.00..1.01 rows=1 width=36) (actual time=0.019..0.020 rows=1 loops=1)

  • Filter: ("CompanyXRef" = 'CompanyNotFound'::text)
  • Rows Removed by Filter: 1
3. 15.635 171.022 ↓ 1.0 34,535 1

Hash Left Join (cost=1,753.17..6,502.21 rows=34,510 width=2,298) (actual time=22.840..171.022 rows=34,535 loops=1)

  • Hash Cond: ("note.Visit"."OrganizationId" = "note.Visit.Organization"."Id")
4. 13.328 155.380 ↓ 1.0 34,535 1

Nested Loop (cost=1,752.15..6,081.37 rows=34,510 width=2,070) (actual time=22.821..155.380 rows=34,535 loops=1)

  • Join Filter: ("note.Visit"."PatientClassId" = "note.Visit.PatientClass"."Id")
5. 0.010 0.010 ↑ 1.0 1 1

Seq Scan on "PatientClasses" "note.Visit.PatientClass" (cost=0.00..1.01 rows=1 width=36) (actual time=0.009..0.010 rows=1 loops=1)

6. 15.437 142.042 ↓ 1.0 34,535 1

Hash Join (cost=1,752.15..5,648.98 rows=34,510 width=2,038) (actual time=22.809..142.042 rows=34,535 loops=1)

  • Hash Cond: (note."AuthorUserId" = "note.Author"."Id")
7. 15.235 126.553 ↓ 1.0 34,535 1

Hash Left Join (cost=1,748.03..5,170.36 rows=34,510 width=2,009) (actual time=22.733..126.553 rows=34,535 loops=1)

  • Hash Cond: (note."SignerUserId" = "note.Signer"."Id")
8. 12.637 111.273 ↓ 1.0 34,535 1

Hash Left Join (cost=1,743.92..4,696.88 rows=34,510 width=1,980) (actual time=22.680..111.273 rows=34,535 loops=1)

  • Hash Cond: ("note.NoteErroneous"."CreatedById" = "note.NoteErroneous.CreatedByUser"."Id")
9. 17.362 98.590 ↓ 1.0 34,535 1

Hash Left Join (cost=1,739.80..4,218.25 rows=34,510 width=1,947) (actual time=22.626..98.590 rows=34,535 loops=1)

  • Hash Cond: (note."NoteTypeId" = "note.NoteType"."Id")
10. 20.692 81.147 ↓ 1.0 34,535 1

Hash Join (cost=1,735.24..3,856.34 rows=34,510 width=1,690) (actual time=22.533..81.147 rows=34,535 loops=1)

  • Hash Cond: (note."VisitId" = "note.Visit"."Id")
11. 9.376 38.151 ↓ 1.0 34,535 1

Hash Left Join (cost=94.22..1,740.81 rows=34,510 width=1,619) (actual time=0.097..38.151 rows=34,535 loops=1)

  • Hash Cond: (note."Id" = "note.NoteCosign"."NoteId")
12. 7.372 28.774 ↓ 1.0 34,535 1

Hash Left Join (cost=47.30..1,553.88 rows=34,510 width=1,403) (actual time=0.086..28.774 rows=34,535 loops=1)

  • Hash Cond: (note."Id" = "note.NoteErroneous"."NoteId")
13. 6.997 21.350 ↓ 1.0 34,535 1

Hash Left Join (cost=44.81..1,421.83 rows=34,510 width=1,322) (actual time=0.025..21.350 rows=34,535 loops=1)

  • Hash Cond: (note."Id" = "note.NoteReturn"."NoteId")
14. 14.351 14.351 ↓ 1.0 34,535 1

Seq Scan on "Notes" note (cost=0.00..1,239.10 rows=34,510 width=1,203) (actual time=0.016..14.351 rows=34,535 loops=1)

15. 0.000 0.002 ↓ 0.0 0 1

Hash (cost=34.19..34.19 rows=850 width=119) (actual time=0.002..0.002 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
16. 0.000 0.002 ↓ 0.0 0 1

Hash Left Join (cost=5.18..34.19 rows=850 width=119) (actual time=0.002..0.002 rows=0 loops=1)

  • Hash Cond: ("note.NoteReturn"."ReasonId" = "note.NoteReturn.Reason"."Id")
17. 0.001 0.002 ↓ 0.0 0 1

Hash Left Join (cost=4.12..29.80 rows=850 width=81) (actual time=0.002..0.002 rows=0 loops=1)

  • Hash Cond: ("note.NoteReturn"."CreatedById" = "note.NoteReturn.CreatedByUser"."Id")
18. 0.001 0.001 ↓ 0.0 0 1

Seq Scan on "NoteReturns" "note.NoteReturn" (cost=0.00..18.50 rows=850 width=52) (actual time=0.001..0.001 rows=0 loops=1)

19. 0.000 0.000 ↓ 0.0 0

Hash (cost=2.94..2.94 rows=94 width=33) (never executed)

20. 0.000 0.000 ↓ 0.0 0

Seq Scan on "Users" "note.NoteReturn.CreatedByUser" (cost=0.00..2.94 rows=94 width=33) (never executed)

21. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.03..1.03 rows=3 width=42) (never executed)

22. 0.000 0.000 ↓ 0.0 0

Seq Scan on "Reasons" "note.NoteReturn.Reason" (cost=0.00..1.03 rows=3 width=42) (never executed)

23. 0.008 0.052 ↓ 2.9 43 1

Hash (cost=2.30..2.30 rows=15 width=81) (actual time=0.052..0.052 rows=43 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 12kB
24. 0.024 0.044 ↓ 2.9 43 1

Hash Left Join (cost=1.07..2.30 rows=15 width=81) (actual time=0.027..0.044 rows=43 loops=1)

  • Hash Cond: ("note.NoteErroneous"."ReasonId" = "note.NoteErroneous.Reason"."Id")
25. 0.010 0.010 ↓ 2.9 43 1

Seq Scan on "NotesErroneous" "note.NoteErroneous" (cost=0.00..1.15 rows=15 width=52) (actual time=0.008..0.010 rows=43 loops=1)

26. 0.003 0.010 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=37) (actual time=0.010..0.010 rows=3 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
27. 0.007 0.007 ↑ 1.0 3 1

Seq Scan on "Reasons" "note.NoteErroneous.Reason" (cost=0.00..1.03 rows=3 width=37) (actual time=0.006..0.007 rows=3 loops=1)

28. 0.000 0.001 ↓ 0.0 0 1

Hash (cost=33.67..33.67 rows=1,060 width=216) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 16kB
29. 0.000 0.001 ↓ 0.0 0 1

Hash Left Join (cost=4.12..33.67 rows=1,060 width=216) (actual time=0.001..0.001 rows=0 loops=1)

  • Hash Cond: ("note.NoteCosign"."AssignedUserId" = "note.NoteCosign.Assigned"."Id")
30. 0.001 0.001 ↓ 0.0 0 1

Seq Scan on "NoteCosigns" "note.NoteCosign" (cost=0.00..20.60 rows=1,060 width=32) (actual time=0.001..0.001 rows=0 loops=1)

31. 0.000 0.000 ↓ 0.0 0

Hash (cost=2.94..2.94 rows=94 width=184) (never executed)

32. 0.000 0.000 ↓ 0.0 0

Seq Scan on "Users" "note.NoteCosign.Assigned" (cost=0.00..2.94 rows=94 width=184) (never executed)

33. 7.149 22.304 ↓ 1.0 23,466 1

Hash (cost=1,348.30..1,348.30 rows=23,417 width=75) (actual time=22.304..22.304 rows=23,466 loops=1)

  • Buckets: 32,768 Batches: 1 Memory Usage: 2,864kB
34. 7.989 15.155 ↓ 1.0 23,466 1

Hash Join (cost=225.37..1,348.30 rows=23,417 width=75) (actual time=2.620..15.155 rows=23,466 loops=1)

  • Hash Cond: ("note.Visit"."PatientId" = "note.Visit.Patient"."Id")
35. 4.592 4.592 ↓ 1.0 23,466 1

Seq Scan on "Visits" "note.Visit" (cost=0.00..801.17 rows=23,417 width=61) (actual time=0.007..4.592 rows=23,466 loops=1)

36. 1.122 2.574 ↓ 1.0 6,301 1

Hash (cost=146.83..146.83 rows=6,283 width=18) (actual time=2.574..2.574 rows=6,301 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 383kB
37. 1.452 1.452 ↓ 1.0 6,301 1

Seq Scan on "Patients" "note.Visit.Patient" (cost=0.00..146.83 rows=6,283 width=18) (actual time=0.007..1.452 rows=6,301 loops=1)

38. 0.008 0.081 ↓ 1.5 9 1

Hash (cost=4.49..4.49 rows=6 width=261) (actual time=0.081..0.081 rows=9 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
39. 0.038 0.073 ↓ 1.5 9 1

Hash Right Join (cost=1.14..4.49 rows=6 width=261) (actual time=0.057..0.073 rows=9 loops=1)

  • Hash Cond: ("note.NoteType.CreatedByUser"."Id" = "note.NoteType"."CreatedById")
40. 0.013 0.013 ↑ 1.0 94 1

Seq Scan on "Users" "note.NoteType.CreatedByUser" (cost=0.00..2.94 rows=94 width=184) (actual time=0.005..0.013 rows=94 loops=1)

41. 0.010 0.022 ↓ 1.5 9 1

Hash (cost=1.06..1.06 rows=6 width=81) (actual time=0.022..0.022 rows=9 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
42. 0.012 0.012 ↓ 1.5 9 1

Seq Scan on "NoteTypes" "note.NoteType" (cost=0.00..1.06 rows=6 width=81) (actual time=0.010..0.012 rows=9 loops=1)

43. 0.027 0.046 ↑ 1.0 94 1

Hash (cost=2.94..2.94 rows=94 width=37) (actual time=0.046..0.046 rows=94 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 15kB
44. 0.019 0.019 ↑ 1.0 94 1

Seq Scan on "Users" "note.NoteErroneous.CreatedByUser" (cost=0.00..2.94 rows=94 width=37) (actual time=0.003..0.019 rows=94 loops=1)

45. 0.031 0.045 ↑ 1.0 94 1

Hash (cost=2.94..2.94 rows=94 width=33) (actual time=0.045..0.045 rows=94 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 15kB
46. 0.014 0.014 ↑ 1.0 94 1

Seq Scan on "Users" "note.Signer" (cost=0.00..2.94 rows=94 width=33) (actual time=0.002..0.014 rows=94 loops=1)

47. 0.024 0.052 ↑ 1.0 94 1

Hash (cost=2.94..2.94 rows=94 width=33) (actual time=0.052..0.052 rows=94 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 15kB
48. 0.028 0.028 ↑ 1.0 94 1

Seq Scan on "Users" "note.Author" (cost=0.00..2.94 rows=94 width=33) (actual time=0.007..0.028 rows=94 loops=1)

49. 0.003 0.007 ↑ 1.0 1 1

Hash (cost=1.01..1.01 rows=1 width=228) (actual time=0.007..0.007 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
50. 0.004 0.004 ↑ 1.0 1 1

Seq Scan on "Organizations" "note.Visit.Organization" (cost=0.00..1.01 rows=1 width=228) (actual time=0.004..0.004 rows=1 loops=1)

51.          

SubPlan (for Nested Loop)

52. 34.535 69.070 ↑ 1.0 1 34,535

Aggregate (cost=8.31..8.32 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=34,535)

53. 34.535 34.535 ↑ 1.0 1 34,535

Index Only Scan using "IX_NoteHistories_NoteId" on "NoteHistories" n (cost=0.29..8.31 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=34,535)

  • Index Cond: ("NoteId" = note."Id")
  • Heap Fetches: 21,731
54. 34.535 69.070 ↑ 1.0 1 34,535

Aggregate (cost=8.31..8.32 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=34,535)

55. 34.535 34.535 ↑ 1.0 1 34,535

Index Only Scan using "IX_NoteDocuments_NoteId" on "NoteDocuments" n1 (cost=0.29..8.30 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=34,535)

  • Index Cond: ("NoteId" = note."Id")
  • Heap Fetches: 21,688
56. 0.000 34.535 ↑ 1.0 1 34,535

Result (cost=8.31..8.32 rows=1 width=1) (actual time=0.001..0.001 rows=1 loops=34,535)

57.          

Initplan (for Result)

58. 34.535 34.535 ↑ 1.0 1 34,535

Index Only Scan using "IX_NoteHistories_NoteId" on "NoteHistories" n3 (cost=0.29..8.31 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=34,535)

  • Index Cond: ("NoteId" = note."Id")
  • Heap Fetches: 19,533
59. 34.535 552.560 ↑ 1.0 1 34,535

Result (cost=13.20..13.21 rows=1 width=1) (actual time=0.016..0.016 rows=1 loops=34,535)

60.          

Initplan (for Result)

61. 33.899 518.025 ↓ 0.0 0 34,535

Nested Loop Semi Join (cost=0.00..13.20 rows=1 width=0) (actual time=0.015..0.015 rows=0 loops=34,535)

  • Join Filter: (na0."Id" = n5."NoteAddendumId")
  • Rows Removed by Join Filter: 0
62. 483.490 483.490 ↓ 0.0 0 34,535

Seq Scan on "NoteAddendums" na0 (cost=0.00..6.12 rows=1 width=4) (actual time=0.014..0.014 rows=0 loops=34,535)

  • Filter: (note."Id" = "NoteId")
  • Rows Removed by Filter: 107
63. 0.636 0.636 ↑ 1.7 54 106

Seq Scan on "NoteAddendumHistories" n5 (cost=0.00..5.92 rows=92 width=4) (actual time=0.001..0.006 rows=54 loops=106)

64. 34.535 552.560 ↑ 1.0 1 34,535

Result (cost=7.15..7.16 rows=1 width=1) (actual time=0.016..0.016 rows=1 loops=34,535)

65.          

Initplan (for Result)

66. 34.428 518.025 ↓ 0.0 0 34,535

Nested Loop (cost=0.00..7.15 rows=1 width=0) (actual time=0.015..0.015 rows=0 loops=34,535)

  • Join Filter: (a5."Id" = "a.NoteAddendumErroneous1"."NoteAddendumId")
  • Rows Removed by Join Filter: 0
67. 483.490 483.490 ↓ 0.0 0 34,535

Seq Scan on "NoteAddendums" a5 (cost=0.00..6.12 rows=1 width=4) (actual time=0.014..0.014 rows=0 loops=34,535)

  • Filter: (note."Id" = "NoteId")
  • Rows Removed by Filter: 107
68. 0.107 0.107 ↓ 7.0 7 107

Seq Scan on "NoteAddendumsErroneous" "a.NoteAddendumErroneous1" (cost=0.00..1.01 rows=1 width=4) (actual time=0.001..0.001 rows=7 loops=107)

  • Filter: ("NoteAddendumId" IS NOT NULL)
Planning time : 10.571 ms
Execution time : 1,510.636 ms