MySQL Forums
Forum List  »  Performance

Re: Reduce the Query Execution Time Between MYSQL & VC++
Posted by: saraswathi srinath
Date: November 14, 2014 10:33PM

  LARGE_INTEGER t1, t2;
  LARGE_INTEGER freq;
  LONGLONG  ms; 
  if( QueryPerformanceFrequency( &freq ) == 0 )
  {
    printf("Your machine not support high resolution performance counter\n");
    return;
  }	

//Bellow Record set Open Query execution time is 320 Milliseconds
recset.Open(CRecordset::forwardOnly,QueryStr,CRecordset::readOnly);
	
//While Loop takes 1.9seconds that is 1945 milliseconds
//Below line Gets Starting Time 
	QueryPerformanceCounter( &t1 );
        while( !recset.IsEOF() )
	{  // Copy each column into a variable
  	   recset.GetFieldValue("PNAME",pname);
	   //m_proname.InsertString(0,pname);			
	   // goto next record
	   recset.MoveNext();
	}	
//Below line Gets End Time 
        QueryPerformanceCounter( &t2 );

      //Calculate Result in Milli Seconds
	ms = (t2.QuadPart - t1.QuadPart) / (freq.QuadPart / 1000);
	//temp.Format("%d",ms);
	//::AfxMessageBox(temp);

While loop takes 2seconds to execute the process.
How can i get the pname with out while loop?

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.