Zizaco / entrust

Role-based Permissions for Laravel 5
MIT License
6.05k stars 1.29k forks source link

Too much queries! #851

Closed jhemmmm closed 3 years ago

jhemmmm commented 7 years ago

Yes, it is just to fucking much queries. I tried creating a mention system, I tried mentioning 10 users and I got 300+ queries. (It does duplicate queries)

tripper54 commented 7 years ago

Patch?

jhemmmm commented 7 years ago

Patch what?

leandroruel commented 7 years ago

you can show us it here? i mean, copy and paste your output here?

Zizaco commented 6 years ago

@MaeJhem I will be taking a look at this problem

jhemmmm commented 6 years ago

Thanks, You can try creating a mention system and take a look of the output itself.

anis-bedhiafi commented 6 years ago

Hi Guys. @MaeJhem @leandroruel

I am having the same issue.

For a simple page I have

620 statements were executed, 617 of which were duplicated, 3 unique

It is killing the server

Duplicates are roles and permissions:

select roles.*, role_user.user_id as pivot_user_id, role_user.role_id as pivot_role_id, role_user.created_at as pivot_created_at, role_user.updated_at as pivot_updated_at from roles inner join role_user on roles.id = role_user.role_id where role_user.user_id = '2'

select permissions.*, permission_role.role_id as pivot_role_id, permission_role.permission_id as pivot_permission_id from permissions inner join permission_role on permissions.id = permission_role.permission_id where permission_role.role_id = '2'

I attached a screenshot from debugger. entrust-bug

jhemmmm commented 6 years ago

@anis-bedhiafi Thanks, I hope it got fixed as soon as possible, it is killing the server.

dflow commented 6 years ago

any news?

leandroruel commented 6 years ago

i think no.

tanteng commented 6 years ago

how to solve it

daoquangdung commented 6 years ago

I think this might help you https://github.com/Zizaco/entrust/pull/373/files

tatarysh commented 6 years ago

set: CACHE_DRIVER=array in .env file

and add 'ttl' in confg/cache.php

return [
/***/
    'ttl' => 60,
/***/
];
matteo-gz commented 5 years ago

very good!

jhemmmm commented 3 years ago

Dead.