DB2

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesDB2

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old May 22nd, 2012, 12:12 AM
cesaralt cesaralt is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 1 cesaralt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 46 sec
Reputation Power: 0
Optimize a Cursor

A table TLDFDDLG has about 4594,244 registers, a cursor is defined as follow:

EXEC SQL
DECLARE CURSORLG CURSOR FOR
SELECT
CLOG,
BLOG,
GLOG,
.
.
.
EYE_DAT
FROM TLDFDDLG
WHERE FSUBIDA = :WS-FSUBIDA
AND NSESION = :WS-XNSESION
AND TIZTRNID = :WS-TIBTRNID
AND CUSERID = :WS-CUSERID
ORDER BY CLOG DESC
END-EXEC.

This cursor is high CPU time consuming. The table TLDFDDLG has the following indexes:
D.LIB.DDL.DB2(TLDTDDLG)

CREATE UNIQUE INDEX I0_TLDFDDLG ON TLDFDDLG
(CLOG, FSUBIDA)
USING STOGROUP GDTLD001 PRIQTY 100 SECQTY 100
ERASE NO BUFFERPOOL BP2 CLOSE YES;

CREATE INDEX I1_TLDFDDLG ON TLDFDDLG
(CUSERID,FSUBIDA,CLOG)
USING STOGROUP GDTLD001 PRIQTY 100 SECQTY 100
ERASE NO BUFFERPOOL BP2 CLOSE YES;
COMMIT;

CREATE INDEX I2_TLDFDDLG ON TLDFDDLG
(FSUBIDA,NSESION,FLOG)
USING STOGROUP GDTLD001 PRIQTY 100 SECQTY 100
ERASE NO BUFFERPOOL BP2 CLOSE YES;
COMMIT;

CREATE INDEX I3_TLDFDDLG ON TLDFDDLG
(TS_PROC)
USING STOGROUP GDTLD001 PRIQTY 100 SECQTY 100
ERASE NO BUFFERPOOL BP2 CLOSE YES;
COMMIT;

CREATE INDEX I5_TLDFDDLG ON TLDFDDLG
(FSUBIDA, CTRANSID)
USING STOGROUP GDTLD001 PRIQTY 100 SECQTY 100
ERASE NO BUFFERPOOL BP2 CLOSE YES;
COMMIT;

CREATE INDEX I6_TLDFDDLG ON TLDFDDLG
(FSUBIDA,CLOG)
USING STOGROUP GDTLD001 PRIQTY 100 SECQTY 100
ERASE NO BUFFERPOOL BP2 CLOSE YES;

CREATE INDEX I7_TLDFDDLG ON TLDFDDLG
(FSUBIDA)
USING STOGROUP GDTLD001 PRIQTY 100 SECQTY 100
ERASE NO BUFFERPOOL BP2 CLOSE YES;

--PRUEBA
CREATE INDEX I4_TLDFDDLG ON TLDFDDLG
(DIASEM ASC)
USING STOGROUP GDTLD001 PRIQTY 100 SECQTY 100
ERASE NO

Do I have to create another index to improve the OPEN Cursor?
How Can I improve the OPEN Cursor

Thanks for any help,

Regards,
Cesar A.

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesDB2 > Optimize a Cursor


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap