View previous topic :: View next topic
|
Author |
Message |
Satish5
New User
Joined: 12 Nov 2007 Posts: 38 Location: Texas, USA
|
|
|
|
Q. Suppose there are 2 tables accessed in COBOL program. Records are fetched from first table and then on the bases of those records second table is read. Presently result set for first table contains of 2000 records only. After some time result set for first table grew to 8,000,000 and program started to take long time. How to reduce the execution time. One thing I can think of was using join on key, but i/v guy was looking for some other answer.
Also are there any FAQs avialable to learn complex sql queries.
Thanks,
Satish |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I believe more info is needed . . .
The simple answer is to process less rows somehow. . .
One way to reduce the number of rows processes might be to read the second table first and then read the associated table1 entries.
The question doesn't mention if all 8,000,000 rows are needed, just that they are in the result set. . . |
|
Back to top |
|
|
ashishsr123
New User
Joined: 06 May 2008 Posts: 33 Location: Chennai
|
|
|
|
Hi,
you can seek DBA's help. Ask him to put index's on the column used in query and use index'ed column in where clause( search faster). If this is already there re-building indexes ,would be good ( again DBA).
As for REORG on the table etc.you can RE-BIND also.
But all this DBA stuff.
If we have the query in our hand..may query can be optmized too.
That's what i could think of. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
you can seek DBA's help. |
A good idea on the job, but i suspect that is not what the interviewer was looking for. . . |
|
Back to top |
|
|
|