简体   繁体   English

本机与ODBC数据库连接

[英]Native vs ODBC database connections

I understand that some databases have native support in R (eg MySQL) but you can connect to other DBs like MS SQL Server using RODBC. 我知道有些数据库在R(例如MySQL)中有本机支持,但您可以使用RODBC连接到其他数据库,如MS SQL Server。 How much speed improvement does one gain for reading/writing with the native drivers vs. RODBC? 使用本机驱动程序与RODBC进行读/写操作可以提高多少速度? What other DBs have native drivers in R? R中有哪些其他DB有本机驱动程序? Is reading faster or slower than writing generally? 阅读速度是否比一般写作更快或更慢?

If you're specifically interested in SQL Server, the reference below is a little bit out of date but I imagine it probably still holds. 如果您对SQL Server特别感兴趣,下面的参考文章有点过时,但我想它可能仍然存在。

Using ODBC with Microsoft SQL Server 将ODBC与Microsoft SQL Server一起使用

Performance of ODBC as a Native API ODBC作为Native API的性能

One of the persistent rumors about ODBC is that it is inherently slower than a native DBMS API. 关于ODBC的一直谣言是它本身比原生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. 这种推理基于以下假设:必须将ODBC驱动程序实现为本机DBMS API上的额外层,将来自应用程序的ODBC语句转换为本机DBMS API函数和SQL语法。 This translation effort adds extra processing compared with having the application call directly to the native API. 与将应用程序直接调用到本机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. 对于通过本机DBMS API实现的某些ODBC驱动程序,这种假设是正确的,但Microsoft SQL Server ODBC驱动程序不是以这种方式实现的。

The Microsoft SQL Server ODBC driver is a functional replacement of DB-Library. Microsoft SQL Server ODBC驱动程序是DB-Library的功能替代品。 The SQL Server ODBC driver works with the underlying Net-Libraries in exactly the same manner as the DB-Library DLL. SQL Server ODBC驱动程序以与DB-Library DLL完全相同的方式使用底层Net-Libraries。 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 SQL Server ODBC驱动程序不依赖于DB-Library DLL,如果客户端上甚至不存在DB-Library,则驱动程序将正常运行。

Microsoft's testing has shown that the performance of ODBC-based and DB-Library–based SQL Server applications is roughly equal. 微软的测试表明,基于ODBC和基于DB库的SQL Server应用程序的性能大致相同。

  • It's an empirical question, so why don't measure it for the combination you are interested in? 这是一个经验问题,那么为什么不为你感兴趣的组合测量呢?
  • Public code is not hidden, so why don't you count what other DB interfaces CRAN has? 公共代码没有隐藏,那你为什么不算一下CRAN的其他数据库接口呢? For DBI alone, we have SQLite, MySQL, Postgresql, Oracle; 仅对于DBI,我们有SQLite,MySQL,Postgresql,Oracle; for custom db backends there are things like Vhayu. 对于自定义数据库后端,有像Vhayu这样的东西。
  • Specialised forums exist, so why don't you ask on r-sig-db? 存在专业论坛,为什么不问r-sig-db?
  • Lastly, as soon as there is an API and a need people tend to combine the two. 最后,只要有API并且需要人们倾向于将两者结合起来。 I have written two different (at-work and hence unreleased) packages to two highly specialised and fast backends. 我已经为两个高度专业化和快速后端编写了两个不同的(工作中未发布的)软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM