Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 16
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: 1243
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: 1784
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 Confusion b/w index and subscript Deepak kumar25 Mainframe Interview Questions 7 Thu Aug 31, 2017 6:50 am
No new posts Sorting on text - but in non-alphabet... Roy Ware SYNCSORT 5 Wed Aug 23, 2017 9:15 pm
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
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

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us