Click here to Skip to main content
15,881,812 members
Home / Discussions / Database
   

Database

 
GeneralRe: VLDB optimization Pin
Ashfield5-Dec-08 1:14
Ashfield5-Dec-08 1:14 
AnswerRe: VLDB optimization Pin
Mycroft Holmes4-Dec-08 21:39
professionalMycroft Holmes4-Dec-08 21:39 
AnswerRe: VLDB optimization Pin
Wendelius5-Dec-08 7:31
mentorWendelius5-Dec-08 7:31 
GeneralRe: VLDB optimization Pin
sujithkumarsl8-Dec-08 17:29
sujithkumarsl8-Dec-08 17:29 
GeneralRe: VLDB optimization Pin
Wendelius9-Dec-08 7:40
mentorWendelius9-Dec-08 7:40 
GeneralRe: VLDB optimization Pin
sujithkumarsl9-Dec-08 16:51
sujithkumarsl9-Dec-08 16:51 
GeneralRe: VLDB optimization Pin
Wendelius10-Dec-08 4:41
mentorWendelius10-Dec-08 4:41 
QuestionHow can I optimize this SQL Query? Pin
Rafferty Uy4-Dec-08 17:52
Rafferty Uy4-Dec-08 17:52 
We have this stored procedure:

DECLARE ParentCursor Cursor for
   select iitm_id_parent from z_structure where iitm_id = @pverID
   
open ParentCursor
fetch next from ParentCursor into @versionId
while (@@fetch_status = 0)
begin
    select @isDraft = isnull(ipve_draft, 0) from i_product_version where ipve_id = @versionId
    select @nCount = count(*)
        from i_prod_wwrk
        where wwrk_id = @workflowID and ipro_id in (select ipro_id from i_product_version where ipve_id = @versionId)
   
   if ((@nCount > 0) and (@isDraft = 0))
      insert into e_parents (expo_id, pver_id, pver_parent_id) values (@expoID, @pverID, @versionId)

   fetch next from ParentCursor into @versionId
end
close ParentCursor
deallocate ParentCursor


And now, we are optimizing it into:
INSERT INTO E_PARENTS (EXPO_ID, PVER_ID, PVER_PARENT_ID)
	SELECT @expoID, @pverID, z.iitm_id_parent
	FROM z_structure z INNER JOIN i_product_version pv ON z.iitm_id_parent = pv.ipve_id
	WHERE z.iitm_id = @pverID AND ISNULL(pv.ipve_draft, 0) = 0 AND
		EXISTS (SELECT 1 FROM i_prod_wwrk pw
				WHERE pw.wwrk_id = @workflowID AND pw.ipro_id IN
					(SELECT ipro_id FROM i_product_version WHERE ipve_id = z.iitm_id_parent)
				)


Do you think this is correct? And are there any further suggestions? Smile | :)

Thanks!

Rafferty

AnswerRe: How can I optimize this SQL Query? Pin
Wendelius4-Dec-08 19:38
mentorWendelius4-Dec-08 19:38 
GeneralRe: How can I optimize this SQL Query? Pin
Rafferty Uy4-Dec-08 20:10
Rafferty Uy4-Dec-08 20:10 
GeneralRe: How can I optimize this SQL Query? Pin
Mycroft Holmes4-Dec-08 21:41
professionalMycroft Holmes4-Dec-08 21:41 
GeneralRe: How can I optimize this SQL Query? Pin
Wendelius4-Dec-08 21:59
mentorWendelius4-Dec-08 21:59 
GeneralRe: How can I optimize this SQL Query? Pin
Wendelius4-Dec-08 21:58
mentorWendelius4-Dec-08 21:58 
AnswerRe: How can I optimize this SQL Query? Pin
Ben Fair5-Dec-08 4:09
Ben Fair5-Dec-08 4:09 
GeneralRe: How can I optimize this SQL Query? Pin
Rafferty Uy8-Dec-08 17:18
Rafferty Uy8-Dec-08 17:18 
QuestionHow to access *.dbf file using c# Pin
Kumaran Jeyasingam4-Dec-08 14:32
Kumaran Jeyasingam4-Dec-08 14:32 
AnswerRe: How to access *.dbf file using c# Pin
PIEBALDconsult4-Dec-08 15:33
mvePIEBALDconsult4-Dec-08 15:33 
AnswerRe: How to access *.dbf file using c# Pin
Mycroft Holmes4-Dec-08 21:45
professionalMycroft Holmes4-Dec-08 21:45 
GeneralRe: How to access *.dbf file using c# Pin
Wendelius5-Dec-08 8:24
mentorWendelius5-Dec-08 8:24 
GeneralRe: How to access *.dbf file using c# Pin
Mycroft Holmes5-Dec-08 14:07
professionalMycroft Holmes5-Dec-08 14:07 
GeneralRe: How to access *.dbf file using c# Pin
Kumaran Jeyasingam14-Dec-08 14:58
Kumaran Jeyasingam14-Dec-08 14:58 
QuestionProgram Design - Master DataSet/Adapter for program? Pin
David Hovey4-Dec-08 8:53
David Hovey4-Dec-08 8:53 
AnswerRe: Program Design - Master DataSet/Adapter for program? Pin
Wendelius4-Dec-08 9:25
mentorWendelius4-Dec-08 9:25 
GeneralRe: Program Design - Master DataSet/Adapter for program? Pin
David Hovey4-Dec-08 10:56
David Hovey4-Dec-08 10:56 
GeneralRe: Program Design - Master DataSet/Adapter for program? Pin
Wendelius5-Dec-08 7:50
mentorWendelius5-Dec-08 7:50 

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.