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

Order BY AND Index


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

New User


Joined: 09 May 2016
Posts: 43
Location: India

PostPosted: Sat Dec 31, 2016 6:33 pm
Reply with quote

I have a db2 table which index is order by time-add field ascending.
The table is queried million times a day using a SQL query having order by time-add descending.The SQL is heavy cpu consuming. Will making index on table as descending to match with sql can save cpu time? We can not change sql query as it is business requirement to have order by descending
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sun Jan 01, 2017 8:42 pm
Reply with quote

Quote:
Will making index on table as descending to match with sql can save cpu time?
Although there is not enough information to give a definite answer, I tend to think that no, it will not change much.

Getting answers to the following questions will give you (and your DBA) a few hints about what can be done:
  • How often do you REORG this table ?
  • How often do you RUNSTATS for this table ?
  • Is the index clustered ?
  • How many rows in the table ?
  • How many rows are fetched by the query ?
  • Is the column TIME-ADD defined as a TIMESTAMP ?
  • Do you have other columns in the WHERE clause ?
  • Did you try to EXPLAIN the query ?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Thu Jan 05, 2017 1:03 am
Reply with quote

You must ask this question to site DBA and get their recommendations as they are ONLY the right people who can give you a real support .
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 Rotate partition-logical & physic... DB2 0
No new posts Cobol file using index COBOL Programming 2
No new posts DL/I status code AK for GU call using... IMS DB/DC 1
No new posts DB2 Load - Sort Or order BY DB2 1
No new posts GDG all in sequence order JCL & VSAM 9
Search our Forums:

Back to Top