Skip to main content
Tutorial Free

Laravel simplePaginate: more effective with bigger data

October 24, 2017
1 min read
Laravel pagination is quite a simple thing to use, but to determine the amount of pages it makes additional query to the database, which may be a problem for bigger amount of data. And you can actually avoid it. Let's take a simple pagination example from a table with 5000 customers:
$customers = Customer::paginate(10);
And then in Blade file you have this:

    @foreach ($customers as $customer)
        
    @endforeach
    
First name Last name Email
{{ $customer->first_name }} {{ $customer->last_name }} {{ $customer->email }}
{{ $customers->links() }}
Here's how the queries look in Laravel Debugbar. Laravel pagination As you can see, there's query for the actual page, and then counting the amount of entries/pages. What if you don't need the numbers of pages and you just want to show links for Previous and Next? There's a function for that called simplePaginate().
$customers = Customer::simplePaginate(10);
Laravel simplepaginate Now, look at the amount of queries. Hope that helps!

Enjoyed This Tutorial?

Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.

Recent Courses on Laravel Daily

AI Agents/IDEs for Laravel: May 2026 (Claude Code, Codex, OpenCode, etc)

7 lessons
52 min

Testing in Laravel 13 For Beginners

26 lessons
1 h 41 min read

Queues in Laravel 13

18 lessons
1 h 12 min read

No comments yet…