View previous topic :: View next topic
|
Author |
Message |
Nileshkul
New User
Joined: 09 May 2016 Posts: 43 Location: India
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
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 |
|
|
|