You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the great package, Ben! I noticed N+1 queries:
Example: I created two experiments and two goals. If a user is visiting a page with an included a/b test the package fetches the experiment one, then separately the two goals. After that it fetches the second experiment and the two goals separately as well. Then, it is updating the visitors counter. So in the end 7 queries are performed.
The query problem is due to the nested foreach in the start() method in the ABTesting class. The goals model should be eager loaded.
It would be great if you have a quick solution for the problem. Otherwise I will create a PR in the next weeks.
The text was updated successfully, but these errors were encountered:
Hi Robin, thanks for your effort in making this package better. However, I can not confirm the N+1 problem by adding eager loading. In fact by adding eager loading, two additional queries will be executed. Can you confirm this behavior?
By adding eager loading to the experiment, all associated goals will be fetched via one additional query. In the current implementation, all goals for all experiments are getting fetched separately. See here 19 queries for three experiments and four goals as an example:
Thanks for the great package, Ben! I noticed N+1 queries:
Example: I created two experiments and two goals. If a user is visiting a page with an included a/b test the package fetches the experiment one, then separately the two goals. After that it fetches the second experiment and the two goals separately as well. Then, it is updating the visitors counter. So in the end 7 queries are performed.
The query problem is due to the nested foreach in the
start()
method in the ABTesting class. The goals model should be eager loaded.It would be great if you have a quick solution for the problem. Otherwise I will create a PR in the next weeks.
The text was updated successfully, but these errors were encountered: