explain.depesz.com

PostgreSQL's explain analyze made readable

Result: njhx

Settings
# exclusive inclusive rows x rows loops node
1. 0.037 5.330 ↓ 0.0 0 1

Sort (cost=6,808.89..6,808.90 rows=1 width=748) (actual time=5.330..5.330 rows=0 loops=1)

  • Sort Key: item_categories.sequence_no, items.name
  • Sort Method: quicksort Memory: 25kB
2. 0.000 5.293 ↓ 0.0 0 1

Nested Loop Left Join (cost=3,273.90..6,808.88 rows=1 width=748) (actual time=5.293..5.293 rows=0 loops=1)

3. 0.001 5.293 ↓ 0.0 0 1

Nested Loop Left Join (cost=3,273.62..6,808.57 rows=1 width=732) (actual time=5.292..5.293 rows=0 loops=1)

4. 0.000 5.292 ↓ 0.0 0 1

Nested Loop (cost=3,273.34..6,808.27 rows=1 width=731) (actual time=5.292..5.292 rows=0 loops=1)

5. 0.032 5.292 ↓ 0.0 0 1

Hash Join (cost=3,272.91..6,801.22 rows=1 width=673) (actual time=5.292..5.292 rows=0 loops=1)

  • Hash Cond: (inventories.location_id = stock_takes.location_id)
  • Join Filter: ((inventories.item_id = stock_take_items.item_id) OR (inventories.ingredient_id = stock_take_items.ingredient_id))
6. 0.047 0.047 ↑ 17,014.0 1 1

Index Scan using inventories_inventory_type_index on inventories (cost=0.42..2,604.47 rows=17,014 width=31) (actual time=0.047..0.047 rows=1 loops=1)

  • Index Cond: (inventory_type = 1)
7. 0.001 5.213 ↓ 0.0 0 1

Hash (cost=3,262.19..3,262.19 rows=824 width=658) (actual time=5.213..5.213 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
8. 0.025 5.212 ↓ 0.0 0 1

Hash Join (cost=1,415.81..3,262.19 rows=824 width=658) (actual time=5.212..5.212 rows=0 loops=1)

  • Hash Cond: (stock_take_items.stock_take_id = stock_takes.id)
9. 0.003 0.895 ↓ 0.0 0 1

Bitmap Heap Scan on stock_take_items (cost=1,391.41..3,235.62 rows=824 width=654) (actual time=0.895..0.895 rows=0 loops=1)

  • Recheck Cond: (id = ANY ('{3519834,3519835,3519836,3521888,3521889,3521891,3521892,3521893,3521894,3521895,3521897,3521898,3521899,3522181,3522180,3522166,3522165,3522163,3522162,3522161,3522160,3522159,3522158,3522157,3522156,3522155,3522154,3522153,3522151,3522150,3522149,3522148,3522146,3522145,3522142,3522141,3522140,3522139,3521608,3521607,3521606,3521605,3521604,3521603,3521600,3521599,3521598,3521597,3521596,3521595,3521594,3521592,3521591,3521590,3521589,3521588,3521587,3521586,3521585,3521584,3521583,3521582,3521581,3521580,3521579,3521578,3521577,3521576,3521575,3521574,3521573,3521572,3521571,3521569,3521568,3521567,3521564,3521563,3521562,3521561,3521560,3521559,3521558,3521557,3521556,3521553,3521552,3521550,3521548,3521547,3521544,3521543,3521542,3521541,3521540,3521539,3521538,3521537,3521536,3521535,3521534,3521533,3521532,3520121,3520221,3522129,3522128,3522127,3522126,3522125,3522124,3522123,3522122,3522121,3520103,3520101,3520100,3520099,3520098,3520097,3520096,3520094,3520093,3520092,3520091,3520090,3520089,3520088,3520087,3520086,3521861,3521860,3521859,3521858,3521856,3521855,3521853,3521852,3521850,3521849,3521848,3521847,3521846,3521845,3521844,3521843,3521842,3521841,3521840,3521839,3521838,3521837,3521836,3521827,3521826,3521824,3521823,3521821,3521820,3521818,3521817,3521816,3521813,3521812,3521811,3521807,3521806,3521805,3521804,3521803,3521802,3521801,3521800,3521799,3521798,3521797,3521796,3521795,3521794,3521792,3521791,3521790,3521789,3521787,3521786,3521785,3521784,3521782,3521781,3521779,3521777,3521776,3521775,3521774,3521773,3521772,3521771,3521770,3521769,3521768,3521767,3521766,3521765,3521764,3521763,3521762,3521756,3521755,3521754,3521753,3521752,3521751,3521750,3521749,3521748,3521747,3521745,3521744,3521740,3521739,3521671,3521670,3521668,3521665,3521664,3520027,3520026,3520025,3520024,3520023,3520022,3520021,3520020,3520019,3520016,3520014,3520013,3520012,3520011,3520010,3520009,3520008,3520007,3520006,3520005,3520004,3520003,3520002,3520000,3519998,3519996,3519994,3519993,3519992,3519991,3519988,3522272,3519832,3519980,3519981,3519983,3519984,3519985,3519986,3519987,3522119,3522118,3522117,3522116,3522115,3522114,3522113,3522112,3522111,3522110,3522109,3522108,3522107,3522105,3522104,3522103,3522102,3522101,3522099,3522098,3522097,3522096,3522095,3522094,3522093,3522092,3522091,3522090,3522089,3522088,3522087,3522086,3522085,3522084,3522083,3522082,3522081,3522080,3522079,3522078,3522077,3522076,3522074,3522073,3522072,3522070,3522069,3522067,3521593,3521570,3521565,3521736,3521735,3521733,3521677,3521676,3521675,3521673,3521672,3521555,3521551,3521549,3521545,3521530,3521528,3521527,3521643,3521927,3521918,3521917,3521867,3520211,3520215,3521914,3521896,3520210,3521788,3521783,3521778,3521759,3521667,3521703,3521947,3521946,3521945,3521944,3521943,3521941,3521940,3521939,3521653,3521652,3521651,3521650,3521649,3521648,3521647,3521646,3521645,3521644,3521611,3521610,3521609,3522232,3522231,3522230,3522229,3522228,3522227,3522226,3522225,3522224,3522223,3522222,3522221,3522220,3522219,3522218,3522217,3522216,3522215,3522214,3522213,3522212,3522211,3522210,3522209,3522208,3522207,3522206,3522205,3522204,3522197,3522195,3522194,3522193,3522192,3522191,3522190,3522189,3522188,3522187,3522186,3522185,3522184,3520219,3520218,3520217,3520216,3520209,3520208,3520207,3520206,3520205,3520202,3520201,3520200,3520199,3520198,3520196,3520195,3520191,3520190,3520189,3520188,3520187,3520186,3520185,3520184,3520183,3520182,3520180,3520179,3520178,3520177,3520176,3520173,3519982,3520102,3520105,3520118,3520166,3520163,3520162,3520161,3520160,3520159,3520158,3520157,3520156,3520154,3520152,3520151,3520149,3520148,3520147,3520146,3520144,3520143,3520142,3520141,3520140,3520139,3520138,3520137,3520135,3520134,3520132,3520131,3520130,3520129,3520128,3520127,3520125,3520123,3520122,3520120,3520119,3520117,3520116,3520115,3520114,3520113,3520112,3520111,3520110,3520109,3520108,3520107,3520104,3521717,3521716,3521715,3521713,3521712,3521711,3521709,3521708,3521707,3521706,3521704,3521702,3521701,3521698,3521693,3521691,3521690,3521689,3521688,3521686,3521683,3521681,3521680,3521679,3522131,3522132,3522133,3522134,3522176,3522173,3522143,3522144,3522147,3522152,3522164,3522271,3522270,3522269,3522268,3522267,3522266,3522265,3522264,3522263,3522262,3522261,3522260,3522259,3522258,3522257,3522256,3522255,3522254,3522253,3522252,3522182,3522183,3522196,3522200,3521669,3522251,3522250,3522249,3522248,3522247,3522246,3522245,3522244,3522243,3522242,3522241,3522240,3522239,3522238,3522237,3522236,3522235,3522234,3522233,3522179,3522178,3522177,3522175,3522174,3522138,3522137,3522136,3522135,3522130,3522032,3522031,3522030,3522029,3522028,3522027,3522026,3522025,3522024,3522023,3522021,3522020,3522019,3522018,3522017,3522016,3521948,3521952,3521957,3521965,3521970,3521973,3521978,3521934,3521674,3521678,3521682,3521684,3521692,3521694,3521695,3521696,3521697,3521699,3522014,3522013,3522011,3522010,3522009,3522008,3522006,3522004,3522001,3522000,3521999,3521998,3521997,3521996,3521995,3521863,3521857,3521851,3521834,3521830,3521829,3521828,3521825,3521822,3521819,3521815,3521810,3521809,3521808,3521743,3521737,3521730,3521726,3521714,3521710,3521705,3521980,3521979,3521977,3521976,3521975,3521974,3521971,3521968,3521967,3521966,3521964,3521963,3521962,3521961,3521960,3521959,3521956,3521955,3521953,3521951,3521950,3521949,3521937,3521935,3521933,3521931,3521930,3521929,3521928,3521926,3521925,3521924,3521923,3521922,3521921,3521920,3521919,3521661,3521663,3521746,3521658,3520133,3520136,3520145,3520150,3520153,3520204,3520126,3520165,3521662,3521660,3521657,3521656,3521655,3521654,3521642,3521641,3521640,3521639,3521638,3521637,3521636,3521635,3521634,3521633,3521632,3521631,3521630,3521629,3521626,3521625,3521624,3521622,3521621,3521620,3521619,3521618,3521617,3521616,3521615,3521614,3521613,3521612,3522203,3522202,3522201,3522199,3522198,3520225,3520224,3520223,3520222,3520197,3520172,3520171,3520170,3520169,3520168,3520167,3520164,3520044,3520043,3520042,3520041,3520039,3520038,3520037,3520036,3520035,3520034,3520033,3520032,3521916,3521915,3521913,3521911,3521909,3521908,3521907,3521906,3521905,3521904,3521903,3521900,3521868,3521865,3521864,3521862,3521793,3521758,3521757,3521732,3521731,3521729,3521728,3521727,3521725,3521724,3521723,3521722,3521721,3521720,3521719,3521718,3520031,3520030,3520029,3520028,3520001,3519858,3519857,3519856,3519855,3519853,3519852,3519851,3519850,3519849,3519847,3519846,3519845,3519844,3519843,3519842,3519841,3519840,3519839,3519838,3519837,3519833}'::integer[]))
10. 0.892 0.892 ↓ 0.0 0 1

Bitmap Index Scan on stock_take_items_pkey (cost=0.00..1,391.20 rows=824 width=0) (actual time=0.892..0.892 rows=0 loops=1)

  • Index Cond: (id = ANY ('{3519834,3519835,3519836,3521888,3521889,3521891,3521892,3521893,3521894,3521895,3521897,3521898,3521899,3522181,3522180,3522166,3522165,3522163,3522162,3522161,3522160,3522159,3522158,3522157,3522156,3522155,3522154,3522153,3522151,3522150,3522149,3522148,3522146,3522145,3522142,3522141,3522140,3522139,3521608,3521607,3521606,3521605,3521604,3521603,3521600,3521599,3521598,3521597,3521596,3521595,3521594,3521592,3521591,3521590,3521589,3521588,3521587,3521586,3521585,3521584,3521583,3521582,3521581,3521580,3521579,3521578,3521577,3521576,3521575,3521574,3521573,3521572,3521571,3521569,3521568,3521567,3521564,3521563,3521562,3521561,3521560,3521559,3521558,3521557,3521556,3521553,3521552,3521550,3521548,3521547,3521544,3521543,3521542,3521541,3521540,3521539,3521538,3521537,3521536,3521535,3521534,3521533,3521532,3520121,3520221,3522129,3522128,3522127,3522126,3522125,3522124,3522123,3522122,3522121,3520103,3520101,3520100,3520099,3520098,3520097,3520096,3520094,3520093,3520092,3520091,3520090,3520089,3520088,3520087,3520086,3521861,3521860,3521859,3521858,3521856,3521855,3521853,3521852,3521850,3521849,3521848,3521847,3521846,3521845,3521844,3521843,3521842,3521841,3521840,3521839,3521838,3521837,3521836,3521827,3521826,3521824,3521823,3521821,3521820,3521818,3521817,3521816,3521813,3521812,3521811,3521807,3521806,3521805,3521804,3521803,3521802,3521801,3521800,3521799,3521798,3521797,3521796,3521795,3521794,3521792,3521791,3521790,3521789,3521787,3521786,3521785,3521784,3521782,3521781,3521779,3521777,3521776,3521775,3521774,3521773,3521772,3521771,3521770,3521769,3521768,3521767,3521766,3521765,3521764,3521763,3521762,3521756,3521755,3521754,3521753,3521752,3521751,3521750,3521749,3521748,3521747,3521745,3521744,3521740,3521739,3521671,3521670,3521668,3521665,3521664,3520027,3520026,3520025,3520024,3520023,3520022,3520021,3520020,3520019,3520016,3520014,3520013,3520012,3520011,3520010,3520009,3520008,3520007,3520006,3520005,3520004,3520003,3520002,3520000,3519998,3519996,3519994,3519993,3519992,3519991,3519988,3522272,3519832,3519980,3519981,3519983,3519984,3519985,3519986,3519987,3522119,3522118,3522117,3522116,3522115,3522114,3522113,3522112,3522111,3522110,3522109,3522108,3522107,3522105,3522104,3522103,3522102,3522101,3522099,3522098,3522097,3522096,3522095,3522094,3522093,3522092,3522091,3522090,3522089,3522088,3522087,3522086,3522085,3522084,3522083,3522082,3522081,3522080,3522079,3522078,3522077,3522076,3522074,3522073,3522072,3522070,3522069,3522067,3521593,3521570,3521565,3521736,3521735,3521733,3521677,3521676,3521675,3521673,3521672,3521555,3521551,3521549,3521545,3521530,3521528,3521527,3521643,3521927,3521918,3521917,3521867,3520211,3520215,3521914,3521896,3520210,3521788,3521783,3521778,3521759,3521667,3521703,3521947,3521946,3521945,3521944,3521943,3521941,3521940,3521939,3521653,3521652,3521651,3521650,3521649,3521648,3521647,3521646,3521645,3521644,3521611,3521610,3521609,3522232,3522231,3522230,3522229,3522228,3522227,3522226,3522225,3522224,3522223,3522222,3522221,3522220,3522219,3522218,3522217,3522216,3522215,3522214,3522213,3522212,3522211,3522210,3522209,3522208,3522207,3522206,3522205,3522204,3522197,3522195,3522194,3522193,3522192,3522191,3522190,3522189,3522188,3522187,3522186,3522185,3522184,3520219,3520218,3520217,3520216,3520209,3520208,3520207,3520206,3520205,3520202,3520201,3520200,3520199,3520198,3520196,3520195,3520191,3520190,3520189,3520188,3520187,3520186,3520185,3520184,3520183,3520182,3520180,3520179,3520178,3520177,3520176,3520173,3519982,3520102,3520105,3520118,3520166,3520163,3520162,3520161,3520160,3520159,3520158,3520157,3520156,3520154,3520152,3520151,3520149,3520148,3520147,3520146,3520144,3520143,3520142,3520141,3520140,3520139,3520138,3520137,3520135,3520134,3520132,3520131,3520130,3520129,3520128,3520127,3520125,3520123,3520122,3520120,3520119,3520117,3520116,3520115,3520114,3520113,3520112,3520111,3520110,3520109,3520108,3520107,3520104,3521717,3521716,3521715,3521713,3521712,3521711,3521709,3521708,3521707,3521706,3521704,3521702,3521701,3521698,3521693,3521691,3521690,3521689,3521688,3521686,3521683,3521681,3521680,3521679,3522131,3522132,3522133,3522134,3522176,3522173,3522143,3522144,3522147,3522152,3522164,3522271,3522270,3522269,3522268,3522267,3522266,3522265,3522264,3522263,3522262,3522261,3522260,3522259,3522258,3522257,3522256,3522255,3522254,3522253,3522252,3522182,3522183,3522196,3522200,3521669,3522251,3522250,3522249,3522248,3522247,3522246,3522245,3522244,3522243,3522242,3522241,3522240,3522239,3522238,3522237,3522236,3522235,3522234,3522233,3522179,3522178,3522177,3522175,3522174,3522138,3522137,3522136,3522135,3522130,3522032,3522031,3522030,3522029,3522028,3522027,3522026,3522025,3522024,3522023,3522021,3522020,3522019,3522018,3522017,3522016,3521948,3521952,3521957,3521965,3521970,3521973,3521978,3521934,3521674,3521678,3521682,3521684,3521692,3521694,3521695,3521696,3521697,3521699,3522014,3522013,3522011,3522010,3522009,3522008,3522006,3522004,3522001,3522000,3521999,3521998,3521997,3521996,3521995,3521863,3521857,3521851,3521834,3521830,3521829,3521828,3521825,3521822,3521819,3521815,3521810,3521809,3521808,3521743,3521737,3521730,3521726,3521714,3521710,3521705,3521980,3521979,3521977,3521976,3521975,3521974,3521971,3521968,3521967,3521966,3521964,3521963,3521962,3521961,3521960,3521959,3521956,3521955,3521953,3521951,3521950,3521949,3521937,3521935,3521933,3521931,3521930,3521929,3521928,3521926,3521925,3521924,3521923,3521922,3521921,3521920,3521919,3521661,3521663,3521746,3521658,3520133,3520136,3520145,3520150,3520153,3520204,3520126,3520165,3521662,3521660,3521657,3521656,3521655,3521654,3521642,3521641,3521640,3521639,3521638,3521637,3521636,3521635,3521634,3521633,3521632,3521631,3521630,3521629,3521626,3521625,3521624,3521622,3521621,3521620,3521619,3521618,3521617,3521616,3521615,3521614,3521613,3521612,3522203,3522202,3522201,3522199,3522198,3520225,3520224,3520223,3520222,3520197,3520172,3520171,3520170,3520169,3520168,3520167,3520164,3520044,3520043,3520042,3520041,3520039,3520038,3520037,3520036,3520035,3520034,3520033,3520032,3521916,3521915,3521913,3521911,3521909,3521908,3521907,3521906,3521905,3521904,3521903,3521900,3521868,3521865,3521864,3521862,3521793,3521758,3521757,3521732,3521731,3521729,3521728,3521727,3521725,3521724,3521723,3521722,3521721,3521720,3521719,3521718,3520031,3520030,3520029,3520028,3520001,3519858,3519857,3519856,3519855,3519853,3519852,3519851,3519850,3519849,3519847,3519846,3519845,3519844,3519843,3519842,3519841,3519840,3519839,3519838,3519837,3519833}'::integer[]))
11. 0.233 4.292 ↑ 1.1 585 1

Hash (cost=16.40..16.40 rows=640 width=8) (actual time=4.292..4.292 rows=585 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 31kB
12. 4.059 4.059 ↑ 1.1 585 1

Seq Scan on stock_takes (cost=0.00..16.40 rows=640 width=8) (actual time=1.277..4.059 rows=585 loops=1)

13. 0.000 0.000 ↓ 0.0 0

Index Scan using items_pkey on items (cost=0.42..7.05 rows=1 width=58) (never executed)

  • Index Cond: (id = stock_take_items.item_id)
14. 0.000 0.000 ↓ 0.0 0

Index Scan using measurement_units_pkey on measurement_units (cost=0.28..0.30 rows=1 width=9) (never executed)

  • Index Cond: (id = items.measurement_unit_id)
15. 0.000 0.000 ↓ 0.0 0

Index Scan using item_categories_pkey on item_categories (cost=0.29..0.31 rows=1 width=20) (never executed)

  • Index Cond: (id = items.item_category_id)
Planning time : 5.248 ms
Execution time : 5.823 ms