Apr 6, 2018
10
Level 4
Query perform very slow when using where in condition
I am having this query.
$items = DB::table('items')
->leftJoin('default_price', 'items.id_item', '=', 'default_price.id_item')
->leftJoin('vendors', 'items.id_vendor', '=', 'vendors.id_supplier')
->whereIn('items.id_vendor', $vendors)
->whereIn('items.id_item', $id_items_default)
->get()->toArray();
There's around 90 vendors and 10k items.
->whereIn('items.id_item', $id_items_default)
This condition caused whole performance slow down about 20 sec. How can i make it perform faster even with huge data? Thanks in advance.
Please or to participate in this conversation.
