Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Order BY AND Index

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Nileshkul

New User


Joined: 09 May 2016
Posts: 15
Location: India

PostPosted: Sat Dec 31, 2016 6:33 pm    Post subject: Order BY AND Index
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: 1230
Location: Israel

PostPosted: Sun Jan 01, 2017 8:42 pm    Post subject: Reply to: Order BY AND Index
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

Senior Member


Joined: 21 Sep 2010
Posts: 1717
Location: NY,USA

PostPosted: Thu Jan 05, 2017 1:03 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Several errors during building altern... Andi1982 JCL & VSAM 11 Wed Jul 06, 2016 7:39 pm
No new posts Drop building Alternate Index for a p... bhavin.mehta JCL & VSAM 6 Mon Jul 04, 2016 3:47 pm
No new posts VSAM Alternate Index in CICS jacobdng CICS 2 Fri May 06, 2016 1:41 pm
No new posts Rebuilding IMS secondary index withou... Hooman24 IMS DB/DC 6 Tue Mar 29, 2016 12:22 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us