Performanceproblem with subquery to Oracle Linked Server

From: Christian Mersch (Mersch_at_discussions.microsoft.com)
Date: 02/11/05


Date: Thu, 10 Feb 2005 23:23:01 -0800

Hello

I hope anyone can help me here with a Problem between my Microsoft SQL
Server 2000 SP 3 and an Oracle 8 Server. I have to copy records from a Oracle
table (3.000.000 records by now) to a SQL Server table (8.000.000 records by
now) daily (somthing like an incremental backup). The Oracle Server is
configured as Linked Server and I use the following SQL statement to do this:

INSERT INTO CALLDETAIL
(CALL_TYPE,TRANS_TYPE,DISPOSITION,....46more fields...)

SELECT CALL_TYPE,TRANS_TYPE,DISPOSITION,....46more fields...
from ORACLE..ACC.CALLDETAIL
WHERE TERM_DATE > (SELECT MAX(TERM_DATE) FROM CALLDETAIL)

The query is placed in a DTS and runs once a day and normally copies between
4000 and 5000 rows. My problem is that the query takes between 90 and 130
minutes but when I use a hardcoded date instead of the subquery it only takes
2 minutes maximum. The subquery itself runs only 1-2 sec. As soon as I dont
use a hardcoded date it takes hours. I tried it by using the Query Analyzer
and placing the date in a int variable to used it instead of the subquery.

declare @datevalue int
set @datevalue = 1050208
SELECT CALL_TYPE,TRANS_TYPE,DISPOSITION,....46more fields...
from ORACLE..ACC.CALLDETAIL
WHERE TERM_DATE > @datevalue

I tried the Microsoft and the Oracle OLEDB Provider without success.
Even the OPENQUERY function hadn't helped because I can't use a dynamic
datevalue within the OPENQUERY function. Has anyone an Idea what I have to do
to improve the performance ?



Relevant Pages

  • Re: I cant find a SETUP.EXE in the SQL Plus Client ??
    ... someone else's server for testing some SELECT statements I'm ... free client because I don't own the Oracle license. ... SQL statements. ... There is no documentation with that download. ...
    (comp.databases.oracle.tools)
  • Re: I cant find a SETUP.EXE in the SQL Plus Client ??
    ... someone else's server for testing some SELECT statements I'm writing for them. ... How do I get a free Oracle client installed, if possible, so I can test some SQL statements. ... There is no documentation with that download. ...
    (comp.databases.oracle.tools)
  • Re: I cant find a SETUP.EXE in the SQL Plus Client ??
    ... someone else's server for testing some SELECT statements I'm writing ... How do I get a free Oracle ... client installed, if possible, so I can test some SQL statements. ... There is no documentation with that download. ...
    (comp.databases.oracle.tools)
  • Re: Exporting and Importing SQL Statement Cache
    ... the SQL Statement Cache in Oracle 8i? ... If we swap servers after a few days the ... new live server gets overloaded. ...
    (comp.databases.oracle.server)
  • Re: Exporting and Importing SQL Statement Cache
    ... the SQL Statement Cache in Oracle 8i? ... If we swap servers after a few days the ... new live server gets overloaded. ...
    (comp.databases.oracle.server)