PHP code:
... $query = "exec DBNAME.dbo.STOREDProcedureNAME ".$params.""; $result = mssql_query( $query ); ... ASP.NET code:
... using (SqlConnection SqlCon = new SqlConnection(WebConfigAppSettings.Current.DBLink)) { using (SqlCommand SqlCmd = new SqlCommand("STOREDProcedureName, SqlCon)) { SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.CommandTimeout = 0; SqlCon.Open(); SqlCommandBuilder.DeriveParameters(SqlCmd); SqlParameterCollection Param = SqlCmd.Parameters; ..here stored procedure parameters set ... SqlDataReader reader = SqlCmd.ExecuteReader(); grid.DataSource = reader; grid.DataBind(); } } ... Searches on the Internet gave the following :
ASP will probably never be as fast as PHP. It is a built-in COM-based architecture. When he accesses a database, he uses another COM object to do so. When he accesses the file system, another COM object is called. All this COM overhead adds up and slows things down. In PHP modules, everything runs in PHP's memory space. This will make it easier for you to run the code.
The following benchmark is where you can use the SQL Server 7 using the PHP MSSQL7 extension, the php ODC extension, and the following: Using a COM interface to connect it adds 80% overhead (17.28 secs) to ODBC. OLEDB is Microsoft's high speed COM technology for accessing databases. It is faster than ODBC, but we can use the PHP MSSQL extension we get a 200% increase in performance. So just tell a ASP programmer: No COM more speed.
The essence of the problem is the following: one and the same stored procedure runs for the same length when it is called from both the SCUL studio and from an application on ASP.NET.
And when you call it from PHP, the time to get results is reduced by 2-2.5 times.
The procedure is time consuming. All that you can already optimized.
Runtime - 40-45 seconds from the studio and ASP.NET applications and 15-20 seconds when calling from php.
Has anyone had experience getting the same speed of sql queries in ASP.NET as in PHP?