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: 24
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: 1348
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: 2588
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 choice of clustering index DB2 3
No new posts Secondary index error while loading d... IMS DB/DC 2
No new posts Combining more 4 files with sorted or... DFSORT/ICETOOL 3
No new posts how to show listing in physical locat... PL/I & Assembler 2
No new posts DFSORT Output file order query DFSORT/ICETOOL 2
Search our Forums:

Back to Top