A STORED PROCEDURE PERFORMES SLOWER WHEN EXECUTED IN HMTLDB THE IN SQLPLUS
We executed a stored procedure in HTMLDB.
At the beginning and the end of this stored procedure a timestamp inserted in a
logtable. First we executed the procedure in HTMLDB's SQL workshop (version 2.0.0.00.49
for MacOSX) under the owners schema .
Execution time 17.61 seconds.
When we query the table the logtable we see that this is the real execution time :
Start: 29-01-07 10:12:17,000000
Einde: 29-01-07 10:12:33,000000
When executing the same procedure in SQLplus (as the schemeowner) the real execution
time is less then a second :
Start: 29-01-07 10:13:13,000000
Einde: 29-01-07 10:13:13,000000
Is there a difference in executing a stored procedure in HTMLDB and Sqlplus ?????
Does it show the same timings if you execute the procedure first in Sql*Plus and then in APEX?
Keep in mind that with your first run all your queries are parsed (create execution plans, ...) and that the data read is maybe stored in the SGA. So the second run can participate from that.
Patrick
Check out my APEX-blog: http://inside-apex.blogspot.com
Similar Messages
-
How to improve stored procedure performance?
hi,
Suppose I have a stored procedure which contains 30 insert/update statements. How do I know Stored Procedure is slowly running or don't have any performance issue? how to improve performance?
Thanks in advance.
Anujit Karmakar Sr. Software EngineerStored Procedures Optimization Tips
Use stored procedures instead of heavy-duty queries.
This can reduce network traffic, because your client will send to server only stored procedure name (perhaps with some parameters) instead of large heavy-duty queries text. Stored procedures can be used to enhance security and conceal underlying data objects
also. For example, you can give the users permission to execute the stored procedure to work with the restricted set of the columns and data.
Include the SET NOCOUNT ON statement into your stored procedures to stop the message indicating the number of rows affected by a Transact-SQL statement.
This can reduce network traffic, because your client will not receive the message indicating the number of rows affected by a Transact-SQL statement.
Call stored procedure using its fully qualified name.
The complete name of an object consists of four identifiers: the server name, database name, owner name, and object name. An object name that specifies all four parts is known as a fully qualified name. Using fully qualified names eliminates any confusion about
which stored procedure you want to run and can boost performance because SQL Server has a better chance to reuse the stored procedures execution plans if they were executed using fully qualified names.
Consider returning the integer value as an RETURN statement instead of an integer value as part of a recordset.
The RETURN statement exits unconditionally from a stored procedure, so the statements following RETURN are not executed. Though the RETURN statement is generally used for error checking, you can use this statement to return an integer value for any other reason.
Using RETURN statement can boost performance because SQL Server will not create a recordset.
Don't use the prefix "sp_" in the stored procedure name if you need to create a stored procedure to run in a database other than the master database.
The prefix "sp_" is used in the system stored procedures names. Microsoft does not recommend to use the prefix "sp_" in the user-created stored procedure name, because SQL Server always looks for a stored procedure beginning with "sp_"
in the following order: the master database, the stored procedure based on the fully qualified name provided, the stored procedure using dbo as the owner, if one is not specified. So, when you have the stored procedure with the prefix "sp_" in the
database other than master, the master database is always checked first, and if the user-created stored procedure has the same name as a system stored procedure, the user-created stored procedure will never be executed.
Use the sp_executesql stored procedure instead of the EXECUTE statement.
The sp_executesql stored procedure supports parameters. So, using the sp_executesql stored procedure instead of the EXECUTE statement improve readability of your code when there are many parameters are used. When you use the sp_executesql stored procedure to
executes a Transact-SQL statements that will be reused many times, the SQL Server query optimizer will reuse the execution plan it generates for the first execution when the change in parameter values to the statement is the only variation.
Use sp_executesql stored procedure instead of temporary stored procedures.
Microsoft recommends to use the temporary stored procedures when connecting to earlier versions of SQL Server that do not support the reuse of execution plans. Applications connecting to SQL Server 7.0 or SQL Server 2000 should use the sp_executesql system
stored procedure instead of temporary stored procedures to have a better chance to reuse the execution plans.
If you have a very large stored procedure, try to break down this stored procedure into several sub-procedures, and call them from a controlling stored procedure.
The stored procedure will be recompiled when any structural changes were made to a table or view referenced by the stored procedure (for example, ALTER TABLE statement), or when a large number of INSERTS, UPDATES or DELETES are made to a table referenced by
a stored procedure. So, if you break down a very large stored procedure into several sub-procedures, you get chance that only a single sub-procedure will be recompiled, but other sub-procedures will not.
Try to avoid using temporary tables inside your stored procedure.
Using temporary tables inside stored procedure reduces the chance to reuse the execution plan.
Try to avoid using DDL (Data Definition Language) statements inside your stored procedure.
Using DDL statements inside stored procedure reduces the chance to reuse the execution plan.
Add the WITH RECOMPILE option to the CREATE PROCEDURE statement if you know that your query will vary each time it is run from the stored procedure.
The WITH RECOMPILE option prevents reusing the stored procedure execution plan, so SQL Server does not cache a plan for this procedure and the procedure is recompiled at run time. Using the WITH RECOMPILE option can boost performance if your query will vary
each time it is run from the stored procedure because in this case the wrong execution plan will not be used.
Use SQL Server Profiler to determine which stored procedures has been recompiled too often.
To check the stored procedure has been recompiled, run SQL Server Profiler and choose to trace the event in the "Stored Procedures" category called "SP:Recompile". You can also trace the event "SP:StmtStarting" to see at what point
in the procedure it is being recompiled. When you identify these stored procedures, you can take some correction actions to reduce or eliminate the excessive recompilations.
http://www.mssqlcity.com/tips/stored_procedures_optimization.htm
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/ -
I am using a Data Flow and an OLE DB Source to read my staged 3rd party external data. I need to do various Lookups to try and determine if I can find the external person in our database...by SSN...By Name and DOB...etc...
Now I need to do some more data verification based on the Lookup that is successful. Can I do those data edits against our SQL server application database by utilizing an OLE DB Command? Using a Stored Procedure or can I sue straight SQL to perform my edit
against every staging row by using a parameter driven query? I'm thinking a Stored Procedure is the way to go here since I have multiple edits against the database. Can I pass back the result of those edits via a variable and then continue my SSIS Data Flow
by analyzing the result of my Stored Procedure? And how would I do that.
I am new to the SSIS game here so please be kind and as explicit as possible. If you know of any good web sites that walk through how to perform SQL server database edits against external data in SSIS or even a YouTube, please let me know.
Thanks!Thanks for that...but can I do multiple edits in my Stored Procedure Vaibhav and pass back something that I can then utilize in my SSIS? For example...
One and Only one Member Span...so I'd be doing a SELECT COUNT(*) based on my match criteria or handle the count accordingly in my Stored Procedure and passing something back via the OLE DB Command and handling it appropriately in SSIS
Are there "Diabetes" claims...again probably by analyzing a SELECT COUNT(*)
Am I expecting too much from the SSIS...should I be doing all of this in a Stored Procedure? I was hoping to use the SSIS GUI for everything but maybe that's just not possible. Rather use the Stored Procedure to analyze my stged data, edit accordingly, do
data stores accordingly...especially the data anomalies...and then use the SSIS to control navigation
Your thoughts........
Could you maybe clarify the difference between an OLE DB Command on the Data Flow and the Execute SQL Task on the Control Flow...
You can get return values from oledb comand if you want to pipeline.
see this link for more details
http://josef-richberg.squarespace.com/journal/2011/6/30/ssis-oledb-command-and-procedure-output-params.html
The procedure should have an output parameter defined for that
I belive if you've flexibility of using stored procedure you may be better off doing this in execute sql task in control flow. Calling sp in data flow will cause it to execute sp once for each row in dataset whereas in controlflow it will go for set based
processing
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Stored procedure not found when creating a new recordset binding in Dreamweaver CS6 with ColdFusion Server 11. I can see the tables and views in the database tab, but no stored procedures. If I connect to a data source created in ColdFusion Server 6 I am able to see the stored procedures.
Ben thanks for the reply!
Yes that is the process I am following:
In Dreamweaver, open the page that will run the stored procedure.
In the Bindings panel (Window > Bindings), click the Plus button, and then select Stored Procedure.
In the Data Source pop‑up menu, select a connection to the database containing the stored procedure
Enter the ColdFusion Data Source user name and password.
At this point in the procedure drop down I would get a message that said No Stored Procedure Found.
Right now it appears to be working, I had to create a new site that pointed to the older CF 6 server's data source and create a page following the process above, then when I went back to the CF 11 site the stored procedures were now populated. I need to make sure it is pulling from the correct server but right now it appears to be working.
Thanks
Dwight -
Oracle 10gr2 Master/detail form running very slow when you navigate to the detail record.
Hi All, I have a master detail form, running in webserver, when I navigate to the detail block, the form start buffering and buttering for about 2 min. There is a trigger when-new-record instance that is firing when you navigate to a new record : The select part of this stament is taken a long time to execute. I modified this in toad and what used to take 25 seconds to run is taken less than a second now, but the slowness still persists in the form.
for rec in (select wrrh_col
wpbh_col_lvd,
wpbh_col_doc_no
from wh_col,
wkpl_col,
wh_col
where wrrh_col_no = :block.wreh_wrrh_col_no
and wrrh_col_no = wreh_wrrh_col_no
and wrrh_col_no = wpbh_col_no
and wrrh_col_proj = wpbh_col_proj
and wrrh_proj_no = wpbh_proj_no) loop
if fun_name(rec.wpbh_col_lvd) = 'Y' then
do something,
end if;
end loop;
The select staement that used to run for 23 seconds is running in less than one second, but the form is still running very slow when I navigate to the detail record.
Please advise.
Thanks.Thanks Andrea for your prompt response, the problem is the select statement and like I stated, I tuned the select statement in toad and what normally takes 23 secs is taking less than 1 sec to run. If I comment out the call to the function, it is still slow. The select stament will returned null and it will still be slow. When I comment out the for loop, it run very fast. I dont know what else to do than tuned the select statement.
-
i have a problem when i am connecting my mbpr to a monitor , the internet is going very slow when i connect to the monitor plz help me if i buy a vga to minidisplay it will help??
dovdov2,
are you saying that when you connect your MacBook Pro to a monitor, your Internet connection slows down, but when you disconnect the monitor, it speeds up again, and that this is reproducible from one day to another?
Does this happen both under OS X and under Windows 7, or only under one of them?
How are you currently connecting your MacBook Pro to your monitor? -
Java Stored Procedures take longer to execute
Hi,
I am doing a comparison of Oracle and Java Stored procedures in terms of execution time. I have created a java stored proc and an Oracle stored proc both of which perform the same task. Upon execution, I find that the java proc takes longer time to execute.
I have the following qs:-
Why are Java Stored Procs slower than Oracle Stored Procs?
How is a java stored proc executed as compared to an Oracle Stored Proc?
Can someone give a detailed explanation of -
- how a java stored proc is stored in the database?
- what happens when it is executed?
Thanks in advance
NusratWhy are Java Stored Procs slower than Oracle Stored Procs?java program slower than native code! hold the front page!
On second thoughts don't bother.
Cheers, APC -
Bulk Insert Through Stored Procedure performance issue
Hello,
i am new to oracle. i am writing a stored procedure through which i want to insert 1 billion record in a table. but it takes days to insert it . please tell me how can i improve performance of my stored procedure. because same stored procedure when i convert it into sql server in take 24 - 30 min to insert 1 billion record.
Code of my stored procedure are as follows :
create or replace PROCEDURE bspGenerateHSCode(
mLoc_id IN INT,
HSCodeStart IN VARCHAR2,
HSCodeEnd IN VARCHAR2,
mRqstId IN INT,
total_count IN INT,
Status OUT INT)
AS
ExitFlag INT;
row_count INT;
mBatchStart NUMBER;
mBatchEnd NUMBER;
mStartSqnc NUMBER;
mEndSqnc NUMBER;
mHSCode VARCHAR2(500);
HSStartStr VARCHAR2(500);
BEGIN
SELECT COUNT(*) INTO row_count FROM goap_eal_allocation
WHERE hs_code_start = HSCodeStart
AND hs_code_end = HSCodeEnd
AND loc_id = mLoc_id
AND processed = 0;
IF row_count > 0 THEN
SELECT CAST ( REVERSE(substr(REVERSE(HSCodeStart), 1, instr(REVERSE(HSCodeStart), ',') -1)) AS NUMBER) INTO mStartSqnc FROM DUAL;
SELECT CAST ( REVERSE(substr(REVERSE(HSCodeEnd), 1, instr(REVERSE(HSCodeEnd), ',') -1)) AS NUMBER) INTO mEndSqnc FROM DUAL;
SELECT CAST( REVERSE(substr( REVERSE(HSCodeStart), instr(REVERSE(HSCodeStart), ','))) AS VARCHAR2(500) ) INTO HSStartStr FROM DUAL;
mBatchStart := mStartSqnc;
DBMS_OUTPUT.PUT_LINE('start batch ' || mBatchStart);
LOOP
mBatchEnd := mBatchStart + 5000;
IF mBatchEnd > mEndSqnc THEN
mBatchEnd := mEndSqnc + 1;
END IF;
DBMS_OUTPUT.PUT_LINE('End batch ' || mBatchEnd);
LOOP
mHSCode := HSStartStr || mBatchStart;
mBatchStart := mBatchStart + 1;
INSERT INTO goap_eal_register(id, hs_code, loc_id, status_id, synced)
SELECT CASE WHEN MAX(id) > 0 THEN (MAX(id) + 1) ELSE 1 END AS id ,
mHSCode, mLoc_id, 6, 1 FROM goap_eal_register;
EXIT WHEN mBatchStart = mBatchEnd;
END LOOP;
COMMIT;
EXIT WHEN mBatchStart = mEndSqnc +1;
END LOOP;
UPDATE goap_eal_allocation SET processed = 1
WHERE hs_code_start = HSCodeStart
AND hs_code_end = HSCodeEnd
AND loc_id = mLoc_id;
COMMIT;
Status := 1;
ELSE
Status := 0;
END IF;
END;
ThanksPlease edit your post and add \ on the line before and the line after the code to preserve formattingsee how this looks?
Also, when you basically just want to RETURN without doing any work then your first test should just RETURN if you don't want to do any work.
Instead of what your code does:IF row_count > 0 THEN
. . . a whole lot of code that is hard to read or understand
COMMIT;
Status := 1;
ELSE
Status := 0;
END IF;
Test the condition to determine when you do NOT want proceed and just return.IF row_count = 0 THEN
Status := 0;
RETURN;
END IF;
-- now NONE of the following code needs to be indented - you won't get here unless you really want to execute it.
. . . break the code into separate steps and add a one line comment before each step that says what that step does.
COMMIT;
Status := 1; -
Can someone help me diagnose a strange stored procedure performance issue please?
I have a stored procedure (posted below) that returns message recommendations based upon the Yammer Networks you have selected. If I choose one network this query takes less than one second. If I choose another this query takes 9 - 12 seconds.
/****** Object: StoredProcedure [dbo].[MessageView_GetOutOfContextRecommendations_LargeSet] Script Date: 2/18/2015 3:10:35 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[MessageView_GetOutOfContextRecommendations_LargeSet]
-- Parameters
@UserID int,
@SourceMessageID int = 0
AS
BEGIN
-- variable for @HomeNeworkUserID
Declare @HomeNeworkUserID int
-- Set the HomeNetworkID
Set @HomeNeworkUserID = (Select HomeNetworkUserID From NetworkUser Where UserID = @UserID)
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON
-- Begin Select Statement
Select Top 40 [CreatedDate],[FileDownloadUrl],[HasLinkOrAttachment],[ImagePreviewUrl],[LikesCount],[LinkFileName],[LinkType],[MessageID],[MessageSource],[MessageText],[MessageWebUrl],[NetworkID],[NetworkName],[PosterEmailAddress],[PosterFirstName],[PosterImageUrl],[PosterName],[PosterUserName],[PosterWebUrl],[RepliesCount],[Score],[SmallIconUrl],[Subjects],[SubjectsCount],[UserID]
-- From View
From [MessageView]
-- Do Not Return Any Messages That Have Been Recommended To This User Already
Where [MessageID] Not In (Select MessageID From MessageRecommendationHistory Where UserID = @UserID)
-- Do Not Return Any Messages Created By This User
And [UserID] != @UserID
-- Do Not Return The MessageID
And [MessageID] != @SourceMessageID
-- Only return messages for the Networks the user has selected
And [NetworkID] In (Select NetworkID From NetworkUser Where [HomeNetworkUserID] = @HomeNeworkUserID And [AllowRecommendations] = 1)
-- Order By [MessageScore] and [MessageCreatedDate] in reverse order
Order By [Score] desc, [CreatedDate] desc
ENDThe Actual Execution Plan Shows up the same; there are more messages on the Network that is slow, 2800 versus 1,500 but the difference is ten times longer on the slow network.Is the fact I am doing a Top 40 what makes it slow? My first guess was to take the Order By Off and that didn't seem to make any difference.The execution plan is below, it takes 62% of the query to look up theIX_Message.Score which is the clustered index, so I thought this would be fast. Also the Clustered Index Seek for the User.UserID take 26%which seems high for what it is doing.
I have indexes on every field that is queried on so I am kind of at a loss as to where to go next.
It just seems strange because it is the same view being queried in both cases.
I tried to run the SQL Server Tuning Wizard but it doesn't run on Azure SQL, and my problem doesn't occur on the data in my local database.
Thanks for any guidance, I know a lot of the slowness is due to the lower tier Azure SQL we are using, many of the performance issues weren't noticed when were on the full SQL Server, but the other networks work extremely fast so it has to be something to
with having more rows.
In case you need the SQL for the View that I am querying it is:
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[MessageView]
AS
SELECT M.UserID, M.MessageID, M.NetworkID, N.Name AS NetworkName, M.Subjects, M.SubjectsCount, M.RepliesCount, M.LikesCount, M.CreatedDate, M.MessageText, M.HasLinkOrAttachment, M.Score, M.WebUrl AS MessageWebUrl, U.UserName AS PosterUserName,
U.Name AS PosterName, U.FirstName AS PosterFirstName, U.ImageUrl AS PosterImageUrl, U.EmailAddress AS PosterEmailAddress, U.WebUrl AS PosterWebUrl, M.MessageSource, M.ImagePreviewUrl, M.LinkFileName, M.FileDownloadUrl, M.LinkType, M.SmallIconUrl
FROM dbo.Message AS M INNER JOIN
dbo.Network AS N ON M.NetworkID = N.NetworkID INNER JOIN
dbo.[User] AS U ON M.UserID = U.UserID
GO
The Network Table has an Index on Network ID, but it non clustered but I don't think that is the culprit.
CorbyI marked your response as answer because you gave me information I didn't have about the sort. I ended up rewriting the query to be a join instead of the In's and it improved dramatically, about one second on a very minimal Azure SQL database, and before
it was 12 seconds on one network. We didn't notice the problem at all before we moved to Azure SQL, it was about one - three seconds at most.
Here is the updated way that was much more efficient:
CREATE PROCEDURE [dbo].[Procedure Name]
-- Parameters
@UserID int,
@SourceMessageID int = 0
AS
BEGIN
-- variable for @HomeNeworkUserID
Declare @HomeNeworkUserID int
-- Set the HomeNetworkID
Set @HomeNeworkUserID = (Select HomeNetworkUserID From NetworkUser Where UserID = @UserID)
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON
;With cteMessages As
-- Begin Select Statement
Select (Fields List)
-- Join to Network Table
From MessageView mv Inner Join NetworkUser nu on MV.NetworkID = nu.NetworKID -- Only Return Networks This User Has Selected
Where nu.HomeNetworkUserID = @HomeNeworkUserID And AllowRecommendations = 1
-- Do Not Return Any Messages Created By This User
And mv.[UserID] != @UserID
-- Do Not Return The MessageID
And mv.[MessageID] != @SourceMessageID
), cteHistoryForThisUser As
Select MessageID From MessageRecommendationHistory Where UserID = @UserID
-- Begin Select Statement
Select Top 40 (Fields List)
-- Join to Network Table
From cteMessages m Left Outer Join cteHistoryForThisUser h on m.MessageID = h.MessageID
-- Do Not Return Any Items Where User Has Already been shown this Message
Where h.MessageID Is Null
-- An Order By Is Needed To Get The Best Content First
Order By Score Desc
END
GO
The Left Outer Join to test for null was the biggest improvement, but it also helped to join to the NetworkUser table instead of do the In sub query. -
Stored procedure Performance issue in SQLserver 2005
Hi All,
i am inserting the data to Database by using of Stored procedure in target DB.
My source structure and target structures are looking below
I have the source structure having lot of rows and look like my structure is below:
<?xml version="1.0" encoding="utf-8" ?>
<ns0:POCA0013_KANLOG_REQUEST_MT_response xmlns:ns0="urn:com:POCA0013:sample">
<SCMDB_response>
- <row>
<PROJK>O-USA</PROJK>
<KOLLO>123</KOLLO>
</row>
- <row>
<PROJK>O-Denmark</PROJK>
<KOLLO>256</KOLLO>
</row>
n number of rows
</SCMDB_KANLOGVIEW_response>
</ns0:POCA0013_KANLOG_REQUEST_MT_response>
and after mapping my target structure is coming to like this.
<?xml version="1.0" encoding="UTF-8" ?>
<ns0:POCA0013_DB_MT xmlns:ns0="urn:pg-com POCA0013:sample">
<StatmentName>
<XI_SP_DATA action="EXECUTE">
<PROJEK isInput="TRUE" type="CHAR">O-USA</PROJEK>
<KOLLO isInput="TRUE" type="CHAR" >123</KOLLO>
</XI_SP_DATA>
</StatmentName>
<StatmentName>
<XI_SP_DATA action="EXECUTE">
<PROJEK isInput="TRUE" type="CHAR">O-Denmark</PROJEK>
<KOLLO isInput="TRUE" type="CHAR" />256</KOLLO>
</XI_SP_DATA>
</StatmentName>
N number of times
</ns0:POCA0013_DB_MT>
this is working perfectly to insert the records into the database by using stored procedure. each record it call the stored procedure for insert the records, for example we had 100 records and it call 100 times stored procedure.
But in case of huge data, for example 10000 records, it call the 10000 times to stored procedure.in that case we had a problem for database side.
we have one reason to use the stored procedure here, because once insert the data into table, if successful log table is created with successful status , if not log table is created with error status. for that purpose i am using stored procedure here.
Our customer wants to call the stored procedure for one time for all records.How i can manage this situation.
Can you give me your valuble ideas about this problem.
Thank you very much.,
Sateesh
Edited by: sateesh kumar .N on Apr 23, 2010 6:53 AM
Edited by: sateesh kumar .N on Apr 23, 2010 6:54 AM
Edited by: sateesh kumar .N on Apr 23, 2010 7:54 AMHi Sateesh,
how about a different approach.
Add 2 more tables to your solution. The first table is used as a staging table, where PI inserts all the data without making any checks, whatsoever. The second table is used as a control table. If the insertion is finished, a log entry is inserted into this second table, containing the information about success or failure or how many rows had been inserted. Put an insert trigger on this table, which in term starts a stored procedure. This stored procedure can read all the data from the staging table and put it into the desired target tables. Additionally you can perform plausiblitiy checks inside this SP.
Okay I know, this is a complete new solution in comparison to what you did before. But in my experience, this will be much more performant than 10000 calls to one stored procedure who only does inserts as you described.
Regards
Sven -
Stored Procedure Performance Issue in Sharepoint Report
We have a report stored procedure that runs in about 1 minute in production; however, when executed from the Sharepoint it populates, it runs for over 20 minutes, with exactly the same parameters. We've done everything to avoid parameter sniffing problems:
used WITH RECOMPILE on the procedure declaration; added OPTION OPTIMIZE FOR UNKNOWN on the parameters within queries; even created local variables and assigned the parameter values to them and used them throughout the procedure. None of these has had any effect.
I know that the 1-base minute run time is a big red flag, and we're working on pre-aggregating this data into our BI platform, but that's months down the liine and this is needed for month-end close every month.
Other relevant information:
Sharepoint 2013 on SQL Server 2012
Data Source is a SQL Server 2008 R2 database
Report definition created in Visual Studio 2008I'm trying to figure out why it's taking so long. When I query on ExecutionLog3 I see the following (converted to seconds):
Total Seconds
Retrieval Seconds
Processing Seconds
Rendering Seconds
ByteCount
RowCount
653.966
653.933
0.018
0.015
15037
1
Yet running in SSMS, it completes (consistently) in 62 seconds. -
Stored Procedure behaves differently when activation is on?!
Hi,
I have got a simple stored procedure for testing purposes. When Activation is off and I run this sp myself it works correct, but when I set activation to on and send a message, the message is being pulled from the queue and I think this can only be done
by the activated sp but the insert into (see sp) is not done.
here is stored procedure:
as
declare
@message_bodyasxml;
declare
@message_typeassysname;
declare
@dialogasuniqueidentifier;
while
(1=1)
begin
waitfor
receivetop(1)
@message_type=message_type_name,
@message_body=cast(message_bodyasxml),
@dialog=conversation_handle
fromdbo.MADClaimCallHistoryQueue
),timeout2000;
if
(@@ROWCOUNT=0)
begin
print'rowcount
= 0'
break;
end
if
(@message_type='http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog')
endconversation@dialog;
elseif
(@message_type='http://schemas.microsoft.com/SQL/ServiceBroker/Error')
begin
print'Dialog
Error dialog #'+cast(@dialogasnvarchar(50));
endconversation@dialog;
end
elseif
(@message_type='InsertMessage')
begin
print'insert';
insertintoMADLog.dbo.SBTest(xmlvar)
select@message_body
endconversation@dialog;
end
endthe stored procedure is executed as SELF.
-
How to get all parameter names along with their values in stored procedure which is being executed
Im using sql server 2012, is there any possible way to get all the parameters of a stored procedure along with the values passed to it.
I need these things to build a xml. I mean this should happen in the procedure which being executed and it should be common for all the procedures.
For example, let us suppose we have to procedures,
uspSave, @name='test' @age=20
uspDelete @id=2
now in uspSave procedure, i need to get @name, @age and the values 'test', 20 and in uspDelete, i should get @id with value 2.
For getting the column names, i tried this,
select parameter_name from information_schema.PARAMETERS where specific_name=OBJECT_NAME(@@procid)
now is it possible to loop through the result of above query and can we get the values.I think you need running SQL Server Profiler to capture this info even in SQL Server 2012.
Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/
Blog : MS SQL Development and Optimization
Blog : Large
scale of database and cleansing -
Performance Problem when executing the report for the first time.
Hi,
We have a Zreport...to improve the performance i created Index on few Data Base table..before my changes it used to take more than 15 minutes after the changes it taking less than 1 min for the same variant and for other variants also.
But when executing the first in morning its taking the same time more than 15 min.Please let me know how to increase the performance when executing first time also,
Thanks,
Kiran.Hi all,
Appreciate your valuable replies...
@ Thomas: i do accept with your solution running a background job..but user is not accepting for it..thanks for your reply.
@Siegfried Boes : for testing purpose Im running this manytimes..but for user they may
require when ever they need to know open oders.the volume of the data is barongs 300-350 at
max.
@Brad Bohn : After creating the index the repose time reduced to half ...i hope i have
created a right index.
Observation here...I executed the report in production system more than 5 times it took the
same time, my changes are still in quality..so i think may be for selecting the right index
its taking this much time.and for the next time is taking right index n doing it so it taking
less.
Do you accept it?.if so Please let me know how to explicitly say the select statement to
use my index.
Thanks,
kiran. -
Java stored procedures performance ....
I am currently evaluating the use of Java stored procedures, but
have so far found the performance to be incredibly poor. If I
write a simple piece of SQL to insert 1 row to a 2 column table
via a standalone JDBC application, the average elapsed time over
5 runs is approx 24 milliseconds. If I move the same piece of
code to a Java stored procedure, the elapsed time increases (on
average) to 28 seconds ! Surely this shouldn't be the case; I
had expected the performance to increase rather than plummet as
is the case. The DBA team cannot find anything amiss in the
database, & we are basically scratching our heads as to what the
problem is. Is there something fundamental that needs to be done
the database for a Java implementation ??
ANY IDEAS ANYONE ???????
nb: database ver 8.1.5, running on Solaris 5.7
regards,
Paul.
nullTry running long queries. In 8.1.6, we are concentrating more
on increasing the performance of JDBC driver inside the server.
Paul Jones (guest) wrote:
: I am currently evaluating the use of Java stored procedures,
but
: have so far found the performance to be incredibly poor. If I
: write a simple piece of SQL to insert 1 row to a 2 column table
: via a standalone JDBC application, the average elapsed time
over
: 5 runs is approx 24 milliseconds. If I move the same piece of
: code to a Java stored procedure, the elapsed time increases (on
: average) to 28 seconds ! Surely this shouldn't be the case; I
: had expected the performance to increase rather than plummet as
: is the case. The DBA team cannot find anything amiss in the
: database, & we are basically scratching our heads as to what
the
: problem is. Is there something fundamental that needs to be
done
: the database for a Java implementation ??
: ANY IDEAS ANYONE ???????
: nb: database ver 8.1.5, running on Solaris 5.7
: regards,
: Paul.
Oracle Technology Network
http://technet.oracle.com
null
Maybe you are looking for
-
ITunes won't open, now Quicktime is giving me a hard time!
Hi, i've been having some problems with my iTunes lately; when I try to open it, it immediately shuts down and then I'm asked wether or not I want to send a bugreport. After getting no reply to the report, I started looking around on this discussion
-
How can I create a document with piece-making?
Hello Community, I am looking to create a template document that allows quick inserting and removing of pre-made statements for a list, yet are editable to a degree. I am imagining I would be able to use the Repeating Section Content Control with Dr
-
TS2570 My Mac is stuck on grey screen what's wrong with it and am I going to lose everything
My Mac is stuck on grey screen what's wrong with it and am I going to lose everything
-
I'm using the latest iTunes on Windows 8. Since upgrading to iTunes 12 my old system of smart playlists within folders have not worked properly. I used to have a folder containing three folders with smart playlists in them, but I had to abandon this
-
Multiple Date Fields (Fact Table) - Linking with Time Dimension
I have a fact table that has multiple date columns. I can make a time dimension, but it has to be joined to a particular date column. This becomes difficult because of the limit in having multiple date fields reference one time dimension. I can see p