Support ability to sort queries by alphabetical order#1669
Support ability to sort queries by alphabetical order#1669AlexJump24 wants to merge 2 commits intofruitcake:masterfrom
Conversation
|
Wouldn't this affect the waterfall timeline? |
I've given this a quick test and the timeline appears to be the same, I may be missing something though 👍🏼 |
|
I mean, each query have startTime/endTime, the graph is generated based on that, if the order is changed, there would no longer be a waterfall. |
|
php-debugbar/php-debugbar#410
|
I think this can't happen as the sort doesn't affect the start time/end time and in the TimeDataCollector there the waterfall order is driven via the usort that sorts via the start time https://github.com/maximebf/php-debugbar/blob/master/src/DebugBar/DataCollector/TimeDataCollector.php#L228 |
https://github.com/barryvdh/laravel-debugbar/blob/bae4b221e725c52deffceb9fe537928b210c9921/src/DataCollector/QueryCollector.php#L480 I didn't mean that, but never mind, I'm not the one who does the merges anyway. It seems that you have not used the timeline option in QueryCollector, set |
|
Not 100% sure what you are trying to say still but now I realise it makes no sense to keep doing it on the Thanks. |
|
When you say "timeline", you are looking at Timelime Tab? or at The Queries Tab? |
I see what you mean now thanks I had never even realised that was a thing on there! Yeah you are correct it is affected on there, although I guess that would be expected in this context if you changed the sort. Would the waterfall be needed if sorted, as you said I was looking at the timeline tab where it is still visible. If not resolvable no problem I will just tweak things when I require but thought it would be a useful potential feature even if my implementation doesn't end up being suitable. |
|
Also there is database events, like https://github.com/barryvdh/laravel-debugbar/blob/bae4b221e725c52deffceb9fe537928b210c9921/src/DataCollector/QueryCollector.php#L441-L454 |
|
I have sorting on duration in the beta. Might make more sense to filter by a query or something? |

Hello,
In a previous PR meant to thank you for the brilliant package that has been so useful over the years!
I'm putting in this PR in the hope it will be useful to help resolve a problem I've been facing when looking through the queries tab on the debugbar to debug duplicate N+1 queries. On the particular project I was debugging there were a lot of duplicates and I was finding it difficult to determine which queries were appearing the most as duplicates and how many there were of them.
So I had an idea to maybe support the ability of sorting the queries collector by a custom sort, in this case alphabetical order. Testing this help really helped me quickly identify which queries were having the most N+1 issues.
A few thought processes I had.
Hopefully this is something that is suitable to add into the package as I think it would add a lot of value debugging and as previously mentioned open scope to sorting in order ways.
Cheers.