Skip to content

Perfomance - very slow #2496

Answered by pirex360
pirex360 asked this question in Performance
Oct 26, 2020 · 16 comments · 1 reply
Discussion options

You must be logged in to vote

Finally the end of this mini-nightmare. I hope the thread will help others.

When i install the debugbar, i notice a large number of "GATE" request, because in the ->addColumn i use 3 checks permissions (spatie) , if user @can('xxxx') for 3 buttons (view, edit, delete) - so every line , 3x Gate Requests where made.

Solution : before datatables init -> check only one time the permissions of the user... and use the same logic for every line, but using a local variable with the roles of the current user, because before : 3x Gate Calls @can('xxxx') where made per line ( i think equals 3 queries extra per line ), in 2500 records... imagine the lag.

Thanks for all the help and the support.

Replies: 16 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@yajra
Comment options

Answer selected by yajra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2496 on December 10, 2020 03:16.