本机与 ODBC 数据库连接

发布于 2024-07-29 01:52:35 字数 153 浏览 3 评论 0原文

据我了解,某些数据库在 R 中具有本机支持(例如 MySQL),但您可以使用 RODBC 连接到其他数据库,例如 MS SQL Server。 与 RODBC 相比,使用本机驱动程序的读/写速度能提高多少? 还有哪些其他数据库在 R 中具有本机驱动程序? 一般来说,阅读比写作快还是慢?

I understand that some databases have native support in R (e.g. MySQL) but you can connect to other DBs like MS SQL Server using RODBC. How much speed improvement does one gain for reading/writing with the native drivers vs. RODBC? What other DBs have native drivers in R? Is reading faster or slower than writing generally?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陈甜 2024-08-05 01:52:35

如果您对 SQL Server 特别感兴趣,下面的参考资料有点过时,但我想它可能仍然适用。

将 ODBC 与 Microsoft SQL Server 结合使用

ODBC 作为本机 API 的性能

关于 ODBC 的持续谣言之一是它本质上比本机 DBMS API 慢。 此推理基于以下假设:ODBC 驱动程序必须作为本机 DBMS API 上的额外层实现,将来自应用程序的 ODBC 语句转换为本机 DBMS API 函数和 SQL 语法。 与应用程序直接调用本机 API 相比,此转换工作增加了额外的处理。 对于通过本机 DBMS API 实现的某些 ODBC 驱动程序来说,这种假设是正确的,但 Microsoft SQL Server ODBC 驱动程序不是以这种方式实现的。

Microsoft SQL Server ODBC 驱动程序是 DB-Library 的功能替代品。 SQL Server ODBC 驱动程序与底层 Net-Libraries 的工作方式与 DB-Library DLL 完全相同。 Microsoft SQL Server ODBC 驱动程序不依赖于 DB-Library DLL,即使客户端上不存在 DB-Library,该驱动程序也能正常运行。

Microsoft 的测试表明,基于 ODBC 的 SQL Server 应用程序和基于 DB-Library 的 SQL Server 应用程序的性能大致相当。

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.

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.

╭ゆ眷念 2024-08-05 01:52:35
  • 这是一个经验问题,那么为什么不针对您感兴趣的组合来衡量它呢?
  • 公共代码并没有被隐藏,所以为什么不统计一下 CRAN 还有哪些其他 DB 接口呢? 仅就 DBI 而言,我们有 SQLite、MySQL、Postgresql、Oracle; 对于自定义数据库后端,有 Vhayu 之类的东西。
  • 存在专门的论坛,所以为什么不在 r-sig-db 上提问呢?
  • 最后,一旦有 API 和需求,人们就会倾向于将两者结合起来。 我已经为两个高度专业化且快速的后端编写了两个不同的(工作中的,因此未发布的)包。
  • 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? For DBI alone, we have SQLite, MySQL, Postgresql, Oracle; for custom db backends there are things like Vhayu.
  • Specialised forums exist, so why don't you ask on r-sig-db?
  • Lastly, as soon as there is an API and a need people tend to combine the two. I have written two different (at-work and hence unreleased) packages to two highly specialised and fast backends.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文