使用PostgreSQL外部数据包装器从SQL Server查询数据时出现数据量问题

时间:2014-07-11 18:41:31

标签: sql-server postgresql ubuntu-12.04 freetds

有人在我的工作场所设置了一个服务器,允许我们的Postgres服务器使用外部数据包装器从我们的MS SQL服务器提取数据,如下所示: https://github.com/GeoffMontee/tds_fdw

它工作得非常酷,直到我们尝试在10,000s中提取或查询大量记录。 Postgres就是把我们踢出去,就像这样:

apitransform=# select count(*) from fdw_ThingInstance;
NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 2, Msg: Changed database context to 'master'., Server: abcdefg, Process: , Line: 1, Level: 0
NOTICE:  DB-Library notice: Msg #: 5703, Msg state: 1, Msg: Changed language setting to us_english., Server: abcdefg, Process: , Line: 1, Level: 0
NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 1, Msg: Changed database context to 'abcdefg_staging'., Server: abcdefg, Process: , Line: 1, Level: 0
NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 2, Msg: Changed database context to 'master'., Server: abcdefg, Process: , Line: 1, Level: 0
NOTICE:  DB-Library notice: Msg #: 5703, Msg state: 1, Msg: Changed language setting to us_english., Server: abcdefg, Process: , Line: 1, Level: 0
NOTICE:  DB-Library notice: Msg #: 5701, Msg state: 1, Msg: Changed database context to 'abcdefg_staging'., Server: abcdefg, Process: , Line: 1, Level: 0
The connection to the server was lost. Attempting reset: Succeeded.

我们在填写记录方面遇到了麻烦,因为感觉好像其中一个系统强加了硬限制。

一个线索是,当FreeTDS设置为4.2时,我们能够大致正常查询,或者至少能够计算记录。但是,我们遇到了UTF字符编码问题。因此,我们将其设置为7.0和8.0,这解决了UTF问题,但现在我们可以限制一次拉出多少,并且限制是不可预测的并经常打破。

有谁知道这笔交易是什么?它只是一个小地方吗?

1 个答案:

答案 0 :(得分:0)

尝试使用'初始块大小'在freetds.conf中的参数,我在5120中设置了这个参数,有时甚至更大。 看到 http://www.freetds.org/userguide/seemtooslow.htm