This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Subselect runs fast, outer query doesn't

 
Marilyn de Queiroz
Sheriff
Posts: 9064
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does DETAIL_ID on the outer table have an index?
 
Marilyn de Queiroz
Sheriff
Posts: 9064
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops. I found the problem. I was using the wrong table on the outer select

Sorry to have bothered you all.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic