RpgSQL - 为什么这么慢?
我尝试使用 RpgSQL 从 R 访问我的 PostgreSQL 数据库。
我的数据库非常大,查询也非常复杂。因此我明白我必须稍等一下。
但是,如果我使用 pgAdmin III 作为客户端,查询可能需要 5 秒。当我使用 RpgSQL 时,相同的查询实际上需要很长时间。
我看不出其中的原因,因为服务器而不是客户端必须完成这项工作,对吗?
你能给我一个理由和可能的解决方案吗?
谢谢你!
I try to access my PostgreSQL-database from R using RpgSQL.
My database is very big and the queries are quite sophisticated. Therefore I understand that I have to wait a bit.
However, if I use pgAdmin III as a client, a query takes maybe 5 seconds. When I use RpgSQL the same query literally takes ages.
I can't see the reason for that, as the server and not the client hast to do the work, right?
Can you give me a reason and possibly a solution?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
还有 RPostgreSQL 包
这是积极维护的。由于它直接位于 PostgreSQL API 之上,因此
应该比使用 RODBC 通过 ODBC 更快。
这是我在家保存的数据库中的一个简单示例——它有一千个简单的行
在十分之一秒内:
There is also the RPostgreSQL package
which is actively maintained. As it sits directly on top of the PostgreSQL API, it
should be faster than going via ODBC with RODBC.
Here is a quick example from a database I keep at home---it gets a thousand simple rows
in a tenth of a second: