In file /packages/Webkul/Ui/src/DataGrid/DataGrid.php:
abstract class DataGrid -> public function getCollection()
this function is slow on big amount of products
$this->collection = $this->queryBuilder->orderBy($this->index, $this->sortOrder)->paginate($this->itemsPerPage)->appends(request()->except('page'))
it's generate aggregation query:
select count(*) as aggregate from product_flat left join products on product_flat.product_id = products.id left join attribute_families on products.attribute_family_id = attribute_families.id left join product_inventories on product_flat.product_id = product_inventories.product_id where channel = 'default' and locale = 'en' group by product_flat.product_id
on my 700 000 products it takes 8sec.
please, help to get faster this query on big catalog!
Second query become faster than comment code in public function prepareQueryBuilder() in class ProductDataGrid extends DataGrid of ProductDataGrid.php:
edit ->select('product_flat.product_id as product_id'... to
->select('product_flat.product_id as product_id', 'product_flat.sku as product_sku', 'product_flat.name as product_name', 'product_flat.status', 'product_flat.price')