Yesterday, the apsaradb for Warcraft database of the new project went online for testing. The feedback showed that the skill block was a little slow. After reading it, it was indeed analyzed using eqatec. The results are as follows:
Apparently, the problem occurs in the sqldataprovider. getiteminfo method. Code As follows:
Public iteminfo getiteminfo (INT Itemid)
{
Using (sqlconnection connection = getsqlconnection ())
{
Sqlcommand cmd = new sqlcommand ("proc_item_getmodel", connection );
Cmd. commandtype = commandtype. storedprocedure;
Cmd. Parameters. Add ("@ Itemid", sqldbtype. INT). value = Itemid;
Iteminfo item = NULL;
Connection. open ();
Sqldatareader reader = cmd. executereader ();
If (reader. Read ())
{
Item = loaditeminfofromdatareader (Reader );
}
Reader. Close ();
Reader. Dispose ();
Cmd. Dispose ();
Connection. Close ();
Return item;
}
}
The average time of this method is 84 ms, and the time of the two called methods is less than 1 ms.ProgramI can't optimize the code. I feel the problem is probably in cmd. executereader, that is to say, the problem lies in getting data from the database. However, this stored procedure is very simple, that is, a SELECT statement. Currently, there are more than two million database records.
Where is the problem?