mgmk

Query slow in datatable

Posted 8 months ago by mgmk

Hi,

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')
                ->get();

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

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.