QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sort (cost=655976.00..655976.01 rows=1 width=132) (actual time=1422.355..1422.359 rows=36 loops=1)
Sort Key: (lower(CASE WHEN (public.r_user_integration.last_name IS NULL) THEN ((public.m_user.last_name || ', '::text) || public.m_user.first_name) ELSE (((((((public.r_user_integration.last_name)::text || ', '::text) || (public.r_user_integration.firs
_name)::text) || ', '::text) || (public.r_user_integration.uid)::text) || ', '::text) || public.m_user.first_name) END))
Sort Method: quicksort Memory: 32kB
-> HashAggregate (cost=655975.96..655975.99 rows=1 width=132) (actual time=1422.228..1422.265 rows=36 loops=1)
-> Nested Loop Left Join (cost=655797.10..655975.93 rows=1 width=132) (actual time=1302.674..1406.582 rows=13951 loops=1)
Join Filter: ((public.r_class_api.id)::text = (public.r_user_integration.cid)::text)
-> Nested Loop Left Join (cost=655797.10..655946.70 rows=1 width=80) (actual time=1302.671..1398.536 rows=13951 loops=1)
-> Nested Loop Left Join (cost=655797.10..655946.39 rows=1 width=70) (actual time=1302.665..1369.370 rows=13951 loops=1)
-> Nested Loop Left Join (cost=655797.10..655945.99 rows=1 width=68) (actual time=1302.655..1320.762 rows=13951 loops=1)
-> Nested Loop (cost=655797.10..655945.24 rows=1 width=68) (actual time=1302.646..1307.958 rows=40 loops=1)
-> Nested Loop (cost=655797.10..655941.18 rows=1 width=30) (actual time=1302.635..1307.731 rows=40 loops=1)
Join Filter: (ur.account_id = rfa.accountid)
-> Nested Loop (cost=655797.10..655861.60 rows=25 width=16) (actual time=1302.624..1302.849 rows=82 loops=1)
-> Limit (cost=655797.10..655797.16 rows=25 width=49) (actual time=1302.604..1302.619 rows=25 loops=1)
-> Sort (cost=655797.10..655848.63 rows=20612 width=49) (actual time=1302.604..1302.613 rows=25 loops=1)
Sort Key: (min(lower(CASE WHEN (public.r_user_integration.last_name IS NULL) THEN ((public.m_user.last_name || ', '::text) || public.m_user.first_name) ELSE (((((((public.r_user_integration.la
t_name)::text || ', '::text) || (public.r_user_integration.first_name)::text) || ', '::text) || (public.r_user_integration.uid)::text) || ', '::text) || public.m_user.first_name) END)))
Sort Method: top-N heapsort Memory: 26kB
-> HashAggregate (cost=654494.02..655215.44 rows=20612 width=49) (actual time=1272.812..1276.646 rows=17832 loops=1)
-> Merge Left Join (cost=651343.23..654390.96 rows=20612 width=49) (actual time=970.964..1018.053 rows=124227 loops=1)
Merge Cond: (((public.r_class_api.id)::text = (public.r_user_integration.cid)::text) AND (public.r_class_api.account = public.r_user_integration.account))
-> Sort (cost=604120.19..604171.72 rows=20612 width=32) (actual time=970.961..983.847 rows=124227 loops=1)
Sort Key: public.r_class_api.id, public.r_class_api.account
Sort Method: quicksort Memory: 12775kB
-> Nested Loop Left Join (cost=2411.42..602643.21 rows=20612 width=32) (actual time=16.054..930.298 rows=124227 loops=1)
-> Nested Loop Left Join (cost=2411.42..596266.61 rows=20612 width=22) (actual time=16.049..684.384 rows=124227 loops=1)
-> Nested Loop Left Join (cost=2411.42..588002.88 rows=20612 width=22) (actual time=16.042..320.309 rows=124227 loops=1)
-> Nested Loop (cost=2411.42..581570.78 rows=8586 width=22) (actual time=16.035..186.685 rows=18385 loops=1)
-> Nested Loop (cost=2411.42..393125.13 rows=47995 width=12) (actual time=16.027..121.940 rows=18385 loops=1)
-> Bitmap Heap Scan on r_faculty_account rfa (cost=2411.42..194711.04 rows=172001 width=4) (actual time=15.977..46.923 rows=21547 loops=1)
Recheck Cond: (accountid = ANY ('{78029,64869,64782,65012,64872,59276,65010,64870,64862,65011,59277,64867,65013,59275,77207,77208,77212,77
15,77213,77206,77211,77513,77486,77514,77491,77510,77492,77512,77487,77493,77495,77494,76425,76109,76971,76894,76895,68754,74836,76967,76205,76997,74835,76398,74947,74966,76958,77264,77027,77529,77528,74899,68733,68675,76208,68650,77016,76742,76392,76319,6236,76762,76768,76069,74965,68755,68604,68681,76799,77014,76960,68603,68764,68778,74956,76934,77262,74902,76970,76903,68826,74754,76878,76399,76881,68687,68756,77530,74958,76883,76972,74733,76932,74915,77536,77535,77534,77533,77456,77458,77457,77459,7734,77467,77466,77468,77988,77987,77982,77986,77984,77983,77981,77989,77465,77350,74731,74913,76886,76996,76969,74898,68734,74837,76075,76905,76899,74738,77017,77798,77799,76888,77796,74912,77690,77797,77561,77688,68793,76110,77563,77562,77564,77015,77566,7765,68795,77574,74895,74732,68690,68777,76975,68779,76861,76973,77021,76353,68736,76968,77026,77577,77578,77575,77576,76470,76929,76904,68735,77808,77807,76533,74741,77805,76797,76902,74827,76471,68825,76950,77038,68673,68688,76233,77689,77587,77586,77647,7648,77650,77692,77263,77669,77668,77671,77431,77432,77701,77921,77923,77330,77329,77328,77327,77920,77922,77703,77702,77937,77938,77939,77940,77753,77754,77752,78007,78005,78008,78006,77001,77003,76418,76532,76839,76397,68823,76961,76921,76966,76526,6879,76931,76068,68666,74948,76741,74900,77129,68679,77011,76318,68601,76317,77135,77139,76356,77025,77024,77102,77023,76525,76354,74964,76959,76207,76860,76955,68766,76933,68668,68600,77040,76838,76074,76393,76900,74929,76343,77700,77430,77649,77584,77806,7657,76898,76757,74829,74834,74946,76347,78296,78298,78299,78297,78300,78198,78151,78133,76836,76765,74959,68680,76467,76998,76573,76953,77750,77670,77585,76235,74957,77571,76071,77531,74740,77260,77496,78311,68757,76920,76999,74755,68824,74897,68676,76952,6778,76837,74930,76077,76394,77002,68796,74932,68786,74730,76901,76344,76206,68667,68784,68785,68678,76893,68674,76395,77037,74828,68689,76320,76078,77190,76868,68605,74945,76870,68599,74933,77192,77128,76767,74901,76396,74753,76111,74826,76234,77191,7491,76875,76864,77193,77101,76345,68648,76472,76896,76070,76865,76923,76759,76869,77028,76777,76876,77041,68669,76346,68780,76779,76936,76357,76417,76711,76769,76523,77048,74752,76704,77103,76776,77104,76915,76795,68602,76858,77000,77127,76951,74896,76801,7608,76922,76863,77143,76871,76745,76930,76569,77049,76859,76524,76473,76422,76862,76978,76956,76954,76877,77022,77051,76761,74737,76350,77126,68783,76421,76426,76935,76976,76974,77142,77050,77214,78032,78033,78034,78038,78039,78040,78041,78042,78043,78044,8049,78050,78051,78052,78053,78054,78055,78056,78057,78058,78059,78060,78061,78062,78063,78064,78065,78066,78067,78068,78069,78070,78071,78072,78073,78074,78075,78076,78077,78078,78079,78080,78081,78082,78083,78084,78085,78086,78087,78088,78092,78093,7809,78095,78096,78098,78099,78100,78101,78102,78103,78104,78105,78106,78107,78108,78109,78110,78111,78112,78113,78114,78115,78116,78117,78118,78119,78120,78121,78122,78123,78125,78126,78127,78128,78129,78130,78131,78132,78134,78135,78136,78137,78138,78139,7840,78141,78142,78143,78144,78145,78146,78147,78148,78149,78150,78153,78154,78155,78156,78157,78158,78159,78160,78163,78164,78165,78166,78167,78168,78169,78170,78171,78172,78173,78174,78175,78176,78177,78178,78179,78180,78181,78182,78183,78184,78185,78186,8187,78188,78189,78190,78191,78192,78193,78194,78195,78196,78197,78199,78200,78201,78202,78203,78204,78205,78206,78207,78208,78209,78210,78211,78212,78213,78214,78215,78216,78217,78218,78219,78220,78221,78222,78223,78224,78225,78227,78228,78229,78230,7823,78232,78233,78234,78237,78238,78239,78240,78241,78242,78243,78244,78245,78246,78247,78250,78251,78252,78253,78254,78255,78256,78257,78258,78259,78260,78261,78262,78263,78264,78265,78266,78267,78268,78269,78270,78271,78272,78273,78274,78275,78276,78277,7878,78279,78280,78281,78282,78285,78284,78286,78287,78290,78291,78292,78293,78294,78295,78302,78303,78301,78304,78305,78306,78307,78308,78309,78310,66263,55853}'::integer[]))
Filter: active_flag
-> Bitmap Index Scan on ri2_faculty_account (cost=0.00..2368.42 rows=207825 width=0) (actual time=14.674..14.674 rows=174049 loops=1)
Index Cond: (accountid = ANY ('{78029,64869,64782,65012,64872,59276,65010,64870,64862,65011,59277,64867,65013,59275,77207,77208,7721
,77215,77213,77206,77211,77513,77486,77514,77491,77510,77492,77512,77487,77493,77495,77494,76425,76109,76971,76894,76895,68754,74836,76967,76205,76997,74835,76398,74947,74966,76958,77264,77027,77529,77528,74899,68733,68675,76208,68650,77016,76742,76392,7619,76236,76762,76768,76069,74965,68755,68604,68681,76799,77014,76960,68603,68764,68778,74956,76934,77262,74902,76970,76903,68826,74754,76878,76399,76881,68687,68756,77530,74958,76883,76972,74733,76932,74915,77536,77535,77534,77533,77456,77458,77457,77459,7349,77467,77466,77468,77988,77987,77982,77986,77984,77983,77981,77989,77465,77350,74731,74913,76886,76996,76969,74898,68734,74837,76075,76905,76899,74738,77017,77798,77799,76888,77796,74912,77690,77797,77561,77688,68793,76110,77563,77562,77564,77015,7756,77565,68795,77574,74895,74732,68690,68777,76975,68779,76861,76973,77021,76353,68736,76968,77026,77577,77578,77575,77576,76470,76929,76904,68735,77808,77807,76533,74741,77805,76797,76902,74827,76471,68825,76950,77038,68673,68688,76233,77689,77587,77586,7747,77648,77650,77692,77263,77669,77668,77671,77431,77432,77701,77921,77923,77330,77329,77328,77327,77920,77922,77703,77702,77937,77938,77939,77940,77753,77754,77752,78007,78005,78008,78006,77001,77003,76418,76532,76839,76397,68823,76961,76921,76966,76526,8794,76931,76068,68666,74948,76741,74900,77129,68679,77011,76318,68601,76317,77135,77139,76356,77025,77024,77102,77023,76525,76354,74964,76959,76207,76860,76955,68766,76933,68668,68600,77040,76838,76074,76393,76900,74929,76343,77700,77430,77649,77584,7780,76957,76898,76757,74829,74834,74946,76347,78296,78298,78299,78297,78300,78198,78151,78133,76836,76765,74959,68680,76467,76998,76573,76953,77750,77670,77585,76235,74957,77571,76071,77531,74740,77260,77496,78311,68757,76920,76999,74755,68824,74897,68676,7652,76778,76837,74930,76077,76394,77002,68796,74932,68786,74730,76901,76344,76206,68667,68784,68785,68678,76893,68674,76395,77037,74828,68689,76320,76078,77190,76868,68605,74945,76870,68599,74933,77192,77128,76767,74901,76396,74753,76111,74826,76234,77191,4914,76875,76864,77193,77101,76345,68648,76472,76896,76070,76865,76923,76759,76869,77028,76777,76876,77041,68669,76346,68780,76779,76936,76357,76417,76711,76769,76523,77048,74752,76704,77103,76776,77104,76915,76795,68602,76858,77000,77127,76951,74896,7680,76108,76922,76863,77143,76871,76745,76930,76569,77049,76859,76524,76473,76422,76862,76978,76956,76954,76877,77022,77051,76761,74737,76350,77126,68783,76421,76426,76935,76976,76974,77142,77050,77214,78032,78033,78034,78038,78039,78040,78041,78042,78043,7844,78049,78050,78051,78052,78053,78054,78055,78056,78057,78058,78059,78060,78061,78062,78063,78064,78065,78066,78067,78068,78069,78070,78071,78072,78073,78074,78075,78076,78077,78078,78079,78080,78081,78082,78083,78084,78085,78086,78087,78088,78092,78093,8094,78095,78096,78098,78099,78100,78101,78102,78103,78104,78105,78106,78107,78108,78109,78110,78111,78112,78113,78114,78115,78116,78117,78118,78119,78120,78121,78122,78123,78125,78126,78127,78128,78129,78130,78131,78132,78134,78135,78136,78137,78138,7813,78140,78141,78142,78143,78144,78145,78146,78147,78148,78149,78150,78153,78154,78155,78156,78157,78158,78159,78160,78163,78164,78165,78166,78167,78168,78169,78170,78171,78172,78173,78174,78175,78176,78177,78178,78179,78180,78181,78182,78183,78184,78185,7886,78187,78188,78189,78190,78191,78192,78193,78194,78195,78196,78197,78199,78200,78201,78202,78203,78204,78205,78206,78207,78208,78209,78210,78211,78212,78213,78214,78215,78216,78217,78218,78219,78220,78221,78222,78223,78224,78225,78227,78228,78229,78230,8231,78232,78233,78234,78237,78238,78239,78240,78241,78242,78243,78244,78245,78246,78247,78250,78251,78252,78253,78254,78255,78256,78257,78258,78259,78260,78261,78262,78263,78264,78265,78266,78267,78268,78269,78270,78271,78272,78273,78274,78275,78276,7827,78278,78279,78280,78281,78282,78285,78284,78286,78287,78290,78291,78292,78293,78294,78295,78302,78303,78301,78304,78305,78306,78307,78308,78309,78310,66263,55853}'::integer[]))
-> Index Scan using user_role_user_id_key on user_role ur (cost=0.00..1.14 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=21547)
Index Cond: (ur.user_id = rfa.userid)
Filter: ((ur.active IS TRUE) AND (ur.role_id = ANY ('{3,6,7}'::integer[])))
-> Index Scan using m_user_pkey on m_user (cost=0.00..3.91 rows=1 width=18) (actual time=0.003..0.003 rows=1 loops=18385)
Index Cond: (public.m_user.id = rfa.userid)
-> Index Scan using user_rights_class_user_role_id_idx on user_rights_class urc (cost=0.00..0.60 rows=12 width=8) (actual time=0.002..0.006 rows=7 loops=1385)
Index Cond: (ur.id = urc.user_role_id)
Filter: (urc.active IS TRUE)
-> Index Scan using m_class_pkey on m_class (cost=0.00..0.39 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=124227)
Index Cond: (urc.class_id = public.m_class.id)
-> Index Scan using r_class_api_classid_idx on r_class_api (cost=0.00..0.30 rows=1 width=18) (actual time=0.002..0.002 rows=0 loops=124227)
Index Cond: (public.m_class.id = public.r_class_api.classid)
-> Sort (cost=47220.41..48184.66 rows=385700 width=47) (never executed)
Sort Key: public.r_user_integration.cid, public.r_user_integration.account
-> Seq Scan on r_user_integration (cost=0.00..11433.00 rows=385700 width=47) (never executed)
-> Index Scan using user_role_user_id_key on user_role ur (cost=0.00..2.56 rows=1 width=12) (actual time=0.005..0.008 rows=3 loops=25)
Index Cond: (ur.user_id = public.m_user.id)
Filter: ((ur.active IS TRUE) AND (ur.role_id = ANY ('{3,6,7}'::integer[])))
-> Index Scan using ri1_faculty_account on r_faculty_account rfa (cost=0.00..3.17 rows=1 width=18) (actual time=0.022..0.059 rows=1 loops=82)
Index Cond: (rfa.userid = ur.user_id)
Filter: (rfa.active_flag AND (rfa.accountid = ANY ('{78029,64869,64782,65012,64872,59276,65010,64870,64862,65011,59277,64867,65013,59275,77207,77208,77212,77215,77213,77206,77211,77513,77486,77514,77491,7
510,77492,77512,77487,77493,77495,77494,76425,76109,76971,76894,76895,68754,74836,76967,76205,76997,74835,76398,74947,74966,76958,77264,77027,77529,77528,74899,68733,68675,76208,68650,77016,76742,76392,76319,76236,76762,76768,76069,74965,68755,68604,6868176799,77014,76960,68603,68764,68778,74956,76934,77262,74902,76970,76903,68826,74754,76878,76399,76881,68687,68756,77530,74958,76883,76972,74733,76932,74915,77536,77535,77534,77533,77456,77458,77457,77459,77349,77467,77466,77468,77988,77987,77982,77986,7794,77983,77981,77989,77465,77350,74731,74913,76886,76996,76969,74898,68734,74837,76075,76905,76899,74738,77017,77798,77799,76888,77796,74912,77690,77797,77561,77688,68793,76110,77563,77562,77564,77015,77566,77565,68795,77574,74895,74732,68690,68777,76975,6779,76861,76973,77021,76353,68736,76968,77026,77577,77578,77575,77576,76470,76929,76904,68735,77808,77807,76533,74741,77805,76797,76902,74827,76471,68825,76950,77038,68673,68688,76233,77689,77587,77586,77647,77648,77650,77692,77263,77669,77668,77671,7743177432,77701,77921,77923,77330,77329,77328,77327,77920,77922,77703,77702,77937,77938,77939,77940,77753,77754,77752,78007,78005,78008,78006,77001,77003,76418,76532,76839,76397,68823,76961,76921,76966,76526,68794,76931,76068,68666,74948,76741,74900,77129,6869,77011,76318,68601,76317,77135,77139,76356,77025,77024,77102,77023,76525,76354,74964,76959,76207,76860,76955,68766,76933,68668,68600,77040,76838,76074,76393,76900,74929,76343,77700,77430,77649,77584,77806,76957,76898,76757,74829,74834,74946,76347,78296,7298,78299,78297,78300,78198,78151,78133,76836,76765,74959,68680,76467,76998,76573,76953,77750,77670,77585,76235,74957,77571,76071,77531,74740,77260,77496,78311,68757,76920,76999,74755,68824,74897,68676,76952,76778,76837,74930,76077,76394,77002,68796,7493268786,74730,76901,76344,76206,68667,68784,68785,68678,76893,68674,76395,77037,74828,68689,76320,76078,77190,76868,68605,74945,76870,68599,74933,77192,77128,76767,74901,76396,74753,76111,74826,76234,77191,74914,76875,76864,77193,77101,76345,68648,76472,7686,76070,76865,76923,76759,76869,77028,76777,76876,77041,68669,76346,68780,76779,76936,76357,76417,76711,76769,76523,77048,74752,76704,77103,76776,77104,76915,76795,68602,76858,77000,77127,76951,74896,76801,76108,76922,76863,77143,76871,76745,76930,76569,7049,76859,76524,76473,76422,76862,76978,76956,76954,76877,77022,77051,76761,74737,76350,77126,68783,76421,76426,76935,76976,76974,77142,77050,77214,78032,78033,78034,78038,78039,78040,78041,78042,78043,78044,78049,78050,78051,78052,78053,78054,78055,7805678057,78058,78059,78060,78061,78062,78063,78064,78065,78066,78067,78068,78069,78070,78071,78072,78073,78074,78075,78076,78077,78078,78079,78080,78081,78082,78083,78084,78085,78086,78087,78088,78092,78093,78094,78095,78096,78098,78099,78100,78101,78102,7813,78104,78105,78106,78107,78108,78109,78110,78111,78112,78113,78114,78115,78116,78117,78118,78119,78120,78121,78122,78123,78125,78126,78127,78128,78129,78130,78131,78132,78134,78135,78136,78137,78138,78139,78140,78141,78142,78143,78144,78145,78146,78147,7148,78149,78150,78153,78154,78155,78156,78157,78158,78159,78160,78163,78164,78165,78166,78167,78168,78169,78170,78171,78172,78173,78174,78175,78176,78177,78178,78179,78180,78181,78182,78183,78184,78185,78186,78187,78188,78189,78190,78191,78192,78193,7819478195,78196,78197,78199,78200,78201,78202,78203,78204,78205,78206,78207,78208,78209,78210,78211,78212,78213,78214,78215,78216,78217,78218,78219,78220,78221,78222,78223,78224,78225,78227,78228,78229,78230,78231,78232,78233,78234,78237,78238,78239,78240,7821,78242,78243,78244,78245,78246,78247,78250,78251,78252,78253,78254,78255,78256,78257,78258,78259,78260,78261,78262,78263,78264,78265,78266,78267,78268,78269,78270,78271,78272,78273,78274,78275,78276,78277,78278,78279,78280,78281,78282,78285,78284,78286,7287,78290,78291,78292,78293,78294,78295,78302,78303,78301,78304,78305,78306,78307,78308,78309,78310,66263,55853}'::integer[])))
-> Index Scan using m_user_pkey on m_user (cost=0.00..4.05 rows=1 width=50) (actual time=0.005..0.005 rows=1 loops=40)
Index Cond: (public.m_user.id = rfa.userid)
-> Index Scan using user_rights_class_user_role_id_idx on user_rights_class urc (cost=0.00..0.60 rows=12 width=8) (actual time=0.005..0.246 rows=348 loops=40)
Index Cond: (urc.user_role_id = ur.id)
Filter: (urc.active IS TRUE)
-> Index Scan using m_class_pkey on m_class (cost=0.00..0.39 rows=1 width=6) (actual time=0.003..0.003 rows=1 loops=13951)
Index Cond: (urc.class_id = public.m_class.id)
-> Index Scan using r_class_api_classid_idx on r_class_api (cost=0.00..0.30 rows=1 width=18) (actual time=0.002..0.002 rows=0 loops=13951)
Index Cond: (public.m_class.id = public.r_class_api.classid)
-> Index Scan using r_user_integration_account_idx on r_user_integration (cost=0.00..15.86 rows=891 width=82) (actual time=0.000..0.000 rows=0 loops=13951)
Index Cond: (public.r_class_api.account = public.r_user_integration.account)
Total runtime: 1423.233 ms
(66 rows)