Answer the question
In order to leave comments, you need to log in
Laravel simple request takes a long time to load, what's wrong?
Hello. I looked at the debug bar and saw that a request to receive 3 records is loaded in 4 seconds:
$feature = DB::table('news')
->where([
['published', '=', true],
['time', '>', DB::raw('NOW()')]
])
->limit(3)
->orderBy('time', 'asc')
->get();
Answer the question
In order to leave comments, you need to log in
If you're on Windows, then it's possible. I also had a situation where the pages of a site on Windows (under OpenServer) loaded in 3–4 seconds precisely because of long queries to MySQL. Everything was ok in production.
For the sake of experiment, you can deploy it on a separate server somewhere and check it out (not in production). Yes, you have to work hard and deploy.
You can check your version and list the required fields in the request, but I think that's not the point.
The request itself is not super complex and does not even pull explicitly for a second. 50 records is practically nothing. Even 10 thousand for a normal request is a miserable amount. Dig towards the speed of MySQL itself or the connection between the application and the database. Database and site local?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question