Skip to content

N+1 query problem on Users list #558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
filisko opened this issue Feb 25, 2025 · 6 comments
Open

N+1 query problem on Users list #558

filisko opened this issue Feb 25, 2025 · 6 comments

Comments

@filisko
Copy link
Contributor

filisko commented Feb 25, 2025

Basically what the title says.

Image

I will try to have a look at it if I have some time.

Thanks

@dgvirtual
Copy link
Collaborator

I have looked at the code and, if I got it right, this is due to how Shield is retrieving list of entities (for each entity in the list there are three more queries to populate various entity properties). While there are only 15 entities in the list, it seems to be ok, but what about a few hundreds?

Anyway, if my reading is correct, this is to be reported upstream first.

@filisko
Copy link
Contributor Author

filisko commented Feb 26, 2025

So I guess you saw this?: themes/Admin/Search/users.php:10 loop here

and then it calls this can() vendor/lonnieezell/bonfire/src/Users/Views/_row_info.php:6

What do you mean by upstream?

Yes, in general its bad design, also makes it easy to add more stuff in there.

@dgvirtual
Copy link
Collaborator

So I guess you saw this?: themes/Admin/Search/users.php:10 loop here
and then it calls this can() vendor/lonnieezell/bonfire/src/Users/Views/_row_info.php:6

Nope, this file is never called when simply viewing the list of users (not unless you do search at the top of the window).

What do you mean by upstream?

I mean Codeigniter Shield.

I actually asked about it in Slack, and it appears there is an easy way to fix this. I have mentioned you at that thread.

@filisko
Copy link
Contributor Author

filisko commented Feb 26, 2025

Nope, this file is never called when simply viewing the list of users (not unless you do search at the top of the window).

I see, but it seems like there will be a similar issue? I will check it.

Thanks! I will check Slack :)

@dgvirtual
Copy link
Collaborator

@filisko, so will you try to solve this issue?

@dgvirtual
Copy link
Collaborator

I see @michalsn has added new methods upstream to solve our issue. @filisko, I would you check how they work? I could do that on monday at the earliest. They may require modifications of bf code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants