explain.depesz.com

PostgreSQL's explain analyze made readable

Result: a44O

Settings
# exclusive inclusive rows x rows loops node
1. 0.954 125.279 ↑ 1.1 321 1

Sort (cost=375,123.62..375,124.49 rows=348 width=31) (actual time=125.217..125.279 rows=321 loops=1)

  • Sort Key: courses.name
  • Sort Method: quicksort Memory: 58kB
2. 1.289 124.325 ↑ 1.1 321 1

Bitmap Heap Scan on courses (cost=44.40..375,108.93 rows=348 width=31) (actual time=0.429..124.325 rows=321 loops=1)

  • Recheck Cond: ((owner_id IS NULL) OR (owner_id = 32679))
  • Filter: (active AND (((available_for_subscription OR (available_for_subscription IS NULL)) AND (owner_id IS NULL) AND ((NOT private) OR (private IS NULL))) OR (owner_id = 32679)))
  • Rows Removed by Filter: 701
  • Heap Blocks: exact=311
3. 0.000 0.093 ↓ 0.0 0 1

BitmapOr (cost=44.40..44.40 rows=1,022 width=0) (actual time=0.093..0.093 rows=0 loops=1)

4. 0.069 0.069 ↑ 1.0 750 1

Bitmap Index Scan on index_courses_on_owner_id (cost=0.00..29.91 rows=750 width=0) (actual time=0.069..0.069 rows=750 loops=1)

  • Index Cond: (owner_id IS NULL)
5. 0.024 0.024 ↓ 1.0 279 1

Bitmap Index Scan on index_courses_on_owner_id (cost=0.00..14.32 rows=272 width=0) (actual time=0.024..0.024 rows=279 loops=1)

  • Index Cond: (owner_id = 32679)
6.          

SubPlan (forBitmap Heap Scan)

7. 2.568 122.943 ↑ 1.0 1 321

Aggregate (cost=1,076.19..1,076.20 rows=1 width=4) (actual time=0.383..0.383 rows=1 loops=321)

8. 15.446 120.375 ↓ 1.4 18 321

Nested Loop (cost=1.09..1,076.16 rows=13 width=4) (actual time=0.122..0.375 rows=18 loops=321)

9. 74.151 74.151 ↓ 2.8 48 321

Index Scan using index_train_sessions_on_account_id_and_course_id on train_sessions (cost=0.67..932.47 rows=17 width=4) (actual time=0.082..0.231 rows=48 loops=321)

  • Index Cond: ((account_id = ANY ('{35671,35371,35374,32679,35707,35615,35677,35628,35541,35538,35630,35592,35530,35616,35710,35670,35634,35730,35708,35583,35625,35738,35723,35347,35637,35352,36182,35789,35790,35791,35716,36183,35362,35544,35539,35731,35537,35709,35606,35354,35651,35894,35691,35653,35652,35655,35656,35706,35568,35693,35694,35570,35576,35577,35533,35596,35695,35532,35696,35376,35373,35742,36188,35722,35627,35536,35567,35737,35623,35618,36198,36199,35635,35729,35728,35893,35631,35372,35355,35572,35681,35569,35574,35575,35605,35542,35721,35351,35640,35361,35642,35360,35641,35582,35584,35571,35624,35609,35713,35608,35714,35700,35676,35674,35678,35754,35755,35357,35358,35711,35715,35356,35375,35664,35661,35662,35377,36184,35663,35591,35699,35679,35683,35820,35366,35976,35369,36200,35735,35611,35349,35638,35689,35724,35819,35675,35666,35649,35690,35985,35658,35657,35659,36206,36205,35573,35654,35650,35585,35587,35588,35586,35610,35725,35726,35579,35580,35578,36185,35617,35607,35712,35702,35668,35669,35665,35672,35543,35632,35626,35535,35633,36186,35612,36769,36187,35667,35350,35660,35718,35717,35368,35821,35594,35684,35581,35719,35720,35736,35629,35595,35704,35359,35703,35727,35685,35680}'::integer[])) AND (course_id = courses.id))
10. 30.778 30.778 ↓ 0.0 0 15,389

Index Scan using index_users_on_login_id on users (cost=0.42..8.44 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=15,389)

  • Index Cond: (login_id = train_sessions.assignee_login_id)
  • Filter: (deleted_at IS NULL)
  • Rows Removed by Filter: 1
Planning time : 0.761 ms
Execution time : 125.412 ms