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

Alter index vs new index performance


IBM Mainframe Forums -> DB2
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
kanha

New User


Joined: 05 Nov 2005
Posts: 28

PostPosted: Mon Oct 31, 2011 4:12 pm
Reply with quote

To tune a program, I had to add extra columns to 2 of the existing indexes in 2 different tables. I altered the existing indexes & the performance of the program is improved by 50-60%.

However, when I am creating new indexes not to hamper some of the existing application performance, the performance is not improved, rather detoriarated.


EXISTING:Index1 of Table1:
COL1 CHAR(4) ASC

Index1 of table2:
COL1 TIMESTAMP ASC

ALTER INDEX:Index1 of Table1:
COL1 CHAR(4) ASC
COL2 CHAR(8) ASC

Index1 of table2:
COL2 CHAR(8) ASC
COL1 TIMESTAMP ASC

NEW INDEX:Index2 of Table1:
COL1 CHAR(4) ASC
COL2 CHAR(8) ASC

Index2 of table2:
COL2 CHAR(8) ASC
COL1 TIMESTAMP ASC


Can anyone throw some light why this could occur.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Oct 31, 2011 9:20 pm
Reply with quote

Hello,

When you add additional keys, you add additional overhead.

How many keys to create and how they are defined are important considerations. There is no generic "right way" - the number of inserts/deletes and the ways the table will be queried must be considered.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Oct 31, 2011 9:43 pm
Reply with quote

Kanha,

To analyze or even just to look into it, you have provide some SQL query .

Tell us,
After creating new indexes, did the query use the new index ?
And after droping the new index, did the query use the old index and did you get the same performance you got earlier ?

Thanks,
Sushanth
Back to top
View user's profile Send private message
kanha

New User


Joined: 05 Nov 2005
Posts: 28

PostPosted: Tue Nov 01, 2011 2:28 pm
Reply with quote

Yes, the query is using the new indexes.

after dropping the new indexes, the query is using the old indexes & also performing as earlier.

Can't post the query beacuse of security issues. It's a inner join between 2 tables with WHERE clause
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Nov 01, 2011 2:44 pm
Reply with quote

Quote:
Can't post the query because of security issues. ...

then You should not ask for help on a public forum,
and use only the resources of Your organization !
topic locked
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DROP & ALTER PARTITION-PBR DB2 0
No new posts exploiting Z16 performance PL/I & Assembler 2
No new posts Cobol file using index COBOL Programming 2
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts DL/I status code AK for GU call using... IMS DB/DC 1
Search our Forums:

Back to Top