ssquare
1 year ago

Laravel Execute Stored procedure taking more time than from SSMS

Posted 1 year ago by ssquare

I am using laravel 5.6 and MSSQL as database. I have table with records more than 100m+ rows. So whenever I execute a stored procedure through SSMS it takes around 1 sec but if I execute it through laravel execute it, this query time increases by 7-8 times.

My laravel code here looks like:


        $time_start2 = microtime(true);

        $posts = DB::select('EXEC [spBaseVoterIndex] ?,?,?,?',
                [
                    $order, $dir, (int)$pagenum, (int)$pagesize
                ]);
        
        $time_end2 = microtime(true);
        $execution_time2 = $time_end2 - $time_start2;

Is there any way to know what is Laravel doing it in the back or could anyone explain about the background stuffs included here. What might be taking the time and how can I minimize it.

Please sign in or create an account to participate in this conversation.