Query slow in datatable

Posted 8 months ago by mgmk


I have 35,000 over records in my table and I'm using datatables library to render all these records. After implemented with datatables, the query result took about 27 seconds. It is too long, right? Can you help me to check the way I implemented is correct or wrong?

Thanks in advance!

$products = $merchant->Product()->select(['id', 'name', 'price'])
                ->orderBy('created_at', 'desc')

return Datatables::of($products)->make();

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.