Performance Tune Stored procedures
Hi Experts,
What is the best approach to performance tune stored procedures. Is it to run expalin plan for the queries used in cursors or there is more to it?
I need all your advise.
Thanks
As generic advice: Absolutely not.
The performance of PL/SQL may be irrelevant to the performance of specific SQL statements contained.
Consider the following:
1. A very inefficient query that runs one time and takes 2 seconds to execute.
2. A query that runs in 2 milliseconds inside a loop.
Which one is more likely to be the issue?
The answer is that it depends on the number of interations of the loop.
The proper tool for tuning PL/SQL, as discussed by Tom Kyte, are, depending on version, DBMS_PROFILER or DBMS_HPROF.
Find out where the time is being spent.
Then tune that which takes the most time.
It is not necessarily the slowest SQL statement.
Similar Messages
-
How to check performance for Stored procedure or Package.
Hi ,
Can any one please tell me , how to check performance for Stored procedure or Function or Package
Thanks&Regards,
Sanjeev.user13483989 wrote:
Hi ,
Can any one please tell me , how to check performance for Stored procedure or Function or Package
Thanks&Regards,
Sanjeev.Oracle has provided set of Tools to monitor the Performance.
Profilers being one of them; If you wish to understand more on PL/SQL Optimization, please read PL/SQL Optimization and Tuning.
See example of DBMS_PROFILER.
See example of PLSQL Hierarchial Profiler -
Hi
I have some questions ,whenver i am going to interview ,i unable to answer these questions in confidencially
1)How to tune the stored procedures,functions?
2)What is bit map indexes why it mostly used in datawarehousing envornment ,please brief about architecture of bit map indexes?
3)is it update materilized view ?
4)I have a view ,it has contains columns from tables ,is it possible to update that view?
5)What is difference between materilized view and view?
Regards
MohanRTFM A harsh and unhelpful but nonetheless accurate assessment of Mohan's needs.
Mohan
Your questions are pretty wide ranging and most of them require only basic understanding of Oracle databases. Only the headline question - how to tune stored procedures - would take more than a couple of sentences to answer.
So, I have to ask, what sort of jobs are you being interviewed for? I fear you need to read up on the documentation. Even if you memorised the answers we could give here that wouldn't help you answer the other leftfield questions that are going to hit you.
Firstly, read all of the Concepts Manual: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/toc.htm
Only then should you move on to these bits.
1)How to tune the stored procedures,functions?
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/12_tune.htm#870
2)What is bit map indexes why it mostly used in datawarehousing envornment ,please brief about architecture of bit map indexes?
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96520/indexes.htm#97322
3)is it update materilized view ?
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96567/repmview.htm#51010
4)I have a view ,it has contains columns from tables ,is it possible to update that view?
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/c11schem.htm#19229
5)What is difference between materilized view and view?
A view is basically a stored query. It occupies no space and it cannot be used to enforce integrity constraints. A materilialized view is more like a table - it requires storage, can have keys and foreign key references - but it's data is derived from data in actual tables. Read the Concepts manual.
Cheers, APC -
Hi,
I am looking for inputs in tuning stored procedure using sql server 2008. l am new to performance tuning in sql,plsql and oracle. currently facing issue in stored procedure - need to increase the performance by code optmization/filtering the records using where clause in larger table., the requirement is Stored procedure generate Audit Report which is accessed by approx. 10 Admin Users typically 2-3 times a day by each Admin users.
It has got CTE ( common table expression ) which is referred 2 time within SP. This CTE is very big and fetches records from several tables without where clause. This causes several records to be fetched from DB and then needed processing. This stored procedure is running in pre prod server which has 6gb of memory and built on virtual server and the same proc ran good in prod server which has 64gb of ram with physical server (40sec). and the execution time in pre prod is 1min 9seconds which needs to be reduced upto 10secs or so will be the solution. and also the exec time differs from time to time. sometimes it is 50sec and sometimes 1min 9seconds..
Pl provide what is the best option/practise to use where clause to filter the records and tool to be used to tune the procedure like execution plan, sql profiler?? I am using toad for sqlserver 5.7. Here I see execution plan tab available while running the SP. but when i run it throws an error. Pl help and provide inputs.
Thanks,
VijiYou've asked a SQL Server question in an Oracle forum. I'm expecting that this will get locked momentarily when a moderator drops by.
Microsoft has its own forums for SQL Server, you'll have more luck over there. When you do go there, however, you'll almost certainly get more help if you can pare down the problem (or at least better explain what your code is doing). Very few people want to read hundreds of lines of code, guess what's it's supposed to do, guess what is slow, and then guess at how to improve things. Posting query plans, the results of profiling, cutting out any code that is unnecessary to the performance problem, etc. will get you much better answers.
Justin -
Performance of Stored procedures against Prepared Statements
What will be the exact difference in the performance between implementing stored procedures and prepared statements ?
Short answer: it depends.
There will probobaly be very little difference in performance difference for a sipmle insert / update etc.
Multiple inserts / updates etc you will probobaly find faster with a stored procedure rather than n prepared statments as you only have to contact the database once vs n times.
Hope this helps! -
JDBC performance calling stored procedures
Hi,
We have an java application which makes calls to PL/SQL stored procedures. We have one 'database server' component which handles all the database interaction, and other components which connect to it using CORBA.
The problem is that with everything running, certain queries are taking from 17 to 30 seconds to come back, but when you run the same sql from SQLPlus, you get the results back in about 2 seconds every time.
We're using a connection pool, but this doesn't seem to be the problem, as we put in diagnostics and it takes no time at all to get a free connection.
The time is taken up doing a getCursor() to get the result set back. We register the cursor as an output parameter, and open it from within the stored procedure.
Anyone any suggestions?
Thanks,
Neil.
nullHi ,
You can call stored procedure using JPA (eclipselink API).Below is the sample code
ReadAllQuery readAllQuery = new ReadAllQuery(Employee.class);
call = new StoredProcedureCall();
call.setProcedureName("Read_All_Employees");
readAllQuery.useNamedCursorOutputAsResultSet("RESULT_CURSOR");
readAllQuery.setCall(call);
List employees = (List) session.executeQuery(readAllQuery);
Regards,
Vinay -
Improving the performance of Stored Procedure
need to improve the performance of this SP that is hitting two tables that holds about 24000 rowsUSE [trouble_database]
GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE [dbo].[the_trouble_StoredProcedure]
@troubleMedicatiotrouble_durationl int
as
declare @trouble_refil table
( troubleMedicatiotrouble_durationl int,
trouble_durationl int
declare @nRefillDispense int
if exists (select ml.lid from trouble_MedicaticDirectmd
inner join trouble_Medicatication ml on ml.troubleMedicatiotrouble_durationl=md.lID
where isnull(md.trouble_bRefillDisp,0)=1
and ml.lID <>(Select MIN(lID) from trouble_Medicatication where troubleMedicatiotrouble_durationl=@troubleMedicatiotrouble_durationl)
begin
select @nRefillDispense = isnull(nRefillDispense,9) from trouble_MedicaticDirect where lID=@troubleMedicatiotrouble_durationl
insert @trouble_refil (trouble_durationl)
select
Case szIncrement
when 'Day(s)' then isnull(trouble_durationl,0)
when 'Week(s)' then isnull(trouble_durationl,0) * 7
when 'Month(s)' then isnull(trouble_durationl,0) * 30
when 'Year(s)' then isnull(trouble_durationl,0) * 365
else 0
end as trouble_durationl
from
trouble_Medicatication where
troubleMedicatiotrouble_durationl=@troubleMedicatiotrouble_durationl
and lID<>(Select min(lID) from trouble_Medicatication where troubleMedicatiotrouble_durationl=@troubleMedicatiotrouble_durationl)
select @nRefillDispense as nRefillDispense, sum(trouble_durationl)as trouble_durationl from @trouble_refil
end
else
select 0 as nRefillDispense,0 as trouble_durationl
kyou can use Execution plain
http://stackoverflow.com/questions/7359702/how-do-i-obtain-a-query-execution-plan
and add index.
Index according to the fields you ask queries can improve performance greatly larger!
You can use the statistics for building indexes:
http://www.mssqltips.com/sqlservertip/2979/querying-sql-server-index-statistics/
Tzuri Ben Ezra | My Certifications:
CompTIA A+ ,Microsoft MCP, MCTS, MCSA, MCITP |
FaceBook: Tzuri FaceBook | vCard:
Tzuri vCard |
Microsoft ID:
Microsoft Transcript
| -
Performance issue on Java Stored Procedure
I have converted the Stored Procedures into JSP with SQLJ. I
loaded the classes (not the source) onto Oracle 8i Database and
published within tbe stored packages. What I found out was the
performance is about 12 times on average slower than the PL/SQL
stored packages when I made calls to JSP. I am not surprise JSP
is slower than PL/SQL but can we improve by tunning the Java
codings or VM within the 8i database?
nullJames Chan (guest) wrote:
: I have converted the Stored Procedures into JSP with SQLJ. I
: loaded the classes (not the source) onto Oracle 8i Database and
: published within tbe stored packages. What I found out was the
: performance is about 12 times on average slower than the PL/SQL
: stored packages when I made calls to JSP. I am not surprise JSP
: is slower than PL/SQL but can we improve by tunning the Java
: codings or VM within the 8i database?
all user written java code in the 8i rdbms is currently running
as bytecode in the jvm.
a future release will provide a component called "Native Compiler
[NCOMP]" so it should run considerably faster then.
see the following link for details :
http://technet.oracle.com/files/search/search.htm?ncomp
null -
Getting a DataReader by stored procedure vs. SQL statment (Performance)
Hallo DB-Experts,
I have encountered a performance problem regarding getting a DataReader by stored procedure versus a SQL statment
and I want to know if this is an known issue and how to tune it.
Getting a DataReader through a SQL statment is faster than with a stored procedure,
if the number of data rows are less than about 8000 datarows, although we are using an index.
The stored procedure ist only faster about 8000 datarows.
For the first 20 rows the different is between 50 abd 20 percent and between and 20 and 2000 rows it fall down to 10 percent.
Over 8000 rows the stored procedure is faster!
The time series table looks like:
CREATE TABLE TimeSeries
OBJECT_ID NUMBER(8) NOT NULL,
UNIVERSAL_TIME NUMBER(10) NOT NULL,
LOCAL_TIME DATE NOT NULL,
MOD_TIME NUMBER(10),
USERID NUMBER(10),
VALUE NUMBER NOT NULL,
FLAG NUMBER(2) DEFAULT 0 NOT NULL
The foreinkey is object_id and another index is for universal_time and mod_time
The stored procedure looks like:
PROCEDURE SELECTDATA_UT_MOD (pObjectID IN NUMBER,
pType IN VARCHAR2,
pTable IN VARCHAR2,
pFrom IN NUMBER,
pTo IN NUMBER,
IO_CURSOR OUT T_CURSOR)
IS
SQLString VARCHAR2(1024);
BEGIN
IF pOBJECTID <> 0 THEN
CASE
WHEN UPPER(pTYPE)='A' THEN
SQLString := 'SELECT UNIVERSAL_TIME, VALUE, FLAG, MOD_TIME FROM ' || pTABLE || ' WHERE OBJECT_ID = :t1 AND UNIVERSAL_TIME >= :t2 and UNIVERSAL_TIME < :t3 Order By UNIVERSAL_TIME, MOD_TIME DESC';
OPEN IO_CURSOR FOR
SQLString USING pOBJECTID,pFROM,pTO;
END IF;
END;
The SQL statment for the data reader looks like:
SELECT d.universal_time, d.VALUE, d.flag, 0 AS mod_time
FROM daten d
WHERE object_id = 18465
AND d.universal_time >= 3600
AND d.universal_time < 28803600
ORDER BY d.universal_time, mod_time DESC
Do you have any idea or tip why the sql statment for the first 8000 rows is faster than the stored procedure?
Many thanks in advance and
Best regards
George
Edited by: hakomdba on 09.01.2009 06:39Hallo DB-Experts,
I have encountered a performance problem regarding getting a DataReader by stored procedure versus a SQL statment
and I want to know if this is an known issue and how to tune it.
Getting a DataReader through a SQL statment is faster than with a stored procedure,
if the number of data rows are less than about 8000 datarows, although we are using an index.
The stored procedure ist only faster about 8000 datarows.
For the first 20 rows the different is between 50 abd 20 percent and between and 20 and 2000 rows it fall down to 10 percent.
Over 8000 rows the stored procedure is faster!
The time series table looks like:
CREATE TABLE TimeSeries
OBJECT_ID NUMBER(8) NOT NULL,
UNIVERSAL_TIME NUMBER(10) NOT NULL,
LOCAL_TIME DATE NOT NULL,
MOD_TIME NUMBER(10),
USERID NUMBER(10),
VALUE NUMBER NOT NULL,
FLAG NUMBER(2) DEFAULT 0 NOT NULL
The foreinkey is object_id and another index is for universal_time and mod_time
The stored procedure looks like:
PROCEDURE SELECTDATA_UT_MOD (pObjectID IN NUMBER,
pType IN VARCHAR2,
pTable IN VARCHAR2,
pFrom IN NUMBER,
pTo IN NUMBER,
IO_CURSOR OUT T_CURSOR)
IS
SQLString VARCHAR2(1024);
BEGIN
IF pOBJECTID <> 0 THEN
CASE
WHEN UPPER(pTYPE)='A' THEN
SQLString := 'SELECT UNIVERSAL_TIME, VALUE, FLAG, MOD_TIME FROM ' || pTABLE || ' WHERE OBJECT_ID = :t1 AND UNIVERSAL_TIME >= :t2 and UNIVERSAL_TIME < :t3 Order By UNIVERSAL_TIME, MOD_TIME DESC';
OPEN IO_CURSOR FOR
SQLString USING pOBJECTID,pFROM,pTO;
END IF;
END;
The SQL statment for the data reader looks like:
SELECT d.universal_time, d.VALUE, d.flag, 0 AS mod_time
FROM daten d
WHERE object_id = 18465
AND d.universal_time >= 3600
AND d.universal_time < 28803600
ORDER BY d.universal_time, mod_time DESC
Do you have any idea or tip why the sql statment for the first 8000 rows is faster than the stored procedure?
Many thanks in advance and
Best regards
George
Edited by: hakomdba on 09.01.2009 06:39 -
Performance problem with java stored procedure
hi,
i developped a java class, then I stored it in Oracle 8.1.7.
This class contains several import of other classes stored in the database.
It works, but the execution perfomances are disappointing. It's very long. I guess, that's because of the great number of classes to load that are necessary for my class execution.
I tried to increase the size of the java pool (I parameter 70 Mo in the java_pool_size parameter of the init.ora), but the performance is not much better.
Has anyone an idea to increase the performance of this execution of my class ?
In particular, is there a way to keep permanently in memory the java objects used by my class ?
Thanks in advance
bye
[email protected]
nullbefore running Java, the database session needs to be Java enabled; this might be the reason why it is taking so long. If this is the case, you should see an improvement in subsequent calls, once a database session is Java enabled, other users can benefit from it.
Kuassi
I have some performance issue with java stored procedure. Hope some one will be able to help me out. I'm using java stored procedures in my application and basically these procedures are used to do some validation and form the XML message of the database tables. I have noticed that when I call the PL/SQL wrapper function, it is taking time to load the java class and once the class is loaded the execution is faster. Most of the time is spent for loading the class rather than executing the function. if I reduce the class load time, I can improve the performance drastically. Do any one of you know how to reduce the class load time. The following are the platform and oracle version.
O/S: IBM AIX
Oracle: 8.1.7 -
** JDBC Receiver - Oracle Stored Procedure - Large Records - Performance
Hi friends,
In my File to JDBC scenario, I use Oracle SP. I designed my target structure as mentioned in help.sap.com. In this scenario, the Sender file sends large no. of records, we have to update those records in the Oracle table. As per this requirement, I did mapping. I tested one file with 4 records. In SXMB_MONI, mapping works fine. I have given below the target payload. The message is processed successfully. (Still I have not created SP in database I am unable to check for the updating of records in the table).
My doubt is
1) Whether the target payload is correct ?
2) For each <STATMENT> tag, Will XI establish connectivity to JDBC and update the record ? If it is, in real time if we send large no. of records, ex: 50 thousand records, performance isssu will come or not?
3) How to solve the problem as said in point 2. (LookUp procedure etc)
Kindly reply friends. (If you have faced this problem ... kindly reply how to solve this issue)
Target Payload:
<?xml version="1.0" encoding="utf-8"?>
<ns1:PSABCL_Mumbai xmlns:eds="http://sdn.sap.com/sapxsl" xmlns:ns0="http://abc.xyz.com" xmlns:ns1="http://abc.xyz.com/ABCL/Finance">
<STATEMENT>
<SP_ABCL ACTION="EXECUTE">
<IF_ROW_STAT>FOR_IMPORT</IF_ROW_STAT><CON_FST_NAME>John</CON_FST_NAME><CON_LAST_NAME>Test001915</CON_LAST_NAME><CON_MID_NAME>W</CON_MID_NAME>
</SP_ABCL>
</STATEMENT>
<STATEMENT>
<SP_ABCL ACTION="EXECUTE">
<IF_ROW_STAT>FOR_IMPORT</IF_ROW_STAT><CON_FST_NAME>Josephine</CON_FST_NAME><CON_LAST_NAME>Walker</CON_LAST_NAME><CON_MID_NAME>Rose</CON_MID_NAME>
</SP_ABCL>
</STATEMENT>
<STATEMENT>
<SP_ABCL ACTION="EXECUTE">
</SP_ABCL>
</STATEMENT>
<STATEMENT>
<SP_ABCL ACTION="EXECUTE">
</SP_ABCL>
</STATEMENT>
</ns1:PSABCL_Mumbai>
Thanking You.
Kind Regards,
Jegathees P.Hi,
The structure should be -
<MsgType Name>
<StatementName>
<storedProcedureName action = "EXECUTE">
<table>
<List of Parameters isInput = "true" type = "STRING">
Map the table node to the stored procedure name.
Also,
For each statement, XI would make a database call. For better performance, do not check the button in CC - Open a new connection to database for each message.
Also another solution would be, collect all the data in the mapping to a comma or a pipe separated string in the mapping and have the statement node created only once. This way, though you have 5000 records, they all will be given to the SP in one DB call. you can also manage the mapping so that you will not send more the the X number of records to database in a single call. We are using an XML created in code in an UDF for this. The SP has to take care of stripping the comma or pipe separated values or the XML sent as a string input parameter.
VJ -
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 -
Performance to fetch result set from stored procedure.
I read some of related threads, but couldn't find any good suggestions about the performance issue to fetch the result set from a stored procedure.
Here is my case:
I have a stored procedure which will return 2,030,000 rows. When I run the select part only in the dbartisan, it takes about 3 minutes, so I know it's not query problem. But when I call the stored procedure in DBArtisan in following way:
declare cr SYS_REFCURSOR;
firstname char(20);
lastname char(20);
street char(40);
city char(20);
STATE varchar2(2);
begin DISPLAY_ADDRESS(cr);
DBMS_OUTPUT.ENABLE(null);
LOOP
FETCH cr INTO firstname,lastname,street, city, state;
EXIT WHEN cr%NOTFOUND;
DBMS_OUTPUT.PUT_LINE( firstname||','|| lastname||','|| street||',' ||city||',' ||STATE);
END LOOP;
CLOSE cr;
end;
It will take about 100 minutes. When I used DBI fetchrow_array in perl code, it took about same amount of time. However, same stored procedure in sybase without using cursor, and same perl code, it only takes 12 minutes to display all results. We assume oracle has better performance. So what could be the problem here?
The perl code:
my $dbh = DBI->connect($databaseserver, $dbuser, $dbpassword,
{ 'AutoCommit' => 0,'RaiseError' => 1, 'PrintError' => 0 })
or die "couldn't connect to database: " . DBI->errstr;
open OUTPUTFILE, ">$temp_output_path";
my $rc;
my $sql="BEGIN DISPLAY_ADDRESS(:rc); END;";
my $sth = $dbh->prepare($sql) or die "Couldn't prepare statement: " . $dbh->errstr;
$sth->bind_param_inout(':rc', \$rc, 0, { ora_type=> ORA_RSET });
$sth->execute() or die "Couldn't execute statement: " . $sth->errstr;
while($address_info=$rc->fetchrow_arrayref()){
my ($firstname, $lastname, $street, $city, $STATE) = @$address_info;
print OUTPUTFILE $firstname."|".$lastname."|".$street."|".$city."|".$STATE;
$dbh->commit();
$dbh->disconnect();
close OUTPUTFILE;
Thanks!
rulinThanks for you reply!
1) The stored procedure has head
CREATE OR REPLACE PROCEDURE X_OWNER.DISPLAY_ADDRESS
cv_1 IN OUT SYS_REFCURSOR
AS
err_msg VARCHAR2(100);
BEGIN
--Adaptive Server has expanded all '*' elements in the following statement
OPEN cv_1 FOR
Select ...
commit;
EXCEPTION
WHEN OTHERS THEN
err_msg := SQLERRM;
dbms_output.put_line (err_msg);
ROLLBACK;
END;
If I only run select .. in DBArtisan, it display all 2030,000 rows in 3:44 minutes
2) But when call stored procedure, it will take 80-100 minutes .
3) The stored procedure is translated from sybase using migration tools, it's very simple, in sybase it just
CREATE PROCEDURE X_OWNER.DISPLAY_ADDRESS
AS
BEGIN
select ..
The select part is exact same.
4) The perl code is almost exact same, except the query sql:
sybase verson: my $sql ="exec DISPLAY_ADDRESS";
and no need bind the cursor parameter.
This is batch job, we create a file with all information, and ftp to clients everynight.
Thanks!
Rulin -
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 -
Stored Procedures VS Indexed Views - Performance?
Hey folks,
In the past, one of the factors I'd consider when choosing to use a Stored Procedure over a View was the fact that the Stored Procedure would get optimized by storing the query execution path (I'm a developer so I understand this at a higher level than a
DBA would). But I've recently become aware of the fact that you can now Index your Views. This has now raised new questions for me as to when I'd get better performance out of the Indexed View versus the Stored Procedure?
Take for example the following:
SELECT colA, colB, sum(colC), sum(colD), colE
FROM myTable
WHERE colFDate < '9/30/2011'
GROUP BY colA, colB, colE
The date will be different every time it's run, so if this were a view, I wouldn't include the WHERE in the view and instead have that as part of my select against the View. If it were a stored procedure, the date would be a parameter.
If this were an Indexed View, should I expect to get better performance out of it then a stored procedure that's had an opportunity to cache the execution path? Or would the proc be faster? Or would
the difference be negligible? I know we could say "just try both out" but there are too many factors that could falsely bias the results, so I'd like to hear more of the theory behind it and what the expected outcomes are instead.
Thanks!Very cool. Thanks Dan. One question though. You said "
If you are using SQL Server Enterprise Edition, you do not need to select from the view directly. " I'm not sure what you mean here. Where would I selecting from if not from the view?
Thanks again!
What I mean is that if your query is semantically similar to the same query encapsulated in the view, the optimizer may be able to use the view index even though you specify the table in the query. For example, each of the queries below will scan
the view index in Enterprise (or Developer) edition instead of the underlying table:
CREATE VIEW dbo.vw_myTable
WITH SCHEMABINDING
AS
SELECT colFDate, colA, colB, SUM(colC) AS colC, SUM(colD) AS colD, colE, COUNT_BIG(*) AS countbig
FROM dbo.myTable
GROUP BY colA, colB, colE, colFDate
GO
CREATE UNIQUE CLUSTERED INDEX cdx_vw_myTable ON
dbo.vw_myTable(colA, colB, colE, colFDate);
GO
SELECT colA, colB, SUM(colC), SUM(colD), colE
FROM dbo.myTable
WHERE colFDate < '20110903'
GROUP BY colA, colB, colE;
GO
SELECT colA, colB, SUM(colC), SUM(colD), colE
FROM dbo.vw_myTable
WHERE colFDate < '20110903'
GROUP BY colA, colB, colE;
GO
SELECT colA, colB, SUM(colC), SUM(colD), colE
FROM dbo.vw_myTable WITH (NOEXPAND)
WHERE colFDate < '20110903'
GROUP BY colA, colB, colE;
GO
Dan Guzman, SQL Server MVP, http://www.dbdelta.com
Maybe you are looking for
-
Hi, I cant figure out how to put something over an area I painted on. Like I want to put text on an area I painted on but it just goes underneath the paint. What do I do? Thanks And happy April Fools Day
-
Intel Mac Mini fans run full blast even when off
Hi All, I have gone through the forums and haven't found an answer to this one. I have an Intel Mac Mini running the latest updated Tiger that I use solely for a media center. About a week ago, the box started running fans full blast, regardless of w
-
ABAP Program to Download in XLSX format
We have Excel 2007, I need an ABAP program which downloads data from XLSX format. Not in XLS format. Any FM which converts XLS to XLSX format? Moderator message: if you have searched and found this thread, please have another search for abap2xlsx. Me
-
Material status in master data set not allow create production order. but..
Dear All expert. There is one case I don't understand, the component material within BOM had been set material plant status which it is not allowed to create Production order ( Porder header Msg & PO/Network item msg = B in OMS4). If user use tx:CO0
-
I am trying to get the wright feeling with iWorks 08. Mac is new for me as I used to work with PC and office 2003 Pro. Now i changed to Mac because of several reasons. I downloaded the trial version of IWork08 and try to figure out what is available