Reputation: 2355
I have 100k record in my posts
table and 100k records in users
table.
When i use laravel's
pagination. it takes too long to return data...!
Code:
$posts = Post::join('users', 'posts.user_id', 'users.id')
->where('posts.status', '=', 1)
->where('users.status', '=', 1)
->paginate(10);
How can i fix this and got better performance?
Note
I have this problem also when i use inRandomOrder()
on $posts
Upvotes: 5
Views: 10353
Reputation: 124
You can use Laravel simplePaginate() method. It will show only "Next" and "Previous" links, if that is enough for you. https://laravel.com/docs/5.0/pagination#usage
Upvotes: 9