SQL Performance (MOSC)

MOSC Banner

db link issue

edited Sep 1, 2015 6:54AM in SQL Performance (MOSC) 6 commentsAnswered

Hi,

I got an issue about db link, please help!

The belowing sql 1 takes more than 10 min, but sql 2 only needs about 20 sec.

--sql 1----------

with with_table as (

select person_id,attribute1,in_date from person_table@dblink1 t1

union all

select person_id,attribute1,in_date from person_table@dblink2 t2

)

select cp_list.attribute1,sys_in.person_num,yes_in.person_num

from

(select distinct attribute1 from with_table) cp_list,

(select attribute1,count(person_id) person_num from with_table where in_date=trunc(sysdate) group by attribute1) sys_in,

(select attribute1,count(person_id) person_num from with_table where in_date=trunc(sysdate)-1 group by attribute1) yes_in

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center