我知道某些数据库在 R 中具有原生支持(例如 MySQL),但您可以使用 RODBC 连接到其他数据库,例如 MS SQL Server。使用 native 驱动程序与 RODBC 相比,读取/写入速度提高了多少?还有哪些其他数据库在 R 中具有 native 驱动程序?一般来说,阅读比写作快还是慢?
最佳答案
如果您对 SQL Server 特别感兴趣,下面的引用资料有点过时了,但我想它可能仍然有效。
Using ODBC with Microsoft SQL Server
Performance of ODBC as a Native API
One of the persistent rumors about ODBC is that it is inherently slower than a native DBMS API. This reasoning is based on the assumption that ODBC drivers must be implemented as an extra layer over a native DBMS API, translating the ODBC statements coming from the application into the native DBMS API functions and SQL syntax. This translation effort adds extra processing compared with having the application call directly to the native API. This assumption is true for some ODBC drivers implemented over a native DBMS API, but the Microsoft SQL Server ODBC driver is not implemented this way.
The Microsoft SQL Server ODBC driver is a functional replacement of DB-Library. The SQL Server ODBC driver works with the underlying Net-Libraries in exactly the same manner as the DB-Library DLL. The Microsoft SQL Server ODBC driver has no dependence on the DB-Library DLL, and the driver will function correctly if DB-Library is not even present on the client.
Microsoft's testing has shown that the performance of ODBC-based and DB-Library–based SQL Server applications is roughly equal.
关于database - native 与 ODBC 数据库连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1169330/