Speed ​​difference between native OLE DB and ADO.NET

I am looking for suggestions, as well as any reference points or observations that people have. We strive to rewrite our level of data access and try to decide between C ++ OLEDB or ADO.NET to connect to databases. We are currently specifically targeting Oracle, which means that we will use the Oracle OLE DB provider and ODP.NET.

Requirements: 1. All applications will be in managed code, so using the native C ++ OLEDB will require C ++ / CLI (there is no PInvoke way to slow down). 2. In the future, the application should work with several databases, while mainly for Oracle.

Question: 1. Would it be more appropriate to use ADO.NET to accomplish this, or use the built-in C ++ OLE DB wrapped in a managed C ++ interface for accessing managed code?

Any ideas, or help, or places to search the Internet would be greatly appreciated.

+4
source share
1 answer

I don’t think it is possible to give one answer that is usually applicable in this situation, given the fact that you want a general solution that is more than just Oracle. The problem is that the provider of one .NET provider may be faster than the OLE DB provider, and vice versa for another provider. The architecture of both of these data access technologies is significantly different.

I have a feeling that the differences in speed will not be so big. Since it looks like you will place your own data access layer on top of OLE DB, it is difficult to compare directly until you have written it. But, as a rule, any data modification operator (for example, UPDATE mytable set ...) will probably not be so different in both cases. When using both technologies, you specify the parameter data, if necessary, and then send the command to the server. The bulk of the cost is likely to be network latency and server runtime. The biggest difference probably comes into play when reading datasets.

Reading data will be a factor that can show the difference in speed. Depending on what you plan, you may read the data at a low level. For example, with OLE DB you can call IRowset :: GetNextRows. With .NET, you could read data through DbDataReader :: Read (). I don’t know if this is typical, but in the code I was working on, the OLE DB method GetNextRows () was much more complicated than the .NET Read () implementation. I'm not sure if this necessarily translates into slower execution ... but it could be.

In my opinion, the best choice would be to use ADO.NET. Because this is Microsoft's current data access technology, I suspect that providers will update their .NET provider more often than the OLE DB provider. Therefore, if there are performance problems in the implementation, the .NET provider will most likely be fixed until their OLE DB provider can be fixed so quickly (or in general). In addition, you get much more flexibility with the .NET provider if you need it (for example, an entity infrastructure). If you want OLE DB you need to use the .NET provider for OLE DB providers, which is another layer on top of OLE DB (it is assumed that it even works, which I don’t know).

+1
source

Source: https://habr.com/ru/post/1306194/


All Articles