Duplicate session query On every page i've this duplicate session query, and i dont know where to start looking for the problem. Any suggestions?
select * from `sessions` where `id` = 'ZGtPxAAAlFsMcZOC4OXnwRRX8n8gf9uWsqeefjoP' limit 1
update `sessions` set `payload` = `sdffbbblablablverylong`
select * from `sessions` where `id` = 'ZGtPxAAAlFsMcZOC4OXnwRRX8n8gf9uWsqeefjoP' limit 1
Either use something like:
\Illuminate\Support\Facades\Event::listen(\Illuminate\Database\Events\QueryExecuted::class, function (\Illuminate\Database\Events\QueryExecuted $query) {
var_dump($query);
});
Or install laravel-debugbar or maybe even telescope. You can see every query where it originated from.
I found this because i have installed the debugbar. So i see the duplicate query, but i dont know where to start for the fix.
It says besides the query where it was executed from.
You mean this:
163ms \vendor\laravel\framework\src\Illuminate\Session\DatabaseSessionHandler.php:91
You mean this: 163ms \vendor\laravel\framework\src\Illuminate\Session\DatabaseSessionHandler.php:91
Yeah, wasn't there a way to expand that and see where did it originate from?
@michaloravec What does that mean? In my case it's always the first and the last query when i look at the debugbar.
And just before the last query there is an update sessions that sets a payload. Thats probably why the last one causes the duplicate one. So this might not be a problem? Is that right?
It means that in your app use database driver for session and you use it to store some informations. No, it's not a problem. Don't worry.
Question is are you using session() anywhere in the code?
Please sign in or create an account to participate in this conversation.