stored procedures - Have an issue of extrem slow sp and he dont do his job -


I found this SP:

  drop table when split value is dimmed; Create tablet splitwalls dump (value VARCHAR (1000) primary key); DELIMITER $$ drop process if the current changes the site redirects $$ The process of making 'Change Sites Redirects' (Productman Address varchar (255), subdomain ii vendor varchar (255)) has been annulled the declaration of SQL security Inverters varchar (1000) ; DECLARE tvalue varchar (1000); DECLARE prepValue varchar (1000); Removal subdomain full address varchar (1000); Total records total difference; Clear tclientid; DECLARE sitedone INT DEFAULT 0; DECLARE splitdone INT DEFAULT 0; Derler Damon Vrchar (1000); DECLARE curlSites for Coors (Select domains; Clients from sites where redirections.com = 'N'); Set set for DECLARE set = 1; Set sitedone: = 0; Open curlSites; Scan_Sites: WHILE (sitedone = 0) if sitedone = 1 then skip Scan_Sites; End; ELSE DECLARE for curlStringDump cursor (select `value 'from SplitValuesDump); Set set for handler not set DECLARE = ​​1 splitdone; Tudium in tampering, Teclionit; Call split_string (tadman, ';'); Open curlStringDump; SET split: = 0; ScanDump: WHILE (splitdone = 0) if divided = 1 then leave scandend; End; Originally start at the preview; Set subdomainfloddress: = subdomainname address; If the costume & lt; & Gt; "" Then start if the main account, like a subdomain such as a productman account or temval, is set to aggregate total domain: = total domains 1; If a subdomain is like talvalaminetrider, then set the sistdiine complete address: = tarvalue; End; end if; End; ELSE Total Set Domain: = Total Domain + 1; Set last day: = Taivalue; End; end if; End; end if; End; end if; Finally scandump; Stop CurlStringDump; SET split: = 0; SET prepival: = 'n'; If the last time = '' and total domain = 2 then set the preweave: = subdomain fall address || CHAR (2) || ProdimainAddress; Insert sites from sites_tmp * from sites where the client = tclientid limits 1; UPDATE sites_tmp SET redirectsubdomain = prepValue WHERE Client = tclientid limit1; End; Set ELSE PRePValue: = ProdimainAddress || CHAR (2) || Last day || CHAR (1) || Subdomain fall address CHAR (2) || LastDomain; Insert sites from sites_tmp * from sites where the client = tclientid limits 1; UPDATE sites_tmp SET redirectsubdomain = prepValue WHERE Client = tclientid limit1; End; end if; End; end if; Finally when Scan_Sites; Stop CurlSites; SET sitedone: = 0; End $ $  

I try to get some information from the column data, divides its data and brings some data ions there. Repeat on each table site and then update the sites sites_tmp

I have a problem that I do not know how can I debug or do it faster? What ur recommend here? And why is it so slow ??? And finally did not pass it all the records?


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -