explain.depesz.com

PostgreSQL's explain analyze made readable

Result: H5YQ

Settings
# exclusive inclusive rows x rows loops node
1. 0.013 6,690.717 ↑ 1.0 1 1

Sort (cost=118,878.29..118,878.30 rows=1 width=76) (actual time=6,690.716..6,690.717 rows=1 loops=1)

  • Sort Key: v_reviewed_doc_objects.is_your_review DESC, v_reviewed_doc_objects.is_review_by_responsible_reviewer DESC, v_reviewed_doc_objects.reviewed_when DESC
  • Sort Method: quicksort Memory: 25kB
2. 0.002 6,690.704 ↑ 1.0 1 1

Subquery Scan on v_reviewed_doc_objects (cost=0.29..118,878.28 rows=1 width=76) (actual time=6,690.702..6,690.704 rows=1 loops=1)

3. 0.070 6,690.702 ↑ 1.0 1 1

Index Scan using reviewed_doc_objs_fk_reviewed_row_key on reviewed_doc_objs rdo (cost=0.29..118,878.27 rows=1 width=160) (actual time=6,690.700..6,690.702 rows=1 loops=1)

  • Index Cond: (fk_reviewed_row = 72860)
4.          

SubPlan (forIndex Scan)

5. 0.011 0.011 ↑ 1.0 1 1

Seq Scan on staff (cost=0.00..1.10 rows=1 width=4) (actual time=0.010..0.011 rows=1 loops=1)

  • Filter: (pk = rdo.fk_reviewer)
  • Rows Removed by Filter: 7
6. 0.008 0.008 ↑ 1.0 1 1

Index Scan using doc_obj_pkey on doc_obj (cost=0.29..8.31 rows=1 width=0) (actual time=0.008..0.008 rows=1 loops=1)

  • Index Cond: (pk = rdo.fk_reviewed_row)
  • Filter: (fk_intended_reviewer = rdo.fk_reviewer)
7. 0.000 0.000 ↓ 0.0 0

Seq Scan on doc_obj doc_obj_1 (cost=0.00..8,604.37 rows=82,337 width=8) (never executed)

8. 0.000 0.000 ↓ 0.0 0

Seq Scan on staff staff_1 (cost=0.00..1.14 rows=1 width=0) (never executed)

  • Filter: ((pk = rdo.fk_reviewer) AND (db_user = "current_user"()))
9. 0.011 0.011 ↓ 0.0 0 1

Seq Scan on staff staff_2 (cost=0.00..1.12 rows=1 width=4) (actual time=0.011..0.011 rows=0 loops=1)

  • Filter: (db_user = "current_user"())
  • Rows Removed by Filter: 8
10. 16.466 1,537.305 ↑ 1.0 1 1

Hash Join (cost=2,925.13..29,714.85 rows=1 width=4) (actual time=1,452.945..1,537.305 rows=1 loops=1)

  • Hash Cond: (b_dm.pk = b_do.fk_doc)
11. 1,435.945 1,520.826 ↓ 1.0 44,632 1

Hash Join (cost=2,916.81..29,093.23 rows=44,603 width=410) (actual time=24.770..1,520.826 rows=44,632 loops=1)

  • Hash Cond: (b_dm.fk_episode = c_epi.pk)
12. 20.912 72.365 ↓ 1.0 44,632 1

Hash Join (cost=1,503.45..4,542.06 rows=44,603 width=31) (actual time=11.844..72.365 rows=44,632 loops=1)

  • Hash Cond: (b_dm.fk_encounter = c_enc.pk)
13. 24.267 39.780 ↓ 1.0 44,632 1

Hash Join (cost=3.09..2,428.41 rows=44,603 width=31) (actual time=0.067..39.780 rows=44,632 loops=1)

  • Hash Cond: (b_dm.fk_type = b_dt.pk)
14. 15.481 15.481 ↓ 1.0 44,632 1

Seq Scan on doc_med b_dm (cost=0.00..1,812.03 rows=44,603 width=20) (actual time=0.010..15.481 rows=44,632 loops=1)

15. 0.015 0.032 ↑ 1.0 93 1

Hash (cost=1.93..1.93 rows=93 width=23) (actual time=0.032..0.032 rows=93 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
16. 0.017 0.017 ↑ 1.0 93 1

Seq Scan on doc_type b_dt (cost=0.00..1.93 rows=93 width=23) (actual time=0.005..0.017 rows=93 loops=1)

17. 5.959 11.673 ↓ 1.0 31,937 1

Hash (cost=1,101.27..1,101.27 rows=31,927 width=8) (actual time=11.673..11.673 rows=31,937 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1504kB
18. 5.714 5.714 ↓ 1.0 31,937 1

Seq Scan on encounter c_enc (cost=0.00..1,101.27 rows=31,927 width=8) (actual time=0.004..5.714 rows=31,937 loops=1)

19. 6.650 12.516 ↓ 1.0 34,350 1

Hash (cost=984.27..984.27 rows=34,327 width=8) (actual time=12.516..12.516 rows=34,350 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 1794kB
20. 5.866 5.866 ↓ 1.0 34,350 1

Seq Scan on episode c_epi (cost=0.00..984.27 rows=34,327 width=8) (actual time=0.005..5.866 rows=34,350 loops=1)

21. 0.010 0.013 ↑ 1.0 1 1

Hash (cost=8.31..8.31 rows=1 width=4) (actual time=0.013..0.013 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
22. 0.003 0.003 ↑ 1.0 1 1

Index Scan using doc_obj_pkey on doc_obj b_do (cost=0.29..8.31 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=1)

  • Index Cond: (pk = rdo.fk_reviewed_row)
23. 20.642 2,004.785 ↑ 1.0 1 1

Hash Join (cost=2,925.13..29,714.85 rows=1 width=4) (actual time=1,940.948..2,004.785 rows=1 loops=1)

  • Hash Cond: (b_dm_1.pk = b_do_1.fk_doc)
24. 1,869.112 1,984.131 ↓ 1.0 44,632 1

Hash Join (cost=2,916.81..29,093.23 rows=44,603 width=410) (actual time=41.148..1,984.131 rows=44,632 loops=1)

  • Hash Cond: (b_dm_1.fk_episode = c_epi_1.pk)
25. 24.763 94.187 ↓ 1.0 44,632 1

Hash Join (cost=1,503.45..4,542.06 rows=44,603 width=31) (actual time=19.768..94.187 rows=44,632 loops=1)

  • Hash Cond: (b_dm_1.fk_encounter = c_enc_1.pk)
26. 30.799 49.901 ↓ 1.0 44,632 1

Hash Join (cost=3.09..2,428.41 rows=44,603 width=31) (actual time=0.096..49.901 rows=44,632 loops=1)

  • Hash Cond: (b_dm_1.fk_type = b_dt_1.pk)
27. 19.044 19.044 ↓ 1.0 44,632 1

Seq Scan on doc_med b_dm_1 (cost=0.00..1,812.03 rows=44,603 width=20) (actual time=0.009..19.044 rows=44,632 loops=1)

28. 0.027 0.058 ↑ 1.0 93 1

Hash (cost=1.93..1.93 rows=93 width=23) (actual time=0.058..0.058 rows=93 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
29. 0.031 0.031 ↑ 1.0 93 1

Seq Scan on doc_type b_dt_1 (cost=0.00..1.93 rows=93 width=23) (actual time=0.008..0.031 rows=93 loops=1)

30. 9.560 19.523 ↓ 1.0 31,937 1

Hash (cost=1,101.27..1,101.27 rows=31,927 width=4) (actual time=19.523..19.523 rows=31,937 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1379kB
31. 9.963 9.963 ↓ 1.0 31,937 1

Seq Scan on encounter c_enc_1 (cost=0.00..1,101.27 rows=31,927 width=4) (actual time=0.009..9.963 rows=31,937 loops=1)

32. 10.544 20.832 ↓ 1.0 34,350 1

Hash (cost=984.27..984.27 rows=34,327 width=8) (actual time=20.832..20.832 rows=34,350 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 1794kB
33. 10.288 10.288 ↓ 1.0 34,350 1

Seq Scan on episode c_epi_1 (cost=0.00..984.27 rows=34,327 width=8) (actual time=0.007..10.288 rows=34,350 loops=1)

34. 0.003 0.012 ↑ 1.0 1 1

Hash (cost=8.31..8.31 rows=1 width=4) (actual time=0.012..0.012 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
35. 0.009 0.009 ↑ 1.0 1 1

Index Scan using doc_obj_pkey on doc_obj b_do_1 (cost=0.29..8.31 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=1)

  • Index Cond: (pk = rdo.fk_reviewed_row)
36. 17.945 1,617.962 ↑ 1.0 1 1

Hash Join (cost=2,925.13..29,714.85 rows=1 width=4) (actual time=1,553.478..1,617.962 rows=1 loops=1)

  • Hash Cond: (b_dm_2.pk = b_do_2.fk_doc)
37. 1,514.595 1,600.017 ↓ 1.0 44,632 1

Hash Join (cost=2,916.81..29,093.23 rows=44,603 width=410) (actual time=24.206..1,600.017 rows=44,632 loops=1)

  • Hash Cond: (b_dm_2.fk_episode = c_epi_2.pk)
38. 20.624 72.926 ↓ 1.0 44,632 1

Hash Join (cost=1,503.45..4,542.06 rows=44,603 width=27) (actual time=11.313..72.926 rows=44,632 loops=1)

  • Hash Cond: (b_dm_2.fk_encounter = c_enc_2.pk)
39. 25.243 41.166 ↓ 1.0 44,632 1

Hash Join (cost=3.09..2,428.41 rows=44,603 width=31) (actual time=0.079..41.166 rows=44,632 loops=1)

  • Hash Cond: (b_dm_2.fk_type = b_dt_2.pk)
40. 15.874 15.874 ↓ 1.0 44,632 1

Seq Scan on doc_med b_dm_2 (cost=0.00..1,812.03 rows=44,603 width=20) (actual time=0.010..15.874 rows=44,632 loops=1)

41. 0.036 0.049 ↑ 1.0 93 1

Hash (cost=1.93..1.93 rows=93 width=23) (actual time=0.049..0.049 rows=93 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
42. 0.013 0.013 ↑ 1.0 93 1

Seq Scan on doc_type b_dt_2 (cost=0.00..1.93 rows=93 width=23) (actual time=0.005..0.013 rows=93 loops=1)

43. 5.623 11.136 ↓ 1.0 31,937 1

Hash (cost=1,101.27..1,101.27 rows=31,927 width=4) (actual time=11.136..11.136 rows=31,937 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1379kB
44. 5.513 5.513 ↓ 1.0 31,937 1

Seq Scan on encounter c_enc_2 (cost=0.00..1,101.27 rows=31,927 width=4) (actual time=0.005..5.513 rows=31,937 loops=1)

45. 6.665 12.487 ↓ 1.0 34,350 1

Hash (cost=984.27..984.27 rows=34,327 width=8) (actual time=12.487..12.487 rows=34,350 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 1794kB
46. 5.822 5.822 ↓ 1.0 34,350 1

Seq Scan on episode c_epi_2 (cost=0.00..984.27 rows=34,327 width=8) (actual time=0.006..5.822 rows=34,350 loops=1)

47. 0.001 0.009 ↑ 1.0 1 1

Hash (cost=8.31..8.31 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
48. 0.008 0.008 ↑ 1.0 1 1

Index Scan using doc_obj_pkey on doc_obj b_do_2 (cost=0.29..8.31 rows=1 width=4) (actual time=0.006..0.008 rows=1 loops=1)

  • Index Cond: (pk = rdo.fk_reviewed_row)
49. 17.120 1,530.550 ↑ 1.0 1 1

Hash Join (cost=2,925.13..29,714.85 rows=1 width=4) (actual time=1,466.255..1,530.550 rows=1 loops=1)

  • Hash Cond: (b_dm_3.pk = b_do_3.fk_doc)
50. 1,428.547 1,513.421 ↓ 1.0 44,632 1

Hash Join (cost=2,916.81..29,093.23 rows=44,603 width=410) (actual time=24.679..1,513.421 rows=44,632 loops=1)

  • Hash Cond: (b_dm_3.fk_episode = c_epi_3.pk)
51. 21.133 72.203 ↓ 1.0 44,632 1

Hash Join (cost=1,503.45..4,542.06 rows=44,603 width=27) (actual time=11.590..72.203 rows=44,632 loops=1)

  • Hash Cond: (b_dm_3.fk_encounter = c_enc_3.pk)
52. 24.167 39.653 ↓ 1.0 44,632 1

Hash Join (cost=3.09..2,428.41 rows=44,603 width=31) (actual time=0.070..39.653 rows=44,632 loops=1)

  • Hash Cond: (b_dm_3.fk_type = b_dt_3.pk)
53. 15.447 15.447 ↓ 1.0 44,632 1

Seq Scan on doc_med b_dm_3 (cost=0.00..1,812.03 rows=44,603 width=20) (actual time=0.007..15.447 rows=44,632 loops=1)

54. 0.027 0.039 ↑ 1.0 93 1

Hash (cost=1.93..1.93 rows=93 width=23) (actual time=0.039..0.039 rows=93 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
55. 0.012 0.012 ↑ 1.0 93 1

Seq Scan on doc_type b_dt_3 (cost=0.00..1.93 rows=93 width=23) (actual time=0.005..0.012 rows=93 loops=1)

56. 5.697 11.417 ↓ 1.0 31,937 1

Hash (cost=1,101.27..1,101.27 rows=31,927 width=4) (actual time=11.417..11.417 rows=31,937 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1379kB
57. 5.720 5.720 ↓ 1.0 31,937 1

Seq Scan on encounter c_enc_3 (cost=0.00..1,101.27 rows=31,927 width=4) (actual time=0.007..5.720 rows=31,937 loops=1)

58. 6.781 12.671 ↓ 1.0 34,350 1

Hash (cost=984.27..984.27 rows=34,327 width=8) (actual time=12.671..12.671 rows=34,350 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 1794kB
59. 5.890 5.890 ↓ 1.0 34,350 1

Seq Scan on episode c_epi_3 (cost=0.00..984.27 rows=34,327 width=8) (actual time=0.008..5.890 rows=34,350 loops=1)

60. 0.002 0.009 ↑ 1.0 1 1

Hash (cost=8.31..8.31 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
61. 0.007 0.007 ↑ 1.0 1 1

Index Scan using doc_obj_pkey on doc_obj b_do_3 (cost=0.29..8.31 rows=1 width=4) (actual time=0.007..0.007 rows=1 loops=1)

  • Index Cond: (pk = rdo.fk_reviewed_row)
Planning time : 3.681 ms
Execution time : 6,691.110 ms