简体   繁体   English

有没有一种方法可以提高sql server和DB2之间的ODBC连接速度?

[英]is there a way to improve the speed of the ODBC connection between sql server and DB2?

I ran this query on my sql server 我在我的sql服务器上运行了此查询

SELECT A.[STCOMP]
    ,A.[STDATE]
    ,A.[STUNM]
    ,A.[STQTY]
    ,A.[STWWAY]
    ,A.[STVOID]
    ,A.[STMATR]
    ,A.[STTCKT]
    ,C.[RWDESC]
    ,A.[STDESC]
    ,A.[STLNDF]
    ,B.[CSLNAM]
    ,B.[CBLNAM]
    ,D.[CVAR6]
FROM [EPAK].[B00BF4CR].[IWSE4S8].[SCTRN] AS A
INNER JOIN [EPAK].[B00BF4CR].[IWSE4S8].[CUST] AS B ON A.[STNCST] = B.[CMSTC#]
    AND A.[STNCMP] = B.[CMSTCO]
    AND A.[STCOMP] = B.[CCMPNY]
    AND A.[STCUST] = B.[CCUST#]
INNER JOIN [EPAK].[B00BF4CR].[IWSE4S8].[SCRWC] AS C ON C.[RWRESW] = A.[STRWC]
    AND C.[RWCOMP] = A.[STCOMP]
INNER JOIN [EPAK].[B00BF4CR].[IWSE4S8].[CUSX] AS D ON A.[STCOMP] = D.[CCMPNY]
    AND A.[STCUST] = D.[CCUST#]
WHERE (
        A.[STDATE] = 20140211
        AND A.[STVOID] = 'N'
        )
ORDER BY A.[STTCKT]

the data is for one day only, it returned me 3000 records, but took 52 minutes to do that. 数据仅一天,它返回了我3000条记录,但花了52分钟才完成。 That query is pulling data between a linked DB2 server using odbc connection and my sql. 该查询正在使用odbc连接在链接的DB2服务器和我的sql之间提取数据。

You can create a view in DB2 in which includes all the joins and selections. 您可以在DB2中创建一个视图,其中包含所有联接和选择。

You then simply query this view over the ODBC connection. 然后,您只需通过ODBC连接查询此视图。

The problem is that the ODBC link is very slow, and, returns one row at a time. 问题在于ODBC链接非常慢,并且一次返回一行。 You should do everything you can to minimize the amount of data that is sent over the link. 您应该尽一切可能使通过链接发送的数据量最小化。

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

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