explain.depesz.com

PostgreSQL's explain analyze made readable

Result: oeGy

Settings
# exclusive inclusive rows x rows loops node
1. 0.069 9,332.556 ↑ 1.0 50 1

Limit (cost=842,008.44..1,010,402.80 rows=50 width=678) (actual time=7,705.139..9,332.556 rows=50 loops=1)

2.          

Initplan (forLimit)

3. 0.004 0.004 ↑ 1.0 1 1

Index Scan using p_user_pkey on p_user p_user_1 (cost=0.03..4.03 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1)

  • Index Cond: (id = 132)
4. 0.009 0.009 ↑ 1.0 1 1

Index Scan using p_user_pkey on p_user p_user_2 (cost=0.03..4.03 rows=1 width=4) (actual time=0.008..0.009 rows=1 loops=1)

  • Index Cond: (id = 132)
5. 0.003 0.003 ↑ 1.0 1 1

Index Scan using p_user_pkey on p_user p_user_3 (cost=0.03..4.03 rows=1 width=1) (actual time=0.003..0.003 rows=1 loops=1)

  • Index Cond: (id = 132)
6. 4.554 9,332.471 ↑ 1.1 300 1

Result (cost=24.52..1,104,691.55 rows=328 width=678) (actual time=30.316..9,332.471 rows=300 loops=1)

7. 0.469 1.217 ↑ 1.1 300 1

Sort (cost=24.52..24.68 rows=328 width=90) (actual time=0.892..1.217 rows=300 loops=1)

  • Sort Key: image_set.created DESC
  • Sort Method: quicksort Memory: 71kB
8. 0.095 0.748 ↑ 1.0 328 1

Hash Left Join (cost=13.22..21.77 rows=328 width=90) (actual time=0.197..0.748 rows=328 loops=1)

  • Hash Cond: (image_set.group_id = image_set_group.id)
9. 0.073 0.649 ↑ 1.0 328 1

Hash Left Join (cost=12.20..20.57 rows=328 width=69) (actual time=0.186..0.649 rows=328 loops=1)

  • Hash Cond: (image_set.id = favorite_image_set.image_set_id)
10. 0.110 0.571 ↑ 1.0 328 1

Hash Left Join (cost=11.19..19.39 rows=328 width=65) (actual time=0.177..0.571 rows=328 loops=1)

  • Hash Cond: (image_set.id = organizations_image_sets_access.image_set_id)
  • Filter: ($9 OR (image_set.owner_id = 132) OR image_set.featured OR image_set.public OR (repo_access.user_id IS NOT NULL) OR ((organizations_image_sets_access.organization_id IS NOT NULL) AND (NOT organizations_image_sets_access.hidden)) OR (group_access.user_id IS NOT NULL) OR ((organizations_image_set_group_access.organization_id IS NOT NULL) AND (NOT organizations_image_set_group_access.hidden)))
11. 0.073 0.369 ↑ 1.0 328 1

Hash Left Join (cost=6.84..14.86 rows=328 width=74) (actual time=0.074..0.369 rows=328 loops=1)

  • Hash Cond: (image_set.group_id = organizations_image_set_group_access.group_id)
12. 0.065 0.280 ↑ 1.0 328 1

Hash Left Join (cost=5.82..13.67 rows=328 width=69) (actual time=0.054..0.280 rows=328 loops=1)

  • Hash Cond: (image_set.group_id = group_access.group_id)
13. 0.081 0.210 ↑ 1.0 328 1

Hash Left Join (cost=4.81..12.47 rows=328 width=60) (actual time=0.043..0.210 rows=328 loops=1)

  • Hash Cond: (image_set.id = repo_access.repo_id)
14. 0.105 0.105 ↑ 1.0 328 1

Seq Scan on image_set (cost=0.00..7.33 rows=328 width=51) (actual time=0.012..0.105 rows=328 loops=1)

  • Filter: (NOT deleted)
  • Rows Removed by Filter: 115
15. 0.004 0.024 ↑ 1.0 2 1

Hash (cost=4.80..4.80 rows=2 width=13) (actual time=0.023..0.024 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
16. 0.008 0.020 ↑ 1.0 2 1

Bitmap Heap Scan on repo_access (cost=2.06..4.80 rows=2 width=13) (actual time=0.017..0.020 rows=2 loops=1)

  • Recheck Cond: (user_id = 132)
  • Heap Blocks: exact=2
17. 0.012 0.012 ↑ 1.0 2 1

Bitmap Index Scan on user_id_key (cost=0.00..2.06 rows=2 width=0) (actual time=0.012..0.012 rows=2 loops=1)

  • Index Cond: (user_id = 132)
18. 0.000 0.005 ↓ 0.0 0 1

Hash (cost=1.01..1.01 rows=1 width=13) (actual time=0.005..0.005 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
19. 0.005 0.005 ↓ 0.0 0 1

Seq Scan on group_access (cost=0.00..1.01 rows=1 width=13) (actual time=0.005..0.005 rows=0 loops=1)

  • Filter: (user_id = 132)
  • Rows Removed by Filter: 4
20. 0.002 0.016 ↓ 2.0 2 1

Hash (cost=1.01..1.01 rows=1 width=9) (actual time=0.016..0.016 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
21. 0.014 0.014 ↓ 2.0 2 1

Seq Scan on organizations_image_set_group_access (cost=0.00..1.01 rows=1 width=9) (actual time=0.013..0.014 rows=2 loops=1)

  • Filter: (organization_id = $8)
22. 0.037 0.092 ↑ 1.0 336 1

Hash (cost=3.18..3.18 rows=336 width=9) (actual time=0.092..0.092 rows=336 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 22kB
23. 0.055 0.055 ↑ 1.0 336 1

Seq Scan on organizations_image_sets_access (cost=0.00..3.18 rows=336 width=9) (actual time=0.011..0.055 rows=336 loops=1)

  • Filter: (organization_id = $7)
24. 0.001 0.005 ↑ 1.0 1 1

Hash (cost=1.01..1.01 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
25. 0.004 0.004 ↑ 1.0 1 1

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

  • Filter: (user_id = 132)
  • Rows Removed by Filter: 2
26. 0.001 0.004 ↑ 1.0 3 1

Hash (cost=1.01..1.01 rows=3 width=36) (actual time=0.004..0.004 rows=3 loops=1)

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

Seq Scan on image_set_group (cost=0.00..1.01 rows=3 width=36) (actual time=0.002..0.003 rows=3 loops=1)

28.          

SubPlan (forResult)

29. 9.900 91.200 ↑ 1.0 1 300

Aggregate (cost=676.71..676.72 rows=1 width=8) (actual time=0.304..0.304 rows=1 loops=300)

30. 81.300 81.300 ↑ 1.3 557 300

Index Only Scan using repo_context_link_pkey on image_set_context_link (cost=0.08..676.34 rows=740 width=0) (actual time=0.008..0.271 rows=557 loops=300)

  • Index Cond: (image_set_id = image_set.id)
  • Heap Fetches: 167056
31. 18.300 9,221.400 ↑ 1.0 1 300

Aggregate (cost=2,682.78..2,682.78 rows=1 width=32) (actual time=30.738..30.738 rows=1 loops=300)

32. 18.988 9,203.100 ↑ 1.3 557 300

Nested Loop (cost=679.02..2,682.42 rows=712 width=8) (actual time=17.906..30.677 rows=557 loops=300)

33. 4,671.840 8,850.000 ↑ 1.3 557 300

Hash Join (cost=678.93..2,479.27 rows=740 width=4) (actual time=17.879..29.500 rows=557 loops=300)

  • Hash Cond: (context.id = image_set_context_link_1.context_id)
34. 4,087.260 4,087.260 ↑ 1.0 181,937 290

Seq Scan on context (cost=0.00..1,704.81 rows=181,937 width=8) (actual time=0.006..14.094 rows=181,937 loops=290)

35. 24.300 90.900 ↑ 1.3 557 300

Hash (cost=676.34..676.34 rows=740 width=4) (actual time=0.303..0.303 rows=557 loops=300)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
36. 66.600 66.600 ↑ 1.3 557 300

Index Only Scan using repo_context_link_pkey on image_set_context_link image_set_context_link_1 (cost=0.08..676.34 rows=740 width=4) (actual time=0.007..0.222 rows=557 loops=300)

  • Index Cond: (image_set_id = image_set.id)
  • Heap Fetches: 167056
37. 334.112 334.112 ↑ 1.0 1 167,056

Index Scan using biopsy_pkey on slide (cost=0.08..0.27 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=167,056)

  • Index Cond: (id = context.slide_id)
  • Filter: (deleted_date IS NULL)
38. 2.700 2.700 ↑ 1.0 1 300

Index Scan using p_user_pkey on p_user (cost=0.03..4.03 rows=1 width=15) (actual time=0.008..0.009 rows=1 loops=300)

  • Index Cond: (id = image_set.owner_id)
39. 0.900 11.400 ↑ 1.0 1 300

Limit (cost=0.25..4.35 rows=1 width=42) (actual time=0.036..0.038 rows=1 loops=300)

40. 1.270 10.500 ↑ 712.0 1 300

Nested Loop (cost=0.25..2,920.99 rows=712 width=42) (actual time=0.035..0.035 rows=1 loops=300)

41. 1.280 7.200 ↑ 740.0 1 300

Nested Loop (cost=0.17..2,717.83 rows=740 width=4) (actual time=0.024..0.024 rows=1 loops=300)

42. 3.600 3.600 ↑ 740.0 1 300

Index Only Scan using repo_context_link_pkey on image_set_context_link image_set_context_link_2 (cost=0.08..676.34 rows=740 width=4) (actual time=0.012..0.012 rows=1 loops=300)

  • Index Cond: (image_set_id = image_set.id)
  • Heap Fetches: 290
43. 2.320 2.320 ↑ 1.0 1 290

Index Scan using context_pkey on context context_1 (cost=0.08..2.76 rows=1 width=8) (actual time=0.008..0.008 rows=1 loops=290)

  • Index Cond: (id = image_set_context_link_2.context_id)
44. 2.030 2.030 ↑ 1.0 1 290

Index Scan using biopsy_pkey on slide slide_1 (cost=0.08..0.27 rows=1 width=46) (actual time=0.007..0.007 rows=1 loops=290)

  • Index Cond: (id = context_1.slide_id)
  • Filter: (deleted_date IS NULL)
Planning time : 5.306 ms