aspose file tools
The moose likes JDBC and Relational Databases and the fly likes Subselect runs fast, outer query doesn't Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Subselect runs fast, outer query doesn Watch "Subselect runs fast, outer query doesn New topic
Author

Subselect runs fast, outer query doesn't

Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9055
    
  12

I killed this query after 543 seconds. However, the inner select (select #2) runs in about 7 seconds. It returns 836 records and the RU_METRIC_DET table contains 2597374 records where DETAIL_ID is a primary key.

What I really want to do is a delete from RU_METRIC_DET (i.e. replace select #1 with a delete), which is why I need the outer select.

Can someone help me out with a suggestion?
[ October 18, 2008: Message edited by: Marilyn de Queiroz ]

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

does DETAIL_ID on the outer table have an index?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9055
    
  12
Oops. I found the problem. I was using the wrong table on the outer select

Sorry to have bothered you all.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Subselect runs fast, outer query doesn't