SDAC performance vs ADO

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mattschneider
Posts: 2
Joined: Thu 06 Jun 2013 14:17

SDAC performance vs ADO

Post by mattschneider » Thu 06 Jun 2013 14:36

Hi,

I'm pretty new to SDAC and trying to move some old ADO code to SDAC. While doing this, I noticed that ADO performed faster when doing inserts in the db.

This is the old ADO code:

Code: Select all

_ConnectionPtr pConn( "ADODB.Connection" );
pConn->Open( connectString, "", "", 0 );
_RecordsetPtr pRs;
HRESULT hr = pRs.CreateInstance(__uuidof(Recordset));
pRs->Open( "select * from MyTable", pConn.GetInterfacePtr() , adOpenForwardOnly, adLockOptimistic, adCmdUnknown) ;
for (int i = 0; i < 100; i++)
{
    hr = pRs->AddNew();
    // here we set the record fields
    getRecord(pRs);
    pRs->Update();
}
pRs->Close();
And this is my new code using SDAC:

Code: Select all

TMSConnection connection = new TMSConnection(NULL);
connection->ConnectString = connectString;
connection->Connected = true;

TMSQuery* query = new TMSQuery(NULL);
query->Connection = connection;
query->SQL->Text = "select * from MyTable";
query->Open();

for (int i = 0; i < 100; i++) {
{
  	query->Append();
	WriteToDb(query, wstrl.at(i).c_str(), "ASVResult");
	query->Post();
}
query->Free();
It shows that ADO call pRs->Update() is much faster than SDAC call query->Post().
Any ideas what might be the reason for this?

thanks,
Matt

AndreyZ

Re: SDAC performance vs ADO

Post by AndreyZ » Fri 07 Jun 2013 07:07

Hello,

Please try creating a small sample to demonstrate the problem and send it to andreyz*devart*com, including the script to create the MyTable table. Also please specify the following:
- the exact version of your IDE;
- the exact version of SDAC. You can learn it from the About sheet of TMSConnection Editor;
- the exact version of SQL Server server and client. You can learn it from the Info sheet of TMSConnection Editor.

mattschneider
Posts: 2
Joined: Thu 06 Jun 2013 14:17

Re: SDAC performance vs ADO

Post by mattschneider » Mon 17 Jun 2013 11:52

Hi,

thanks for your response.
Creating a sample application will not be that easy and would take quite some time.

The main difference I see is that ADO program uses the paramters adOpenForwardOnly, adLockOptimistic and adCmdUnknown in the Open call. I couldn't find similar settings in SDAC, and maybe this causes the slower execution?

thanks,
Matt

AndreyZ

Re: SDAC performance vs ADO

Post by AndreyZ » Wed 19 Jun 2013 07:28

Please send me the sample project that demonstrates the performance problem. In this case, I will be able to investigate this problem and give you a valid answer.

Post Reply