Skip to content

Use different query to count filtered record #3103

@abudawud

Description

@abudawud

Summary of problem or feature request

On very complex query where i need to join many table to get some aggregation value and complex calculation for column:

  • Total Order,
  • Total Sent,
  • Total Procesed,
  • warehouse stock,
  • material stock,
  • etc.

I'm not need to filter all column above because it's just a numeric value so i set the searchable flag to false. The duration to complete this query is about 500 ms, so the total duration to complete datatable request is 1500 ms consist of 500 ms to count total record, 500 ms to cound filtered record and 500 ms to get the first 25 record for paging. I have ommit the 500 ms to count total record by set the total record manually using Order::count(). now i want to ommit the count of filtered record but i don't now how to apply the filter value from datatable to the model. is there any suggestion ?

System details

  • Operating System: Manjaro Linux
  • 8
  • Laravel Version 9
  • Laravel-Datatables 10.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions