Click here to Skip to main content
15,914,016 members
Home / Discussions / Windows Forms
   

Windows Forms

 
GeneralRe: How to Improve the performance of a database application Pin
Luc Pattyn15-Dec-08 7:06
sitebuilderLuc Pattyn15-Dec-08 7:06 
GeneralRe: How to Improve the performance of a database application Pin
Wendelius15-Dec-08 7:19
mentorWendelius15-Dec-08 7:19 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari15-Dec-08 19:01
Uma Kameswari15-Dec-08 19:01 
GeneralRe: How to Improve the performance of a database application Pin
Dave Kreskowiak15-Dec-08 19:16
mveDave Kreskowiak15-Dec-08 19:16 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari15-Dec-08 19:19
Uma Kameswari15-Dec-08 19:19 
GeneralRe: How to Improve the performance of a database application Pin
Dave Kreskowiak15-Dec-08 20:04
mveDave Kreskowiak15-Dec-08 20:04 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari15-Dec-08 20:54
Uma Kameswari15-Dec-08 20:54 
GeneralRe: How to Improve the performance of a database application Pin
Wendelius16-Dec-08 7:09
mentorWendelius16-Dec-08 7:09 
The are several issues. Lets start with the procedure.

If I interpreted the logic correctly, something like following statements should do the same updates as your procedure:
update gl_sl_cmpr 
set status = 1
WHERE status not in (2,4) 
AND   (  OnAccount = (SELECT sum(SLDr) FROM from gl_sl_cmpr sub1 where sub1.sopno = gl_sl_cmpr.sopno)
      OR OnAccount = (SELECT sum(SLCr) FROM from gl_sl_cmpr sub1 where sub1.sopno = gl_sl_cmpr.sopno))
      OR (   (SELECT sum(SLDr) FROM gl_sl_cmpr sub1 where sub1.sopno = gl_sl_cmpr.sopno) 
         =   (SELECT sum(GLDr) FROM gl_sl_cmpr sub2 where sub2.sopno = gl_sl_cmpr.sopno)
         AND (SELECT sum(SLCr) FROM gl_sl_cmpr sub3 where sub3.sopno = gl_sl_cmpr.sopno) 
         =   (SELECT sum(GLCr) FROM gl_sl_cmpr sub4 where sub4.sopno = gl_sl_cmpr.sopno)))
--
update gl_sl_cmpr 
set status = 6
WHERE status not in (2,4) 
AND   (   OnAccount != (SELECT sum(SLDr) FROM from gl_sl_cmpr sub1 where sub1.sopno = gl_sl_cmpr.sopno)
      AND OnAccount != (SELECT sum(SLCr) FROM from gl_sl_cmpr sub1 where sub1.sopno = gl_sl_cmpr.sopno))
      AND (  (SELECT sum(SLDr) FROM gl_sl_cmpr sub1 where sub1.sopno = gl_sl_cmpr.sopno) 
         !=  (SELECT sum(GLDr) FROM gl_sl_cmpr sub2 where sub2.sopno = gl_sl_cmpr.sopno)
         OR  (SELECT sum(SLCr) FROM gl_sl_cmpr sub3 where sub3.sopno = gl_sl_cmpr.sopno) 
         !=  (SELECT sum(GLCr) FROM gl_sl_cmpr sub4 where sub4.sopno = gl_sl_cmpr.sopno)))

That should speed up a lot.

Then, you partially have the logic at client side and partially in the database.
Try to use the database (do all the updates at server side)

Also I think you have design issues if this logic is needed often since it's for example
relying on summed fields and seems that it has redundancy etc.
Redesign on these areas should have a major impact on performance

The need to optimize rises from a bad design.My articles[^]

GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari16-Dec-08 20:57
Uma Kameswari16-Dec-08 20:57 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari21-Dec-08 23:13
Uma Kameswari21-Dec-08 23:13 
GeneralRe: How to Improve the performance of a database application Pin
Wendelius22-Dec-08 9:36
mentorWendelius22-Dec-08 9:36 
GeneralRe: How to Improve the performance of a database application [modified] Pin
Uma Kameswari22-Dec-08 18:38
Uma Kameswari22-Dec-08 18:38 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari23-Dec-08 0:04
Uma Kameswari23-Dec-08 0:04 
GeneralRe: How to Improve the performance of a database application Pin
Wendelius23-Dec-08 3:23
mentorWendelius23-Dec-08 3:23 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari23-Dec-08 18:05
Uma Kameswari23-Dec-08 18:05 
GeneralRe: How to Improve the performance of a database application Pin
Wendelius28-Dec-08 10:35
mentorWendelius28-Dec-08 10:35 
QuestionVisual studio addin Pin
Fadi Yoosuf14-Dec-08 16:11
Fadi Yoosuf14-Dec-08 16:11 
AnswerRe: Visual studio addin Pin
Lev Danielyan15-Dec-08 19:55
Lev Danielyan15-Dec-08 19:55 
QuestionArrayList Problem Pin
bapu288912-Dec-08 8:31
bapu288912-Dec-08 8:31 
QuestionNot able to retain DataGridViewComboBox Cell's selected item value Pin
Member 62119111-Dec-08 18:38
Member 62119111-Dec-08 18:38 
QuestionSimple custom control repaint problem Pin
TheRedEye10-Dec-08 22:05
TheRedEye10-Dec-08 22:05 
AnswerRe: Simple custom control repaint problem Pin
Dave Kreskowiak11-Dec-08 2:04
mveDave Kreskowiak11-Dec-08 2:04 
GeneralRe: Simple custom control repaint problem Pin
TheRedEye11-Dec-08 4:05
TheRedEye11-Dec-08 4:05 
GeneralRe: Simple custom control repaint problem Pin
Dave Kreskowiak11-Dec-08 4:42
mveDave Kreskowiak11-Dec-08 4:42 
Questionhow to change language dependent datetime picker dynamically in .net window forms Pin
arunmca.r10-Dec-08 21:43
arunmca.r10-Dec-08 21:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.