Reputation: 3609
I need to run a query on a DB2 database from Oracle via a DB Link.
This query needs to filter the results by date, but I want this to be done remotely, I don't want all the data coming back through the DB Link and then the filtering done locally - this is causing major performance problems.
But I am not sure how to accomplish this because if I just do the filtering straight forward then Oracle wants to filter it locally.
Example:
Select * From DB2_TABLE@DB2_LINK.WORLD
WHERE DATE1 >= SYSDATE -1
AND DATE1 <= SYSDATE
-- AND assume whole bunch of other filtering being done
If I run it like that, I can see via the plan that Oracle is pulling all the data and then filtering it locally afterwards. There must be a way to 'remote' that filtering over to the DB2 side. Any ideas?
Upvotes: 1
Views: 254
Reputation: 3872
Can you create a filtered view in the DB2 database, then query that view from Oracle?
Upvotes: 1