explain.depesz.com

PostgreSQL's explain analyze made readable

Result: iFWX

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

Nested Loop Anti Join (cost=62,225.38..62,347.32 rows=1 width=16) (actual rows= loops=)

  • Join Filter: ((a.cddocument = dcr.cddocument) AND (a.cdpermission = (3)) AND (a.cduser = ('-1'::integer)) AND (a.fgpermissiontype = (max(dcr.fgpermission))))
2. 0.000 0.000 ↓ 0.0

Index Scan using seixdcuserpermdoccddoc on dcuserpermissiondoc a (cost=0.42..8.45 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (cddocument = 83)
  • Filter: (cdpermission = 3)
3. 0.000 0.000 ↓ 0.0

HashAggregate (cost=62,224.96..62,253.44 rows=2,848 width=20) (actual rows= loops=)

  • Group Key: dcr.cddocument, ('-1'::integer)
4. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.99..62,017.18 rows=27,704 width=12) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..20.78 rows=1 width=4) (actual rows= loops=)

  • Join Filter: ((d.fgusecataccessrole <> 1) OR (d.fgusecataccessrole IS NULL) OR ((d.fgusecataccessrole = 1) AND (ct.fgallowdocpermission = 1)))
6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.56..12.61 rows=1 width=12) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Index Scan using dcdocument_pkey on dcdocument d (cost=0.28..8.30 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (cddocument = 83)
8. 0.000 0.000 ↓ 0.0

Index Only Scan using seixfgcurrentinclude on dcdocrevision dr (cost=0.28..4.30 rows=1 width=8) (actual rows= loops=)

  • Index Cond: ((fgcurrent = 1) AND (cddocument = 83))
9. 0.000 0.000 ↓ 0.0

Index Scan using dccategory_pkey on dccategory ct (cost=0.14..8.16 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (cdcategory = dr.cdcategory)
10. 0.000 0.000 ↓ 0.0

Append (cost=0.29..61,711.64 rows=28,475 width=12) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Index Scan using seixdocaccessrole on dcdocaccessrole dcr (cost=0.29..6.51 rows=1 width=12) (actual rows= loops=)

  • Index Cond: ((cddocument = 83) AND (fgaccesstype = 6))
  • Filter: (fgaccessview = 1)
12. 0.000 0.000 ↓ 0.0

Hash Join (cost=979.21..61,420.38 rows=28,474 width=12) (actual rows= loops=)

  • Hash Cond: (udp.cduser = u.cduser)
13. 0.000 0.000 ↓ 0.0

Append (cost=4.70..60,367.77 rows=29,744 width=12) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Nested Loop (cost=4.70..66.55 rows=5 width=12) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Index Scan using seixdocaccessrole on dcdocaccessrole dcr_1 (cost=0.29..8.32 rows=1 width=12) (actual rows= loops=)

  • Index Cond: ((cddocument = 83) AND (fgaccesstype = 2))
  • Filter: ((COALESCE(fgaddlowerlevel, 2) <> 1) AND (fgaccessview = 1))
16. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on aduserdeptpos udp (cost=4.41..58.07 rows=16 width=8) (actual rows= loops=)

  • Recheck Cond: (cddepartment = dcr_1.cddepartment)
17. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on seixuserdcddeptcdp (cost=0.00..4.41 rows=16 width=0) (actual rows= loops=)

  • Index Cond: (cddepartment = dcr_1.cddepartment)
18. 0.000 0.000 ↓ 0.0

Nested Loop (cost=35,852.08..59,434.52 rows=29,639 width=12) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Hash Join (cost=35,851.79..58,068.48 rows=1,871 width=12) (actual rows= loops=)

  • Hash Cond: (addeptsub.cdowner = dcr_2.cddepartment)
20. 0.000 0.000 ↓ 0.0

CTE Scan on addeptsub (cost=35,843.46..48,997.82 rows=657,718 width=8) (actual rows= loops=)

21.          

CTE addeptsub

22. 0.000 0.000 ↓ 0.0

Recursive Union (cost=0.28..35,843.46 rows=657,718 width=8) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Index Only Scan using addepartment_pkey on addepartment (cost=0.28..63.14 rows=1,268 width=8) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Merge Join (cost=1,271.61..2,262.60 rows=65,645 width=8) (actual rows= loops=)

  • Merge Cond: (d_1.cddeptowner = s.cddept)
25. 0.000 0.000 ↓ 0.0

Sort (cost=153.85..157.01 rows=1,262 width=8) (actual rows= loops=)

  • Sort Key: d_1.cddeptowner
26. 0.000 0.000 ↓ 0.0

Seq Scan on addepartment d_1 (cost=0.00..88.85 rows=1,262 width=8) (actual rows= loops=)

  • Filter: (cddeptowner <> cddepartment)
27. 0.000 0.000 ↓ 0.0

Sort (cost=1,117.76..1,149.46 rows=12,680 width=8) (actual rows= loops=)

  • Sort Key: s.cddept
28. 0.000 0.000 ↓ 0.0

WorkTable Scan on addeptsub s (cost=0.00..253.60 rows=12,680 width=8) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Hash (cost=8.32..8.32 rows=1 width=12) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Index Scan using seixdocaccessrole on dcdocaccessrole dcr_2 (cost=0.29..8.32 rows=1 width=12) (actual rows= loops=)

  • Index Cond: ((cddocument = 83) AND (fgaccesstype = 2))
  • Filter: ((fgaccessview = 1) AND (COALESCE(fgaddlowerlevel, 2) = 1))
31. 0.000 0.000 ↓ 0.0

Index Scan using seixuserdcddeptcdp on aduserdeptpos udp_1 (cost=0.29..0.57 rows=16 width=8) (actual rows= loops=)

  • Index Cond: (cddepartment = addeptsub.cddept)
32. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.57..14.83 rows=1 width=12) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Index Scan using seixdocaccessrole on dcdocaccessrole dcr_3 (cost=0.29..6.51 rows=1 width=16) (actual rows= loops=)

  • Index Cond: ((cddocument = 83) AND (fgaccesstype = 3))
  • Filter: (fgaccessview = 1)
34. 0.000 0.000 ↓ 0.0

Index Scan using seixuserdcddeptcdp on aduserdeptpos udp_2 (cost=0.29..8.31 rows=1 width=12) (actual rows= loops=)

  • Index Cond: ((cddepartment = dcr_3.cddepartment) AND (cdposition = dcr_3.cdposition))
35. 0.000 0.000 ↓ 0.0

Nested Loop (cost=4.86..120.35 rows=1 width=12) (actual rows= loops=)

36. 0.000 0.000 ↓ 0.0

Index Scan using seixdocaccessrole on dcdocaccessrole dcr_4 (cost=0.29..6.51 rows=1 width=12) (actual rows= loops=)

  • Index Cond: ((cddocument = 83) AND (fgaccesstype = 4))
  • Filter: (fgaccessview = 1)
37. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on aduserdeptpos udp_3 (cost=4.57..113.47 rows=37 width=8) (actual rows= loops=)

  • Recheck Cond: (cdposition = dcr_4.cdposition)
38. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on seixdeptuserposition (cost=0.00..4.56 rows=37 width=0) (actual rows= loops=)

  • Index Cond: (cdposition = dcr_4.cdposition)
39. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.57..16.63 rows=1 width=12) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

Index Scan using seixdocaccessrole on dcdocaccessrole dcr_5 (cost=0.29..8.32 rows=1 width=12) (actual rows= loops=)

  • Index Cond: ((cddocument = 83) AND (fgaccesstype = 5))
  • Filter: (fgaccessview = 1)
41. 0.000 0.000 ↓ 0.0

Index Only Scan using seixuserdcduser on aduserdeptpos udp_4 (cost=0.29..8.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (cduser = dcr_5.cduser)
42. 0.000 0.000 ↓ 0.0

Nested Loop (cost=5.87..417.44 rows=97 width=12) (actual rows= loops=)

43. 0.000 0.000 ↓ 0.0

Index Scan using seixdocaccessrole on dcdocaccessrole dcr_6 (cost=0.29..8.32 rows=1 width=12) (actual rows= loops=)

  • Index Cond: ((cddocument = 83) AND (fgaccesstype = 1))
  • Filter: (fgaccessview = 1)
44. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on adteamuser tm (cost=5.58..407.45 rows=167 width=8) (actual rows= loops=)

  • Recheck Cond: (cdteam = dcr_6.cdteam)
45. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on adteamuser_pkey (cost=0.00..5.54 rows=167 width=0) (actual rows= loops=)

  • Index Cond: (cdteam = dcr_6.cdteam)
46. 0.000 0.000 ↓ 0.0

Hash (cost=751.73..751.73 rows=17,823 width=4) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Seq Scan on aduser u (cost=0.00..751.73 rows=17,823 width=4) (actual rows= loops=)

  • Filter: (fguserenabled = 1)