Доброго дня, светлые головы.
В adminer простой запрос к таблице на 19 строк занимает 0,003сек, в Laravel 1.54сек - это нормально? Я понимаю, за удобство надо платить, но в 1000 раз?! Что-то я недопонимаю.
Win 8.1, WAMP
SELECT * FROM `events` WHERE `key_id` = '89'
--4 строки (0.003 s)
namespace App\Http\Controllers;
use App\Event;
use App\Http\Resources\Event as EventResource;
use App\Key;
use Illuminate\Http\Request;
class EventsController extends Controller
{
public function index($key_id)
{
$events = Event::where('key_id', $key_id)->orderBy('date', 'desc')->get();
return EventResource::collection($events);
}
<...>
}
// 1.5 - 2 sec
Insomnia GET laravel/api* Preparing request to http://api-laravel.local/api/events/89
* Using libcurl/7.51.0-DEV OpenSSL/1.0.2j zlib/1.2.8 libssh2/1.6.1_DEV
* Enable automatic URL encoding
* Enable SSL validation
* Enable cookie sending with jar of 2 cookies
* Connection 6 seems to be dead!
* Closing connection 6
* Hostname api-laravel.local was found in DNS cache
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to api-laravel.local (127.0.0.1) port 80 (#7)
> GET /api/events/89 HTTP/1.1
> Host: api-laravel.local
> User-Agent: insomnia/5.16.6
> Accept: */*
< HTTP/1.1 200 OK
< Date: Tue, 21 Aug 2018 13:44:17 GMT
< Server: Apache/2.4.27 (Win64) PHP/7.1.9
< X-Powered-By: PHP/7.1.9
< X-Xdebug-Profile-Filename: d:\wamp\bin\php\php7.1.9\zend_ext\cachegrind.out.60236
< Cache-Control: no-cache, private
< X-RateLimit-Limit: 60
< X-RateLimit-Remaining: 57
< Content-Length: 1206
< Content-Type: application/json
* Received 1206 B chunk
* Curl_http_done: called premature == 0
* Connection #7 to host api-laravel.local left intact