MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Query performance

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
satyenderd
Beginner


Joined: 26 Aug 2005
Posts: 144
Topics: 73

PostPosted: Mon Jul 21, 2008 7:50 pm    Post subject: Query performance Reply with quote

Hi all,

I have to unload the table which is containing around 750 million data.
When I am running the following query it is taking lot of time.
Could anyone suggest the simples query to extract the data?

Thanks in advance.


herein is the query.

SELECT *
FROM table1
WHERE RID IN
(SELECT RID
FROM table2
WHERE RDNDTE IN
(SELECT RDNDTE
FROM table3
WHERE DATE(RDNDTE) >= CURRENT DATE - 5 YEARS;
_________________
Satya
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Tue Jul 22, 2008 9:25 am    Post subject: Reply with quote

satyenderd,
First run your inner query and pass these results to outer query as input.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Jul 22, 2008 10:34 am    Post subject: Reply with quote

satyenderd,

You are scanning 750 mil table and you expect it to run fast?

you can try this sql (untested)
Code:

SELECT A.*
  FROM TABLE1  A
      ,TABLE2  B
      ,TABLE3  C
 WHERE A.RID           = B.RID
   AND B.RDNDTE        = C.RDNDTE
   AND DATE(C.RDNDTE) >= CURRENT DATE - 5 YEARS
Back to top
View user's profile Send private message Send e-mail Visit poster's website
satyenderd
Beginner


Joined: 26 Aug 2005
Posts: 144
Topics: 73

PostPosted: Tue Jul 22, 2008 12:33 pm    Post subject: Reply with quote

Kolusu,

Million thanks once again.

This Forum made my life easy.
_________________
Satya
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group