title: Delphi with SQL Server: OLEDB vs. Native Client drivers
body: <p>I have been told that SQL Native Client is <em>supposed</em> to be faster than the OLEDB drivers. So I put together a utility to do a load-test between the two - and am getting mixed results. Sometimes one is faster, sometimes the other is, no matter what the query may be (simple select, where clause, joining, order by, etc.). Of course the server does the majority of the workload, but I'm interested in the time it takes between the data coming into the PC to the time the data is accessible within the app.</p>
  
  <p>The load tests consist of very small queries which return very large datasets. For example, I do <code>select * from SysTables</code> and this table has 50,000+ records. After receiving the data, I do another load of looping through the results (using while not <code>Q.eof ... Q.next ...</code> etc.). I've also tried adding some things to the query - such as <code>order by Val</code> where <code>Val</code> is a <code>varchar(100)</code> field.</p>
  
  <p>Here's a sample of my load tester, numbers on very bottom are averages...</p>
  
  <p><img src="https://i.stack.imgur.com/jffk0.png" alt="enter image description here"></p>
  
  <p>So really, what are the differences between the two? I do know that OLE is very flexible and supports many different database engines, whereas Native Client is specific to SQL Server alone. But what else is going on behind the scenes? And how does that affect how Delphi uses these drivers?</p>
  
  <p>This is specifically using ADO via the <code>TADOConnection</code> component and <code>TADOQuery</code> as well.</p>
  
  <p><strong>I'm not necessarily looking or asking for ways to improve performance - I just need to know what are the differences between the drivers.</strong></p>