Double "count(*)" query
Somehow count(*) query is duplicated in the engine. I can see it in Laravel debug bar.

Controller code:
public function index()
{
if (Datatable::shouldHandle()) {
return Datatable::query(Customer::query()) // all(array('id', 'firstName', 'lastName', 'phone')))
->showColumns('firstName', 'lastName', 'phone')
->searchColumns('phone')
->orderColumns('lastName', 'firstName')
->make();
}
return View::make('customers.index');
}
Template code:
{{ Datatable::table()
->addColumn('First name', 'Last name', 'Phone')
->setUrl(route('customers.index'))
->render() }}
The same issue arises when using the following:
Datatable::query(DB::table('customers')->select(array('id', 'firstName', 'lastName', 'phone')))
The first time it will count all entries for the total amount, the second time it will count the entries for the current page:
Showing 1 to 10 of 57 entries
But the queries are identical. The second one is without LIMIT clause. I have 1000 entries of which only 10 is currently shown.
select count(*) as aggregate from `customers`
select `id`, `firstName`, `lastName`, `phone` from `customers` order by `firstName` asc limit
select count(*) as aggregate from `customers`
i will look into this.
One query is for the total, unfiltered, amount of items The other query counts the items which matches the filter 1 to 10 from 234 Entries(filtered from 1.000 entries)
Well... That's unexpected. And that's not performance-wise. count(*) in InnoDB tables is an expensive operation. It should be controlled by some settings I beleive.
I have the same problem, i want to know what happened with this issue!
Imho it works as expected and as the "specification" states, any advise on how to convert it into a setting and how to handle it?