Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Dhaval_patel's avatar

How to get fast response from Laravel4 query builder

I'm using laravel4.2 and I've used some queries to get the response from MySQL tables. I have around 80k records in specific table sometimes it could be more. I want to know is there any way to get an instant response? I only want to use query builder not eloquent. Thanks in advance laracasts people ;)

0 likes
2 replies
tykus's avatar

You are always going to have some overhead in terms of the framework booting and working, which you cannot avoid. You also will have the actual query time on the database server, which is unavoidable.

There are a number of things you can do to mitigate the response time, including but not limited to optimizing the framework for better performance using php artisan optimize to generate an optimized class loader.

You also can implement caching if it is appropriate to the types of query you are running - this will depend on the nature of the data and whether it is slowly changing relative to query frequency.

Finally, on the database, you should investigate if the query time can be reduced with appropriate use of index on search columns.

1 like

Please or to participate in this conversation.