A
A
Artem00712018-07-16 18:31:06
Laravel
Artem0071, 2018-07-16 18:31:06

How to solve the N+1 problem?

There are posts
And each post can be liked, that is, the following tables are obtained:
1) users
2) posts 3) likes (id ,
user_id, likeable_id, likeable_type)
or not?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2018-07-16
@Artem0071

1 request for a collection of posts
1 request for user likes on these posts
= 2 requests

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question