explain.depesz.com

PostgreSQL's explain analyze made readable

Result: GVTYv

Settings
# exclusive inclusive rows x rows loops node
1. 3.281 511.536 ↓ 14.0 14 1

HashAggregate (cost=1,670,464.07..1,670,464.09 rows=1 width=117) (actual time=511.526..511.536 rows=14 loops=1)

  • Group Key: to_char("order".placed_at, 'Mon yyyy'::text), product.name, product_instance.id, subscription_type_term.name
2. 4.552 508.255 ↓ 969.0 969 1

Nested Loop Left Join (cost=5.34..1,670,464.03 rows=1 width=117) (actual time=3.342..508.255 rows=969 loops=1)

3. 1.302 499.827 ↓ 969.0 969 1

Nested Loop (cost=4.91..1,670,463.58 rows=1 width=102) (actual time=2.699..499.827 rows=969 loops=1)

4. 0.786 495.618 ↓ 969.0 969 1

Nested Loop (cost=4.49..1,670,463.10 rows=1 width=83) (actual time=2.157..495.618 rows=969 loops=1)

5. 1.967 490.956 ↓ 969.0 969 1

Merge Join (cost=4.06..1,670,462.64 rows=1 width=75) (actual time=1.618..490.956 rows=969 loops=1)

  • Merge Cond: (cart_product.order_id = "order".id)
6. 1.673 485.150 ↑ 408.4 969 1

Nested Loop (cost=2.38..2,955,443.83 rows=395,735 width=74) (actual time=1.605..485.150 rows=969 loops=1)

7. 2.650 478.727 ↓ 1.7 950 1

GroupAggregate (cost=1.81..1,800,656.07 rows=564 width=30) (actual time=1.598..478.727 rows=950 loops=1)

  • Group Key: cart_product_1.order_id
8. 476.077 476.077 ↑ 723.6 969 1

Index Scan using cart_product_order_idx on cart_product cart_product_1 (cost=1.81..1,790,133.33 rows=701,140 width=30) (actual time=1.064..476.077 rows=969 loops=1)

  • Index Cond: (order_id = ANY ('{33649481,33819865,35353626,35979542,36681116,35995823,36708332,36059851,36072698,35719488,36303214,36348385,34736592,36235092,33818178,33298508,34104913,34369818,36644604,33840078,34650457,36269019,33909279,33009770,35248993,35276536,36470910,34594915,34919890,35529543,35976915,34770164,35520944,34401813,36347749,35147367,36597315,34340959,33903087,34840082,33747502,34654388,33338481,36390198,35846415,34306384,36690953,35333984,34259359,34337181,35795661,33271613,35308615,36231109,36699550,33630717,34447110,33092058,33316001,36073055,34075853,35809748,33722896,34629269,34949532,35545856,35266144,35413014,35725247,33287325,35262440,36465352,36671932,33981906,33043119,35247743,33224691,34042269,35309128,35377076,35760008,35321860,33064161,34944338,33470213,35147259,33581138,34663470,35072496,35867136,36493711,35392808,35889938,33424635,36732647,34188005,33937726,35316495,31446932,33620460,34388882,34314588,35918073,34557026,36074609,36660914,34259168,35615248,33683582,33782873,34416837,35216745,33714270,33760405,36419528,36730522,35468823,35776058,35548868,34592909,34943407,33543673,33724288,34083516,36290214,36071094,36789965,33339782,34898730,36723666,34088029,35688210,33739399,34406902,36653991,34149420,35627173,36226382,33061761,33282596,34417273,34963811,36065907,33727760,35474290,36672271,36655055,33277223,35913670,35487513,35812082,35729439,35527218,35818059,36082951,33837218,35809064,36058325,33343185,34408892,35975841,33361294,35557551,33345226,35741190,36221498,34669590,33229926,35530395,35918965,36487884,33370885,36321090,35792039,35615127,33565038,35015695,36753667,33006260,34044620,36502315,33983165,35733479,36092774,35794456,35500700,35971743,33697107,34619237,36749527,34426422,34797841,36284128,36056306,34505241,33359976,35042587,36655118,34136427,36082174,33417106,34380483,35090429,33582233,35597891,33290910,36409980,35936350,35677166,34799742,35925690,35483444,35280777,34447707,34168453,36228981,34494285,36065315,33783364,34092560,35764100,35892155,36511964,33322264,33582201,35383588,34461006,36524374,34090225,35756571,35780008,36359740,34765481,33628222,35807798,35844904,36376474,33304929,34063982,35681732,35219302,33846761,36775270,33053634,35900021,33277391,36353046,33507447,35813688,34962378,33365680,33457688,35331816,34843663,36395636,36028870,35767891,33347969,35170151,35897000,36082455,33448341,33332429,36717031,33684375,35579171,36712592,33861864,36390593,33222229,36197944,36307453,36742621,34020103,35237373,36509446,34767644,36276339,36724671,33192169,33594689,35493873,35721584,34085837,34914782,36575698,35606600,36400158,36809393,7845255,36427001,34069644,35229407,35476692,36074452,36640045,33135784,35305371,35891123,34854571,34970762,33189322,36459352,35719209,34201955,34017226,34251359,35302676,34362165,34686658,34765100,33440285,34654294,33600258,34265369,33636602,34151072,33788208,36318985,34149837,35528555,33100638,36197278,34760779,35510665,36362598,33290203,34749718,34948147,36074934,33068792,36043259,35967279,36714806,35779609,34284651,33336485,35821312,33407349,33289146,34936738,35846555,36769654,34853590,34687474,34430301,35602528,35544298,35500514,36075456,33415647,33732699,34100237,34121219,35108646,35580941,35279027,36204133,36694878,35323959,35604975,35545978,36515519,35663425,35433019,34611921,36022846,35303580,33324949,35588448,34351207,34850113,36510472,36756652,34282460,35701193,36702415,35520784,36035272,33868737,35001253,34686671,33386049,35556527,35845508,34629741,35384260,34930260,36714047,33268263,34423615,35706492,35229344,33917903,35964896,33320039,36733528,33532541,35835032,36525363,35826895,36014737,35617929,34033823,35824268,35295382,36397775,35509875,36048345,36502952,36696478,36677122,35357686,36783730,34678606,34775335,36544311,33141481,33317304,36095916,36204864,34609540,35771643,35814655,35251115,33158650,33296729,36295860,36733478,34493070,35810656,33021467,34464559,34347524,36741909,33197541,34445013,36373725,33723659,36083184,36798677,36670774,35329430,36491760,35772390,36472646,33284972,36294371,33533010,33641967,36386516,34763687,36708125,34865237,35002463,36809888,33533852,7851192,36010390,36017316,36085560,33206647,33952291,36735567,35600225,36008068,34263501,35022616,36444735,33385520,33299064,33331510,33692827,33792419,34753281,35225114,33989279,34704000,35303293,34035192,34364106,33762769,34961418,36052045,36106647,33775841,36740614,33508145,36101536,36104407,36762449,33134262,33201081,33252126,33605785,35784320,35926139,34830795,35273981,34113885,36625193,34589382,34698085,35858708,34781080,36502449,35927106,33899093,36723856,33025116,34936040,34367021,36642355,35340761,33294285,33736974,35194978,34006051,36679335,35642406,33858115,34036067,35980749,34126395,35738428,33563896,35284367,35860298,35808102,35476845,36233155,36811925,33932803,35654577,36106534,34628683,35807054,36125642,34092203,33481574,35770728,35286462,35719775,36088919,33758823,34936308,33316772,36749493,34370859,34647155,36245889,33019227,33934561,33508591,33838306,34309598,35638868,34662323,34727374,33275327,34914357,34988013,35796968,35763557,33585916,34341824,35242470,35716670,34272040,36747256,35792831,36719976,33609984,33785766,35837076,36772342,36274115,36558380,36766244,34555971,35545119,36030643,33020788,33051717,34492601,36208401,33069114,36659271,36383368,34740271,36385897,34771979,36000489,34687028,35894235,35560021,33434786,33190718,35512705,33023002,35590216,33656204,35446687,36100777,34692226,34461312,35006851,34406581,35238250,36691661,36019143,33540327,36070846,36717005,32987248,33935092,36762621,33577395,36316225,35214346,35726324,36104957,33997682,35838785,33102748,33803117,34335624,36306206,33052618,36438746,35207415,34971827,36098160,36734340,35753460,36630788,35253462,33483474,34642441,36050033,36766447,33236280,35478872,35523431,33612191,36452308,33293696,33580035,33203029,35738361,36557700,33650655,36126285,35049417,35295135,35927441,34700438,36472871,35806311,33128043,34308787,36094261,36333942,35227367,35824118,35158025,35540739,35032288,35995761,35299775,32999361,33326408,33200963,34018668,36589298,34745526,35004131,33780531,36802892,36731008,34977341,35698979,34768534,35991617,36713626,36324811,36196837,36712781,34712225,35695764,35593432,35834496,33303713,33345826,33320583,33747412,35371295,36697069,36548094,36491259,35719240,36288048,36350029,33151111,34965835,35328628,35832380,35478242,35295210,35893730,35537727,36447462,36454497,35855509,33079757,34954462,33602378,36089469,33596802,36232863,35546911,36734982,35570221,36093835,36343862,30468729,33037523,33782586,35705541,35887486,32990925,36109730,35461221,33298412,35357383,36031233,33444223,33321004,34727549,35740522,36218817,36481474,36729038,33024307,34178805,33181179,33195169,35226456,36641741,33175351,32991450,33755323,35842546,35825023,33311089,35511004,36308797,36433841,36542775,34146773,33686237,33292672,34902959,35646584,36369115,36533093,36027724,33987907,35211084,33736809,33011409,35227868,33031478,34024683,34604156,36505299,34656228,34828843,35540331,36446518,36772502,33981678,35810666,33484493,34161597,36640665,32999848,36039586,35297431,35217231,36714771,33307266,34968294,34276667,33027403,34011026,33546370,36042576,36549437,34327110,36673521,33856086,36437931,36684679,36109200,36037630,35402062,33412510,35349512,35508503,36356258,34955378,34962188,33050851,33090866,33601388,34698637,33649606,35300746,35675861,7844793,34421056,36373792,32978799,36804564,34118082,36743385,36797778,35840405,36635707,35322814,33493052,36457663,33286968,34666190,33746351,33726194,33085427,33320170,35515871,36431542,36514158,33190413,33472896,35995038,35755388,36654910,34179598,36668113,34304400,34414193,36387177,36544465,33025372,33597295,34116689,33327031,35030746,36043783,36743009,36764889,35310029,36792645,36014748,34638089,33571886,34166997,34197761,35253524,35035341,35954112,36647119,35317796,36483731,33868912,35556022,35843299,35896841,36713174,35598918,36322769,36423967,36459511,34322042,36502907,33863990,35170933,36051966,36099391,33499460,34384818,36028818,36754709,35594881,34424575,34314918,34855892,36723052,35687522,35794337,35432398,36668987,36745245,33698426,33151399,33584642,34559095,34765137,34938459,33508362,33299823,33110387,36027987,36098463,34854786,36215093,36254336,36714084,35687430,33895925,34925094,33283302,36074570,34721909,33284470,34158003,36087347,35692213,35626080,35749384,33576382,33825951,34372991,36763668,36803478,35887076,36358813,36401693,36723320,33818058,36251828,36042150,36069793,33817744,33074196,34680845,35895705,36437454,36083965,36422018,36585446,34111665,36730726,33200987,33524280,34917329,36319508,7844998,34376408,34674193,34961592,34068405,33082233,34489282,35537439,33372754,35345417,36091301,35804178,36362156,35890951,35975921,33526816,35819375,35927511,33020553,33089784,35225009,34230757,33758377,34274917,36319052,35977223,36732766,33846367,36701234,36010861,35542302,36510978,35882262,33045999,34216726,34279331,36301154,35783013,34087354,33325045,35973847,35037268,36752973}'::bigint[]))
9. 4.750 4.750 ↑ 702.0 1 950

Index Scan using cart_product_order_idx on cart_product (cost=0.56..2,040.47 rows=702 width=42) (actual time=0.004..0.005 rows=1 loops=950)

  • Index Cond: (order_id = cart_product_1.order_id)
10. 3.839 3.839 ↓ 1.0 1,019 1

Index Scan using order_pkey on "order" (cost=1.69..4,685.78 rows=1,000 width=25) (actual time=0.009..3.839 rows=1,019 loops=1)

  • Index Cond: (id = ANY ('{33649481,33819865,35353626,35979542,36681116,35995823,36708332,36059851,36072698,35719488,36303214,36348385,34736592,36235092,33818178,33298508,34104913,34369818,36644604,33840078,34650457,36269019,33909279,33009770,35248993,35276536,36470910,34594915,34919890,35529543,35976915,34770164,35520944,34401813,36347749,35147367,36597315,34340959,33903087,34840082,33747502,34654388,33338481,36390198,35846415,34306384,36690953,35333984,34259359,34337181,35795661,33271613,35308615,36231109,36699550,33630717,34447110,33092058,33316001,36073055,34075853,35809748,33722896,34629269,34949532,35545856,35266144,35413014,35725247,33287325,35262440,36465352,36671932,33981906,33043119,35247743,33224691,34042269,35309128,35377076,35760008,35321860,33064161,34944338,33470213,35147259,33581138,34663470,35072496,35867136,36493711,35392808,35889938,33424635,36732647,34188005,33937726,35316495,31446932,33620460,34388882,34314588,35918073,34557026,36074609,36660914,34259168,35615248,33683582,33782873,34416837,35216745,33714270,33760405,36419528,36730522,35468823,35776058,35548868,34592909,34943407,33543673,33724288,34083516,36290214,36071094,36789965,33339782,34898730,36723666,34088029,35688210,33739399,34406902,36653991,34149420,35627173,36226382,33061761,33282596,34417273,34963811,36065907,33727760,35474290,36672271,36655055,33277223,35913670,35487513,35812082,35729439,35527218,35818059,36082951,33837218,35809064,36058325,33343185,34408892,35975841,33361294,35557551,33345226,35741190,36221498,34669590,33229926,35530395,35918965,36487884,33370885,36321090,35792039,35615127,33565038,35015695,36753667,33006260,34044620,36502315,33983165,35733479,36092774,35794456,35500700,35971743,33697107,34619237,36749527,34426422,34797841,36284128,36056306,34505241,33359976,35042587,36655118,34136427,36082174,33417106,34380483,35090429,33582233,35597891,33290910,36409980,35936350,35677166,34799742,35925690,35483444,35280777,34447707,34168453,36228981,34494285,36065315,33783364,34092560,35764100,35892155,36511964,33322264,33582201,35383588,34461006,36524374,34090225,35756571,35780008,36359740,34765481,33628222,35807798,35844904,36376474,33304929,34063982,35681732,35219302,33846761,36775270,33053634,35900021,33277391,36353046,33507447,35813688,34962378,33365680,33457688,35331816,34843663,36395636,36028870,35767891,33347969,35170151,35897000,36082455,33448341,33332429,36717031,33684375,35579171,36712592,33861864,36390593,33222229,36197944,36307453,36742621,34020103,35237373,36509446,34767644,36276339,36724671,33192169,33594689,35493873,35721584,34085837,34914782,36575698,35606600,36400158,36809393,7845255,36427001,34069644,35229407,35476692,36074452,36640045,33135784,35305371,35891123,34854571,34970762,33189322,36459352,35719209,34201955,34017226,34251359,35302676,34362165,34686658,34765100,33440285,34654294,33600258,34265369,33636602,34151072,33788208,36318985,34149837,35528555,33100638,36197278,34760779,35510665,36362598,33290203,34749718,34948147,36074934,33068792,36043259,35967279,36714806,35779609,34284651,33336485,35821312,33407349,33289146,34936738,35846555,36769654,34853590,34687474,34430301,35602528,35544298,35500514,36075456,33415647,33732699,34100237,34121219,35108646,35580941,35279027,36204133,36694878,35323959,35604975,35545978,36515519,35663425,35433019,34611921,36022846,35303580,33324949,35588448,34351207,34850113,36510472,36756652,34282460,35701193,36702415,35520784,36035272,33868737,35001253,34686671,33386049,35556527,35845508,34629741,35384260,34930260,36714047,33268263,34423615,35706492,35229344,33917903,35964896,33320039,36733528,33532541,35835032,36525363,35826895,36014737,35617929,34033823,35824268,35295382,36397775,35509875,36048345,36502952,36696478,36677122,35357686,36783730,34678606,34775335,36544311,33141481,33317304,36095916,36204864,34609540,35771643,35814655,35251115,33158650,33296729,36295860,36733478,34493070,35810656,33021467,34464559,34347524,36741909,33197541,34445013,36373725,33723659,36083184,36798677,36670774,35329430,36491760,35772390,36472646,33284972,36294371,33533010,33641967,36386516,34763687,36708125,34865237,35002463,36809888,33533852,7851192,36010390,36017316,36085560,33206647,33952291,36735567,35600225,36008068,34263501,35022616,36444735,33385520,33299064,33331510,33692827,33792419,34753281,35225114,33989279,34704000,35303293,34035192,34364106,33762769,34961418,36052045,36106647,33775841,36740614,33508145,36101536,36104407,36762449,33134262,33201081,33252126,33605785,35784320,35926139,34830795,35273981,34113885,36625193,34589382,34698085,35858708,34781080,36502449,35927106,33899093,36723856,33025116,34936040,34367021,36642355,35340761,33294285,33736974,35194978,34006051,36679335,35642406,33858115,34036067,35980749,34126395,35738428,33563896,35284367,35860298,35808102,35476845,36233155,36811925,33932803,35654577,36106534,34628683,35807054,36125642,34092203,33481574,35770728,35286462,35719775,36088919,33758823,34936308,33316772,36749493,34370859,34647155,36245889,33019227,33934561,33508591,33838306,34309598,35638868,34662323,34727374,33275327,34914357,34988013,35796968,35763557,33585916,34341824,35242470,35716670,34272040,36747256,35792831,36719976,33609984,33785766,35837076,36772342,36274115,36558380,36766244,34555971,35545119,36030643,33020788,33051717,34492601,36208401,33069114,36659271,36383368,34740271,36385897,34771979,36000489,34687028,35894235,35560021,33434786,33190718,35512705,33023002,35590216,33656204,35446687,36100777,34692226,34461312,35006851,34406581,35238250,36691661,36019143,33540327,36070846,36717005,32987248,33935092,36762621,33577395,36316225,35214346,35726324,36104957,33997682,35838785,33102748,33803117,34335624,36306206,33052618,36438746,35207415,34971827,36098160,36734340,35753460,36630788,35253462,33483474,34642441,36050033,36766447,33236280,35478872,35523431,33612191,36452308,33293696,33580035,33203029,35738361,36557700,33650655,36126285,35049417,35295135,35927441,34700438,36472871,35806311,33128043,34308787,36094261,36333942,35227367,35824118,35158025,35540739,35032288,35995761,35299775,32999361,33326408,33200963,34018668,36589298,34745526,35004131,33780531,36802892,36731008,34977341,35698979,34768534,35991617,36713626,36324811,36196837,36712781,34712225,35695764,35593432,35834496,33303713,33345826,33320583,33747412,35371295,36697069,36548094,36491259,35719240,36288048,36350029,33151111,34965835,35328628,35832380,35478242,35295210,35893730,35537727,36447462,36454497,35855509,33079757,34954462,33602378,36089469,33596802,36232863,35546911,36734982,35570221,36093835,36343862,30468729,33037523,33782586,35705541,35887486,32990925,36109730,35461221,33298412,35357383,36031233,33444223,33321004,34727549,35740522,36218817,36481474,36729038,33024307,34178805,33181179,33195169,35226456,36641741,33175351,32991450,33755323,35842546,35825023,33311089,35511004,36308797,36433841,36542775,34146773,33686237,33292672,34902959,35646584,36369115,36533093,36027724,33987907,35211084,33736809,33011409,35227868,33031478,34024683,34604156,36505299,34656228,34828843,35540331,36446518,36772502,33981678,35810666,33484493,34161597,36640665,32999848,36039586,35297431,35217231,36714771,33307266,34968294,34276667,33027403,34011026,33546370,36042576,36549437,34327110,36673521,33856086,36437931,36684679,36109200,36037630,35402062,33412510,35349512,35508503,36356258,34955378,34962188,33050851,33090866,33601388,34698637,33649606,35300746,35675861,7844793,34421056,36373792,32978799,36804564,34118082,36743385,36797778,35840405,36635707,35322814,33493052,36457663,33286968,34666190,33746351,33726194,33085427,33320170,35515871,36431542,36514158,33190413,33472896,35995038,35755388,36654910,34179598,36668113,34304400,34414193,36387177,36544465,33025372,33597295,34116689,33327031,35030746,36043783,36743009,36764889,35310029,36792645,36014748,34638089,33571886,34166997,34197761,35253524,35035341,35954112,36647119,35317796,36483731,33868912,35556022,35843299,35896841,36713174,35598918,36322769,36423967,36459511,34322042,36502907,33863990,35170933,36051966,36099391,33499460,34384818,36028818,36754709,35594881,34424575,34314918,34855892,36723052,35687522,35794337,35432398,36668987,36745245,33698426,33151399,33584642,34559095,34765137,34938459,33508362,33299823,33110387,36027987,36098463,34854786,36215093,36254336,36714084,35687430,33895925,34925094,33283302,36074570,34721909,33284470,34158003,36087347,35692213,35626080,35749384,33576382,33825951,34372991,36763668,36803478,35887076,36358813,36401693,36723320,33818058,36251828,36042150,36069793,33817744,33074196,34680845,35895705,36437454,36083965,36422018,36585446,34111665,36730726,33200987,33524280,34917329,36319508,7844998,34376408,34674193,34961592,34068405,33082233,34489282,35537439,33372754,35345417,36091301,35804178,36362156,35890951,35975921,33526816,35819375,35927511,33020553,33089784,35225009,34230757,33758377,34274917,36319052,35977223,36732766,33846367,36701234,36010861,35542302,36510978,35882262,33045999,34216726,34279331,36301154,35783013,34087354,33325045,35973847,35037268,36752973}'::bigint[]))
11. 3.876 3.876 ↑ 1.0 1 969

Index Scan using product_instance_pkey on product_instance (cost=0.43..0.45 rows=1 width=16) (actual time=0.003..0.004 rows=1 loops=969)

  • Index Cond: (id = cart_product.product_instance_id)
12. 2.907 2.907 ↑ 1.0 1 969

Index Scan using product_pkey on product (cost=0.42..0.46 rows=1 width=35) (actual time=0.003..0.003 rows=1 loops=969)

  • Index Cond: (id = product_instance.product_id)
13. 3.876 3.876 ↑ 1.0 1 969

Index Scan using subscription_type_term_pkey on subscription_type_term (cost=0.42..0.44 rows=1 width=23) (actual time=0.003..0.004 rows=1 loops=969)

  • Index Cond: (cart_product.subscription_type_term_id = id)
Planning time : 18.257 ms
Execution time : 512.150 ms