N+1 Queries Detector
The N+1 problem occurs when data is retrieved from a database and then loops through the result of that data. In this manner the database is called again and again.
The database will be called once for every row returned by the first query (N) plus the original query (+1). This will slow your application immensely when working with a lot of data.
This module is created for the tackling of the N+1 problem. It offers the logging and alerting of detected N+1 queries that slow your application.
Getting started
To install this module
composer require qore/query-detector
php artisan vendor:publish --tag=qore.query-detector.frontend
Register the QueryDetectorServiceProvider in your AppServiceProvider:
AppServiceProvider.php
$this->app->register(QueryDetectorServiceProvider::class);
Add n1_query_detected to your exposed headers in Cors.php
cors.php
'exposed_headers' => ['Queries-Detected'],
Upgrade Guide
To upgrade this module:
composer update qore/query-detector
For the Vue components use:
php artisan vendor:publish --tag=qore.query-detector.frontend --force