IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

select command - what's the best performance?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jctgf
Currently Banned

Active User


Joined: 04 Nov 2006
Posts: 109

PostPosted: Sun Dec 16, 2007 7:45 pm
Reply with quote

Hi there,

I would like execute a select that will generate a cursor with 1000 rows.

I want to skip the first 600 rows and process only the last 400.

I have 2 ways to implement it:

1) I can skip the first 600 rows through my SELECT command:

In this case, my cursor would have only the 400 rows I actually want and my COBOL program would fetch only 400 rows.

My SELECT command is the one that will have the duty to discard the rows I don’t want.

There will be some SCAN in order to accomplish the task. The access plan IS NOT only by an index.

2) My COBOL program can also simply fetch all 1000 rows and bypass the first 600 I don’t want to process:

There will be NO scan.

The access plan IS ONLY by an index.

Which solution provides the best performance?

Thanks,
JC
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Sun Dec 16, 2007 10:41 pm
Reply with quote

Try it both ways and see. The scan may not be that bad if the table(s) is/are small. If they are large though the select of 1000 and skip to 601 would probably be faster.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Routing command Address SDSF to other... TSO/ISPF 2
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts LTJ command CA Products 4
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top