laravel-query-builder
laravel-query-builder copied to clipboard
Exact filter on relationship making multiple sub query resulting in slow performance
Hi
I am using this package at lot of places but recently putting multiple filters on relationship. And in the query log I found it is appending a lot of sub-query (exists) resulting in slow performance. What can be done?
I am using below filters -
AllowedFilter::exact('fuel_id', 'ownerVehicle.fuel_id'),
AllowedFilter::exact('body_vehicle_id', 'ownerVehicle.body_vehicle_id'),
AllowedFilter::exact('vehicle_first_register_year', 'ownerVehicle.vehicle_first_register_year'),
AllowedFilter::exact('gearbox_id', 'ownerVehicle.gearbox_id'),
AllowedFilter::exact('model_id', 'ownerVehicle.model_id'),
AllowedFilter::exact('product_category_type_id', 'ownerVehicle.vehicle.product_category_type_id'),
AllowedFilter::exact('product_type_id', 'ownerVehicle.vehicle.productCategoryType.product_type_id'),
AllowedFilter::exact('brand_id', 'ownerVehicle.model.brand_id'),
AllowedFilter::exact('model_id', 'ownerVehicle.model_id'),
AllowedFilter::exact('body_condition_id', 'ownerVehicle.body_condition_id'),
AllowedFilter::exact('owner_number', 'ownerVehicle.owner_number'),