Need to improve performance of oracle query
Hi ,
Currently i have written query to get maximun salary from XYZ company like this
select salary from (
select salary from employee
where company='XYZ'
order by salary desc )
where rownum<2;
i thought of replacing the same with following query
select max(salary)
from employee
where company='XYZ';
Which one will be faster ? can you provide some statistical data.It will be good if you share some oracle documentation for this.
Thanks,
Kannan
Most likely the second one. And in any case: the second one is much more straightforward and readable (i.e. the syntax describes exactly what you want: get the max salary). In that way, your application is better maintainable (i.e. cheaper and better in the long run), and likely more easy to optimize for the database. And yes, in this case it's a simple query, but if you're thinking of writing even simple queries in the style of your first example, I'd hate to think of what more complex queries would get to look like...
Similar Messages
-
Need to improve Performance of select...endselect query
Hi experts,
I have a query in my program like below with inner join of 3 tables.
In my program used select....endselect again inside this select...endselect statements used..
While executing in production taking lot of time to fetch records. Can anyone suggest to improve performance of below query urgently...
Greatly appreciated ur help...
SELECT MVKEDWERK MVKEMATNR MVKEVKORG MVKEVTWEG MARA~MATNR
MARAMTART ZM012MTART ZM012ZLIND ZM012ZPRICEREF
INTO (MVKE-DWERK , MVKE-MATNR , MVKE-VKORG , MVKE-VTWEG , MARA-MATNR
, MARA-MTART , ZM012-MTART , ZM012-ZLIND , ZM012-ZPRICEREF )
FROM ( MVKE
INNER JOIN MARA
ON MARAMATNR = MVKEMATNR
INNER JOIN ZM012
ON ZM012MTART = MARAMTART )
WHERE MVKE~DWERK IN SP$00004
AND MVKE~MATNR IN SP$00001
AND MVKE~VKORG IN SP$00002
AND MVKE~VTWEG IN SP$00003
AND MARA~MTART IN SP$00005
AND ZM012~ZLIND IN SP$00006
AND ZM012~ZPRICEREF IN SP$00007.
%DBACC = %DBACC - 1.
IF %DBACC = 0.
STOP.
ENDIF.
CHECK SP$00005.
CHECK SP$00004.
CHECK SP$00001.
CHECK SP$00002.
CHECK SP$00003.
CHECK SP$00006.
CHECK SP$00007.
clear Check_PR00.
select * from A004
where kappl = 'V'
and kschl = 'PR00'
and vkorg = mvke-vkorg
and vtweg = mvke-vtweg
and matnr = mvke-matnr
and DATAB le sy-datum
and DATBI ge sy-datum.
if sy-subrc = 0.
select * from konp
where knumh = a004-knumh.
if sy-subrc = 0.
Check_PR00 = konp-kbetr.
endif.
endselect.
endif.
endselect.
CHECK SP$00008.
clear Check_ZPR0.
select * from A004
where kappl = 'V'
and kschl = 'ZPR0'
and vkorg = mvke-vkorg
and vtweg = mvke-vtweg
and matnr = mvke-matnr
and DATAB le sy-datum
and DATBI ge sy-datum.
if sy-subrc = 0.
select * from konp
where knumh = a004-knumh.
if sy-subrc = 0.
Check_ZPR0 = konp-kbetr.
endif.
endselect.
endif.
endselect.
CHECK SP$00009.
clear ZFMP.
select * from A004
where kappl = 'V'
and kschl = 'ZFMP'
and vkorg = mvke-vkorg
and vtweg = mvke-vtweg
and matnr = mvke-matnr
and DATAB le sy-datum
and DATBI ge sy-datum.
if sy-subrc = 0.
select * from konp
where knumh = a004-knumh.
if sy-subrc = 0.
ZFMP = konp-kbetr.
endif.
endselect.
endif.
endselect.
CHECK SP$00010.
clear mastercost.
clear ZDCF.
select * from A004
where kappl = 'V'
and kschl = 'ZDCF'
and vkorg = mvke-vkorg
and vtweg = mvke-vtweg
and matnr = mvke-matnr
and DATAB le sy-datum
and DATBI ge sy-datum.
if sy-subrc = 0.
select * from konp
where knumh = a004-knumh.
if sy-subrc = 0.
ZDCF = konp-kbetr.
endif.
endselect.
endif.
endselect.
CHECK SP$00011.
clear masterprice.
clear Standardcost.
select * from mbew
where matnr = mvke-matnr
and bwkey = mvke-dwerk.
Standardcost = mbew-stprs.
mastercost = MBEW-BWPRH.
masterprice = mBEW-BWPH1.
endselect.
ADD 1 TO %COUNT-MVKE.
%LINR-MVKE = '01'.
EXTRACT %FG01.
%EXT-MVKE01 = 'X'.
EXTRACT %FGWRMVKE01.
ENDSELECT.
best rgds..
hari..Hi there.
Some advices:
- why going to MVKE first and MARA then? You will find n rows in MVKE for 1 matnr, and then go n times to the same record in MARA. Do the oposite, i.e, go first to MARA (1 time per matnr) and then to MVKE.
- avoid select *, you will save time.
- use trace or measure performance in tcodes ST05 and SM30.
- replace:
select * from konp
where knumh = a004-knumh.
if sy-subrc = 0.
Check_ZPR0 = konp-kbetr.
endif.
endselect.
by
select * from konp
where knumh = a004-knumh.
Check_ZPR0 = konp-kbetr.
exit.
endselect.
Here, if I understood, you only need to atribute kbetr value to Check_ZPR0 if selecting anything (don't need the IF because if enters in select, subrc always equal to 0, and also don't need to do it several times from same a004-knumh - reason for the EXIT.
Hope this helps.
Regards.
Valter Oliveira.
Edited by: Valter Oliveira on Jun 5, 2008 3:16 PM -
Need to improve performance for bex queries
Dear Experts,
Here we have bex queries buit on BW infoset, further infoset is buit on 2 dsos and 4 infoobjects.
we have built secondary indices to the two dso assuming will improve performance, but still query execution time is very long.
Could you suggest me on this.
Thanks in advance,
MannuHI,
Thanks for the repsonse.
But as I have mentioned the infoset is based on DSOs and Infoobjects. So we could not perform on aggregates.
in RSRT
I have tried look in read mode of the query i.e. in 'x', which is also valid as qurey needs to fetch huge data.
Could you pls look into other possible areas, in order to improve this.
Thanks in advance,
Mannu -
SLOW Query ... Need help improving performance
Database: Oracle 8i
Note: I don't have a whole lot of experience with writing queries, so please forgive me for any dumb mistakes I most likely made.
I have a query in which I have a SUM in two levels. I think this is probably the root cause of the very slow performance of the query. However, I just don't see any way around it, and can't come up with any other ways to speed up the query. The query itself only returns one line, the summary line. And, by slow, I mean it can take up to an hour or two. This is a query I need to run multiple times, based on some parameters that I cannot query from a database.
The query basically calculates the current unit cost of a part. It has to sum up the issue cost of the part (cost of material issued to the part's order), the actual dollars put into a part (labor, etc.), and the burden dollars associated with the part. This sum has to be divided by the total quantity of parts completed on the part's order to get the unit cost. I have to account for the possibility that the quantity complete is 0, so that I don't end up dividing by 0.
Below is my query, and sample data for it:
SELECT a.part_nbr
, a.mo_nbr
, a.unit_iss_cost
, CASE
WHEN a.qty_complete_ind ='Nonzero'
THEN SUM(a.act_dlrs/a.qty_complete)
ELSE 0
END AS unit_dlrs
, CASE
WHEN a.qty_complete_ind ='Zero'
THEN SUM(a.act_dlrs)
ELSE 0
END AS qty_0_dlrs
FROM ( SELECT act.part_nbr AS part_nbr
, act.order_nbr || '-' || act.sub_order_nbr AS mo_nbr
, ic.unit_iss_cost AS unit_iss_cost
, SUM (
act.act_dlrs_earned +
act.act_brdn_dls_earned +
act.tool_dlrs_earned +
act.act_fix_brdn_dls_ea
) AS act_dlrs
, ord.qty_complete AS qty_complete
, CASE
WHEN ord.qty_complete <>0
THEN 'Nonzero'
ELSE 'Zero'
END AS qty_complete_ind
FROM ACT act
, ISSUE_COST ic
, ORD ord
WHERE ord.ord_nbr =act.order_nbr AND
ord.sub_ord_nbr =act.sub_order_nbr AND
ord.major_seq_nbr =act.maj_seq_nbr AND
ic.ord_nbr =act.order_nbr AND
ic.sub_ord_nbr =act.sub_order_nbr AND
(act.order_nbr =LPAD(?,10,'0')) AND
(act.sub_order_nbr =LPAD(?,3,'0')) AND
(act.activity_date <=?)
GROUP BY act.part_nbr
, act.order_nbr || '-' || act.sub_order_nbr
, act.maj_seq_nbr
, ord.qty_complete
, ic.unit_iss_cost
) a
GROUP BY a.part_nbr
, a.mo_nbr
, a.unit_iss_cost
, a.qty_complete_ind
CREATE TABLE ACT
creation_date date
, c_id number (5,0)
, part_nbr varchar(25)
, order_nbr varchar(10)
, sub_order_nbr varchar(3)
, maj_seq_nbr varchar(4)
, act_dlrs_earned number (15,2)
, act_brdn_dls_earned number (15,2)
, tool_dlrs_earned number (15,2)
, act_fix_brdn_dls_ea number (15,2)
, activity_date date
CONSTRAINT ACT_PK
PRIMARY KEY (creation_date, c_id)
);--Please note, issue_cost is actually a view, not a table, but by itself it runs very quickly
CREATE TABLE ISSUE_COST
unit_iss_cost number(15,2)
, ord_nbr varchar(10)
, sub_ord_nbr varchar(3)
);--Please note, ord table has a couple of foreign keys that I did not mention
CREATE TABLE ORD
ord_nbr varchar(10)
, sub_ord_nbr varchar(3)
, major_seq_nbr varchar(4)
, qty_complete number (13,4)
);Sample tables:
ACT
creation_date c_id part_nbr order_nbr sub_order_nbr maj_seq_nbr act_dlrs_earned act_brdn_dls_earned tool_dlrs_earned act_fix_brdn_dls_ea activity_date
01/02/2000 12345 ABC-123 0000012345 001 0010 10.00 20.00 0.00 0.00 01/01/2000
01/02/2000 12345 XYZ-987 0000054321 001 0030 100.00 175.00 10.00 10.00 01/01/2000
01/03/2000 12347 ABC-123 0000012345 001 0020 25.00 75.00 5.00 1.00 01/02/2000
01/03/2000 12348 ABC-123 0000012345 001 0020 75.00 120.00 25.00 5.00 01/02/2000
01/03/2000 12349 XYZ-987 0000054321 001 0050 50.00 110.00 0.00 0.00 01/02/2000
01/04/2000 12350 ABC-123 0000012345 001 0030 25.00 40.00 0.00 0.00 01/03/2000
ISSUE_COST
unit_iss_cost ord_nbr sub_ord_nbr
125.00 0000012345 001
650.00 0000054321 001
ORD
ord_nbr sub_ord_nbr major_seq_nbr qty_complete
0000012345 001 0010 10
0000012345 001 0020 10
0000012345 001 0030 0
0000054321 001 0030 20
0000054321 001 0050 19If insert statements are needed for the sample tables, let me know and I'll go re-figure out how to write them. (I only have read-only access to the database I'm querying, so creating tables and inserting values aren't things I ever do).
Thanks in advance!For diagnosing where the time of your query is being spent, we don't need create table and insert statements. If we execute your query with only a handful of rows, the query will be very fast. What we do need to know, is the plan the optimizer takes to compute your result set, and the cardinalities of each step.
Please read When your query takes too long ... carefully and post the full explain plan and tkprof output.
Regards,
Rob. -
How to improve performance of Oracle Forms Server ?
Recently we converted our Application which was Developed in Forms 5.0 and Reports 3.0 into Forms6i to host that on to Web. We also loaded ORACLE 9iAS (on Windows NT 4 with service pack 3) from "Enterprise Edition" option by selecting Oracle Database Cache, Forms Server and Reports Server, HTTP Server(on port 80),Oracle Web Cache. Everything loaded succesfully including Caches.
Forms server is working perfectly and we were able to run our Application in Browser, but performance is the issue. We thought the caches will improve the performance, but it seems they are not at all working. When we run a report or form the Database cache is not giving any statistics whether a particular Query is a Hit or Miss though the cache is running. We got a doubt and searched in FAQ's and we found the following questions.
Oracle9iAS Web Cache Frequently Asked
Questions February 2001
Does Oracle9iAS Web Cache work with applications that use Oracle9iAS Forms?
Not in the 1.x release of Oracle9iAS. Integration between Oracle9iAS Web Cache and Oracle9iAS Forms will be addressed at a future date.
Oracle9iAS Database Cache
Does the Cache work with Oracle Forms and Portal in Oracle9i AS?
Since Oracle Forms and Portal utilize read/write PL/SQL stored procedures, these components cannot take advantage of the Cache. This support is being considered for a future version.
After coming to know that Caches doesnot boost the performance of Oracle Forms and reports. We have the following queries.
1) Clarify whether the above are True.
2) Apart from DB and Web Cache is there any other way where in we can improve the performance of Oracle Forms and Reports in Forms Server including the start up time.
3) What is the ideal configuration required for each tier (iAS Server,Database Server and Client) to host Forms on to Web considering our application as Medium scale.
(Presently our configuration are,
Application Server Configuration : Windows NT 4 with service pack 3,256 MB RAM,1 GB Virtual memory and 4GB free space and almost the same configuration is being used for
Database Configuration.
Client Configuration : Windows 98 with 64MB RAM).
4) Is there any way to track the performance and know the problem areas like TRACE.
Gopi Kumar
nullA couple of questions for you:
1) What version of IAS are you using?
2) What's the version of Forms&Reports and
3) What version of patch are you using if any
for forms&Reports?
4) What applications are you running on the
machine where Forms&Reports is installed?
(I mean non-Oracle applications?)
The problem could be that, the base addresses
of the DLL's in Forms&Reports could be having base address conflicts with some other application's DLL's.
Forms and Reports needs to be fully rebased to achieve full performance on NT. Before release of Forms and Reports, Oracle rebases all DLLs. Rebasing assigns unique base addresses to all of the DLL's in use by an executable. A properly based DLL will load at its preferred base address, greatly improving the efficiency of memory utilization and the runtime performance of the executable.
Multiple utilities are available on NT to verify proper rebasing of DLLs. HandleEx v4.0 is one such freeware from Sysinternals and is available at www.sysinternals.com. Some others are "depends.exe" that's part of the MS Visual Studio or msinfo32.exe that comes with Office 2000 on NT.
If after running any of these utilities you discover that the DLL's ar not properly rebased, you need to contact Oracle worldwide support.
If you find that rebasing is not the problem, then please post your feedback again. Hope this helps. -
How to improve performance of attached query
Hi,
How to improve performance of the below query, Please help. also attached explain plan -
SELECT Camp.Id,
rCam.AccountKey,
Camp.Id,
CamBilling.Cpm,
CamBilling.Cpc,
CamBilling.FlatRate,
Camp.CampaignKey,
Camp.AccountKey,
CamBilling.billoncontractedamount,
(SUM(rCam.Impressions) * 0.001 + SUM(rCam.Clickthrus)) AS GR,
rCam.AccountKey as AccountKey
FROM Campaign Camp, rCamSit rCam, CamBilling, Site xSite
WHERE Camp.AccountKey = rCam.AccountKey
AND Camp.AvCampaignKey = rCam.AvCampaignKey
AND Camp.AccountKey = CamBilling.AccountKey
AND Camp.CampaignKey = CamBilling.CampaignKey
AND rCam.AccountKey = xSite.AccountKey
AND rCam.AvSiteKey = xSite.AvSiteKey
AND rCam.RmWhen BETWEEN to_date('01-01-2009', 'DD-MM-YYYY') and
to_date('01-01-2011', 'DD-MM-YYYY')
GROUP By rCam.AccountKey,
Camp.Id,
CamBilling.Cpm,
CamBilling.Cpc,
CamBilling.FlatRate,
Camp.CampaignKey,
Camp.AccountKey,
CamBilling.billoncontractedamount
Explain Plan :-
Description Object_owner Object_name Cost Cardinality Bytes
SELECT STATEMENT, GOAL = ALL_ROWS 14 1 13
SORT AGGREGATE 1 13
VIEW GEMINI_REPORTING 14 1 13
HASH GROUP BY 14 1 103
NESTED LOOPS 13 1 103
HASH JOIN 12 1 85
TABLE ACCESS BY INDEX ROWID GEMINI_REPORTING RCAMSIT 2 4 100
NESTED LOOPS 9 5 325
HASH JOIN 7 1 40
SORT UNIQUE 2 1 18
TABLE ACCESS BY INDEX ROWID GEMINI_PRIMARY SITE 2 1 18
INDEX RANGE SCAN GEMINI_PRIMARY SITE_I0 1 1
TABLE ACCESS FULL GEMINI_PRIMARY SITE 3 27 594
INDEX RANGE SCAN GEMINI_REPORTING RCAMSIT_I 1 1 5
TABLE ACCESS FULL GEMINI_PRIMARY CAMPAIGN 3 127 2540
TABLE ACCESS BY INDEX ROWID GEMINI_PRIMARY CAMBILLING 1 1 18
INDEX UNIQUE SCAN GEMINI_PRIMARY CAMBILLING_U1 0 1duplicate thread..
How to improve performance of attached query -
Help required for improving performance of the Query
Hello SAP Techies,
I have MRP Query which shows Inventory projection by Calendar Year/Month wise.
There are 2 variables Plant and Material in free charateristics where it has been restricted by replacement of Query result .
Another query is Control M Query which is based on multiprovider. Multiprovider is created on 5 cubes.
The Query is taking 20 -15 Mins to get the result.
Due to replacement path by query result for the 2 variables first the control M Query is excuted. Business wanted to see all those materials in MRP query which are allocated to base plant hence they designed the query to use replacement Path by Query result. So it will get all the materials and plants from the control M query and will find the Invetory projection for the same selection in MRP query.
Is there any way I can improve the performance of the Query.
Query performance has been discussed innumerable times in the forums and there is a lot of information on the blogs and the WIKI - please search the forums before posting and if the existing posts do no answer your question satisfactorily then please raise a new post - else almost all the answers you get will be rehashed versions of previous posts ( and in most cases without attribution to the original author )
Edited by: Arun Varadarajan on Apr 19, 2011 9:23 PMHi ,
Please see if you can make these changes currently to the report . It will help in improving the performance of the query
1. Select the right read mode.
Reading data during navigation minimizes the impact on
the application server resources because only data that
the user requires will be retrieved.
2. Leverage filters as much as possible. Using filters contributes to
reducing the number of database reads and the size of the result set,
hereby significantly improving query runtimes.
Filters are especially valuable when associated with u201Cbig
dimensionsu201D where there is a large number of characteristics such as
customers and document numbers.
3. Reduce RKFs in the query to as few as possible. Also, define
calculated & RKFs on the Infoprovider level instead of locally within the query.
Regards
Garima -
How to improve performance of a query that is based on an xmltype table
Dear Friends,
I have a query that is pulling records from an xmltype table with 9000 rows and it is running very slow.
I am using XMLTABLE command to retreive the rows. It is taking upto 30 minutes to finish.
Would you be able to suggest how I can make it faster. Thanks.
Below is the query.....
INSERT INTO temp_sap_po_receipt_history_t
(po_number, po_line_number, doc_year,
material_doc, material_doc_item, quantity, sap_ref_doc_no_long,
reference_doc, movement_type_code,
sap_ref_doc_no, posting_date, entry_date, entry_time, hist_type)
SELECT :pin_po_number po_number,
b.po_line_number, b.doc_year,
b.material_doc, b.material_doc_item, b.quantity, b.sap_ref_doc_no_long,
b.reference_doc, b.movement_type_code,
b.sap_ref_doc_no, to_date(b.posting_date,'rrrr-mm-dd'),
to_date(b.entry_date,'rrrr-mm-dd'), b.entry_time, b.hist_type
FROM temp_xml t,
XMLTABLE(XMLNAMESPACES('urn:sap-com:document:sap:rfc:functions' AS "n0"),
'/n0:BAPI_PO_GETDETAIL1Response/POHISTORY/item'
PASSING t.object_value
COLUMNS PO_LINE_NUMBER VARCHAR2(20) PATH 'PO_ITEM',
DOC_YEAR varchar2(4) PATH 'DOC_YEAR',
MATERIAL_DOC varchar2(30) PATH 'MAT_DOC',
MATERIAL_DOC_ITEM VARCHAR2(10) PATH 'MATDOC_ITEM',
QUANTITY NUMBER(20,6) PATH 'QUANTITY',
SAP_REF_DOC_NO_LONG VARCHAR2(20) PATH 'REF_DOC_NO_LONG',
REFERENCE_DOC VARCHAR2(20) PATH 'REF_DOC',
MOVEMENT_TYPE_CODE VARCHAR2(4) PATH 'MOVE_TYPE',
SAP_REF_DOC_NO VARCHAR2(20) PATH 'REF_DOC_NO',
POSTING_DATE VARCHAR2(10) PATH 'PSTNG_DATE',
ENTRY_DATE VARCHAR2(10) PATH 'ENTRY_DATE',
ENTRY_TIME VARCHAR2(8) PATH 'ENTRY_TIME',
HIST_TYPE VARCHAR2(5) PATH 'HIST_TYPE') b;Based on response from mdrake on this thread:
Re: XML file processing into oracle
For large XML's, you can speed up the processing of XMLTABLE by using a registered schema...
declare
SCHEMAURL VARCHAR2(256) := 'http://xmlns.example.org/xsd/testcase.xsd';
XMLSCHEMA VARCHAR2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
<xs:element name="cust_order" type="cust_orderType" xdb:defaultTable="CUST_ORDER_TBL"/>
<xs:complexType name="groupType" xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="item" type="itemType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" type="xs:byte" use="required"/>
</xs:complexType>
<xs:complexType name="itemType" xdb:maintainDOM="false">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:short" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="cust_orderType" xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="group" type="groupType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="cust_id" type="xs:short" use="required"/>
</xs:complexType>
</xs:schema>';
INSTANCE CLOB :=
'<cust_order cust_id="12345">
<group id="1">
<item id="1" name="Standard Mouse">100</item>
<item id="2" name="Keyboard">100</item>
<item id="3" name="Memory Module 2Gb">200</item>
<item id="4" name="Processor 3Ghz">25</item>
<item id="5" name="Processor 2.4Ghz">75</item>
</group>
<group id="2">
<item id="1" name="Graphics Tablet">15</item>
<item id="2" name="Keyboard">15</item>
<item id="3" name="Memory Module 4Gb">15</item>
<item id="4" name="Processor Quad Core 2.8Ghz">15</item>
</group>
<group id="3">
<item id="1" name="Optical Mouse">5</item>
<item id="2" name="Ergo Keyboard">5</item>
<item id="3" name="Memory Module 2Gb">10</item>
<item id="4" name="Processor Dual Core 2.4Ghz">5</item>
<item id="5" name="Dual Output Graphics Card">5</item>
<item id="6" name="28inch LED Monitor">10</item>
<item id="7" name="Webcam">5</item>
<item id="8" name="A3 1200dpi Laser Printer">2</item>
</group>
</cust_order>';
begin
dbms_xmlschema.registerSchema
schemaurl => SCHEMAURL
,schemadoc => XMLSCHEMA
,local => TRUE
,genTypes => TRUE
,genBean => FALSE
,genTables => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
execute immediate 'insert into CUST_ORDER_TBL values (XMLTYPE(:INSTANCE))' using INSTANCE;
end;
SQL> desc CUST_ORDER_TBL
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "http://xmlns.example.org/xsd/testcase.xsd" Element "cust_order") STORAGE Object-relational TYPE "cust_orderType222_T"
SQL> set autotrace on explain
SQL> set pages 60 lines 164 heading on
SQL> col cust_id format a8
SQL> select extract(object_value,'/cust_order/@cust_id') as cust_id
2 ,grp.id as group_id, itm.id as item_id, itm.inm as item_name, itm.qty as item_qty
3 from CUST_ORDER_TBL
4 ,XMLTABLE('/cust_order/group'
5 passing object_value
6 columns id number path '@id'
7 ,item xmltype path 'item'
8 ) grp
9 ,XMLTABLE('/item'
10 passing grp.item
11 columns id number path '@id'
12 ,inm varchar2(30) path '@name'
13 ,qty number path '.'
14 ) itm
15 /
CUST_ID GROUP_ID ITEM_ID ITEM_NAME ITEM_QTY
12345 1 1 Standard Mouse 100
12345 1 2 Keyboard 100
12345 1 3 Memory Module 2Gb 200
12345 1 4 Processor 3Ghz 25
12345 1 5 Processor 2.4Ghz 75
12345 2 1 Graphics Tablet 15
12345 2 2 Keyboard 15
12345 2 3 Memory Module 4Gb 15
12345 2 4 Processor Quad Core 2.8Ghz 15
12345 3 1 Optical Mouse 5
12345 3 2 Ergo Keyboard 5
12345 3 3 Memory Module 2Gb 10
12345 3 4 Processor Dual Core 2.4Ghz 5
12345 3 5 Dual Output Graphics Card 5
12345 3 6 28inch LED Monitor 10
12345 3 7 Webcam 5
12345 3 8 A3 1200dpi Laser Printer 2
17 rows selected.Need at least 10.2.0.3 for performance i.e. to avoid COLLECTION ITERATOR PICKLER FETCH in execution plan...
On 10.2.0.1:
Execution Plan
Plan hash value: 3741473841
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 24504 | 89M| 873 (1)| 00:00:11 |
| 1 | NESTED LOOPS | | 24504 | 89M| 873 (1)| 00:00:11 |
| 2 | NESTED LOOPS | | 3 | 11460 | 805 (1)| 00:00:10 |
| 3 | TABLE ACCESS FULL | CUST_ORDER_TBL | 1 | 3777 | 3 (0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | SYS_IOT_TOP_774117 | 3 | 129 | 1 (0)| 00:00:01 |
| 5 | COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE | | | | |
Predicate Information (identified by operation id):
4 - access("NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
filter("SYS_NC_TYPEID$" IS NOT NULL)
Note
- dynamic sampling used for this statementOn 10.2.0.3:
Execution Plan
Plan hash value: 1048233240
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 17 | 132K| 839 (0)| 00:00:11 |
| 1 | NESTED LOOPS | | 17 | 132K| 839 (0)| 00:00:11 |
| 2 | MERGE JOIN CARTESIAN | | 17 | 131K| 805 (0)| 00:00:10 |
| 3 | TABLE ACCESS FULL | CUST_ORDER_TBL | 1 | 3781 | 3 (0)| 00:00:01 |
| 4 | BUFFER SORT | | 17 | 70839 | 802 (0)| 00:00:10 |
|* 5 | INDEX FAST FULL SCAN| SYS_IOT_TOP_56154 | 17 | 70839 | 802 (0)| 00:00:10 |
|* 6 | INDEX UNIQUE SCAN | SYS_IOT_TOP_56152 | 1 | 43 | 2 (0)| 00:00:01 |
|* 7 | INDEX RANGE SCAN | SYS_C006701 | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
5 - filter("SYS_NC_TYPEID$" IS NOT NULL)
6 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
w5Ysl6x9w=="."SYS_NC0000600007$")
filter("SYS_NC_TYPEID$" IS NOT NULL AND
"NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
7 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
w5Ysl6x9w=="."SYS_NC0000600007$")
Note
- dynamic sampling used for this statement----------------------------------------------------------------------------------------------------------
-- CLEAN UP
DROP TABLE CUST_ORDER_TBL purge;
exec dbms_xmlschema.deleteschema('http://xmlns.example.org/xsd/testcase.xsd'); -
How to improve performance of my query
Hello Friends,
Good Morning.
I am having the following query which is never ending - Can any one throw some light on how to improve the performance of my said said query ..This is the query generated in ODI ( ORACLE DATA INTEGRATOR 11G )
The only thing I can put in this query is optimizers
- issue resolved
Please advice .
Thanks / Kumar
Edited by: kumar73 on May 18, 2012 6:38 AM
Edited by: kumar73 on May 18, 2012 6:39 AM
Edited by: kumar73 on May 18, 2012 12:04 PMThe two DISTINCTs are redundant, as UNION results in unique records, as a set can't have duplicates.
Other than that the query is not formatted and unreadable, and you didn't provide a description of the tables involved.
Your strategy seems to be maximum help from this forum with minimum effort from yourself, other than hitting copy and paste.
Sybrand Bakker
Senior Oracle DBA -
Utl_raw.bit_and - how can I improve performance of this query?
Hi all
Hugely grateful for any light anyone can shed.
I need to do bit AND operations on 128 bit numbers and I'm stuck in Oracle 10g.
10g provides a very nice bitand() function that can be applied to numbers but it only works up to 64 bit numbers (actually only 62 I think because it needs a couple of bits)
So I've been looking at using the utl_raw.bit_and function. It works very well, except that I'm encountering a massive performance hit, which hopefully is in the way I'm using it, rather than intrinsic to the speed at which utl_raw.bit_and itself performs..
With numbers, I do a query like this:
select count(1) from offer_a where bitand(bit_column, 51432) = 51432
With utl_raw.bit_and (and 16-byte RAW column), I am passing in a hex value (may not be the best thing? Would passing in binary be better?) and doing my query like this:
select count(1) from offer_a where utl_raw.bit_and(bit_column,hextoraw('00000000000000000020008000002ca1')) = hextoraw('00000000000000000020008000002ca1');
One million rows using bitand takes about a second, using utl_raw.bit_and like this takes 25 seconds or so!!! Hopefully it's something in the way I'm calling it, and there's a faster way?
Thank you!
JakeHmm.. Actually it may not be that simple.
I had created an index on the number column that oracle seems to consistently use if I do a query like:
select count(1) from scott.offer_b where
current_price >= 0 and
bitand(current_price, 9008574719100165) = 9008574719100165
(without the >= oracle seems to do a full table scan. The reason I created the index is that there's other columns in the data table, making larger blocks. I figured that an index, even though most of needs to be scanned, would be faster because I can cram many more rows into each block..?).
But if I drop the index on the number column, it takes about 12 secs/1m rows, in other words about half the time of the utl_raw.bit_and().
So it's possible that bitand on 64 bits takes about half the time of utl_raw.bit_and on 128 bits, which is very reasonable..
So maybe the real problem I have is why oracle is not using the equivalent index that I placed on the RAW column when I do:
select count(1) from scott.offer_b where
hex_bit_sig >= '00000000000000000020008000002ca1' and
utl_raw.bit_and(hex_bit_sig,'00000000000000000020008000002ca1') = '00000000000000000020008000002ca1';
(By the way I realized that I don't need to use the hextoraw - seems like just putting a hex number in '' is the right way to specify a raw anyway?)
So yes, I think that's the real problem - how can I get oracle to use the index I created on the RAW value -
Need to Improve Performance on a Spatial Boundary Crossing Calculator
I am attempting to compare a series of geometries to calculate a number of statistics where they overlap. Essentially I have a table of 50,000 lines and another table of 1000 circles. I need to determine which lines overlap each circle, and for each intersection, I need to determine how much time and distance each line spends in each circle.
I have a PL/SQL program that performs this operation now and it works. The problem is that it takes far too long.
Here is a summary of how the job runs:
1) For each LINE, determine which CIRCLES it overlaps with
2) Each each LINE/CIRCLE pair, determine the intersection points
3) Insert the intersection points in a temporary table
4) Once you have all the points, pair them up as Entry/Exit points for each circle
5) Calculate duration (time) and distance between entry and exit points
6) Return to step 1 for next LINE
There are multiple loops here:
1-6 is the outer loop performed once for each of the 50,000 lines.
2-3 is performed once for each line/circle pair (probable avg of 5 circles per line)
4-5 is performed once again for each line/circle pair
Even if the process only takes a couple of seconds per LINE, we are still taking more than 24 hours to process, which is not acceptable.
This original process was written with 9i, and I am now running 10gR2, so I know there are new features that should help. For starters, I think I can use SDO_JOIN in place of the original outer loop to generate a complete list of geometry interactions in one query. Of course, I am still concerned about how long that might take.
Even more troubling is, if that works, I still don't see how to improve the rest of the calculations. Any suggestions would be appreciated.No, I don't mind providing it.
Here it is:
-- cre_&stab._bndxing.sql
--Procedure definition of bndxings
def stab=&1
CREATE OR REPLACE PROCEDURE Find_&stab._bndxings
(theDate IN DATE, theStr IN VARCHAR2) IS
--Select flights from table
CURSOR FCursor IS
SELECT new_Flight_Index,
Acid,
New_Act_Date,
Dept_Aprt,
Dep_Time,
Arr_Aprt,
Arr_Time,
Acft_Type,
Physical_Class,
User_Class,
Nrp,
d_lat,
d_lon,
a_lat,
a_lon,
flight_track
FROM jady.Flight
WHERE new_act_date = theDate
AND flight_track IS NOT NULL
AND substr(acid,1,1) = theStr
--AND acid in (select acid from name_temp)
--AND acid = 'AAL1242'
ORDER BY acid,new_flight_index;
--Temp vars for storing flight info
fi_var NUMBER;
acid_var VARCHAR2(7);
dep_time_var DATE;
arr_time_var DATE;
F_Rec FCursor%ROWTYPE;
--Temp vars for flight
tcnt INTEGER;
cur_lat NUMBER;
cur_lon NUMBER;
last_lat NUMBER;
last_lon NUMBER;
--Temp vars for airspace and xing geometries
aname VARCHAR2(20);
bxings MDSYS.SDO_GEOMETRY;
bxcnt INTEGER;
--Select xings made from temp bndxing table
CURSOR XCursor IS
SELECT Act_Date,
Name,
Lon,
Lat,
Alt,
Time,
OPS
FROM bndxing_tmp
WHERE Flight_Index = fi_var
AND Acid = acid_var
ORDER BY Name,Time;
--Temp vars for paired in/out xings
ad date;
ilon NUMBER;
ilat NUMBER;
ialt NUMBER;
isec NUMBER;
iops NUMBER;
olon NUMBER;
olat NUMBER;
oalt NUMBER;
osec NUMBER;
oops NUMBER;
gcr NUMBER;
dist NUMBER;
dura NUMBER;
ops VARCHAR2(1);
i INTEGER;
i_aname VARCHAR2(20);
o_aname VARCHAR2(20);
names_match BOOLEAN;
theSeq NUMBER;
same_airport_no_tzdata BOOLEAN;
-- Cursor and variables for bndxing sequencing
CURSOR BCursor IS
SELECT * FROM bndxing
WHERE act_date = theDate
AND Acid = acid_var
AND Flight_Index = fi_var
ORDER BY in_time
FOR UPDATE;
BRec BCursor%ROWTYPE;
--Error logging variable
strErrorMessage VARCHAR2(255);
BEGIN --Start of Main Loop
--Loop for each flight in table
OPEN FCursor;
FETCH FCursor INTO F_Rec;
-- FOR f IN FCursor LOOP
WHILE FCursor%FOUND LOOP
fi_var:= F_Rec.new_Flight_Index;
acid_var := F_Rec.acid;
arr_time_var := F_Rec.arr_time;
dep_time_var := F_Rec.dep_time;
last_lat := -10000; --initializtion
last_lon := -10000; --initializtion
-- DEBUG STATEMENT
/* Insert into bnd_error values (err_seq.NEXTVAL,
sysdate,
F_Rec.Acid,
F_Rec.new_Flight_Index,
'Checkpoint 1');
--Add departing xing to temp table if in US airspace
DECLARE
CURSOR DepCur IS
SELECT Name
FROM &stab.
WHERE SDO_RELATE(Airspace,
MDSYS.SDO_GEOMETRY(2001,8307,
MDSYS.SDO_POINT_TYPE(F_Rec.d_lon,F_Rec.d_lat,null),
null, null),
'mask=CONTAINS querytype=WINDOW') = 'TRUE';
BEGIN -- Start of Departing Airspace Loop
FOR c in DepCur LOOP
INSERT INTO Bndxing_Tmp VALUES (F_Rec.new_Flight_Index,
F_Rec.acid,
F_Rec.New_Act_Date,
c.name,
2,
F_Rec.d_lon,
F_Rec.d_lat,
0,
(F_Rec.Dep_Time-F_Rec.New_Act_Date)*86400);
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
WHEN OTHERS THEN
strErrorMessage := SQLERRM;
INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
sysdate,
F_Rec.Acid,
F_Rec.new_Flight_Index,
'Exception from Departing Airspace loop: ' || strErrorMessage);
COMMIT;
END; -- End of Departing Airspace Loop
--Add arrival xing to temp table if in US airspace
DECLARE
CURSOR ArrCur IS
SELECT name
FROM &stab.
WHERE SDO_RELATE(Airspace,
MDSYS.SDO_GEOMETRY(2001,8307,
MDSYS.SDO_POINT_TYPE(F_Rec.a_lon, F_Rec.a_lat, null),
null, null),
'mask=CONTAINS querytype=WINDOW') = 'TRUE';
BEGIN -- Start of Arrival Airspace Loop
FOR c IN ArrCur LOOP
INSERT INTO Bndxing_Tmp VALUES (F_Rec.new_Flight_Index,
F_Rec.acid,
F_Rec.New_Act_Date,
c.name,
1,
F_Rec.a_lon,
F_Rec.a_lat,
0,
(F_Rec.Arr_Time - F_Rec.New_Act_Date)*86400);
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
WHEN OTHERS THEN
strErrorMessage := SQLERRM;
INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
sysdate,
F_Rec.Acid,
F_Rec.new_Flight_Index,
'Exception from Arrival Airspace loop: ' || strErrorMessage);
COMMIT;
END; -- End of Arrival Airspace Loop
--DEBUG STATEMENT
/* Insert into bnd_error values (err_seq.NEXTVAL,
sysdate,
F_Rec.Acid,
F_Rec.new_Flight_Index,
'Checkpoint 4');
--Find all intersections between the flight track and airspace boundaries and insert into temp table
DECLARE
--Find airspace boundaries that interact with the flight track
CURSOR CCursor IS
SELECT Name, Boundary
FROM &stab.
WHERE SDO_RELATE(boundary,F_Rec.flight_track,'mask=OVERLAPBDYDISJOINT querytype=WINDOW')='TRUE';
BEGIN
FOR c IN CCursor LOOP
bxings := SDO_GEOM.SDO_INTERSECTION(c.boundary,F_Rec.flight_track,10);
bxcnt:=bxings.sdo_ordinates.count;
LOOP
INSERT INTO bndxing_tmp VALUES (F_Rec.new_Flight_Index,
F_Rec.acid,
F_Rec.New_Act_Date,
c.name,
0,
bxings.sdo_ordinates(bxcnt-3),
bxings.sdo_ordinates(bxcnt-2),
bxings.sdo_ordinates(bxcnt-1),
SDO_LRS.FIND_MEASURE(F_Rec.flight_track,
MDSYS.SDO_GEOMETRY(2001,8307,NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),
MDSYS.SDO_ORDINATE_ARRAY(bxings.sdo_ordinates(bxcnt-3),
bxings.sdo_ordinates(bxcnt-2)))));
bxcnt := bxcnt - 4;
EXIT WHEN (bxcnt < 1);
END LOOP;
END LOOP; -- end CCursor LOOP
EXCEPTION
WHEN OTHERS THEN
strErrorMessage := SQLERRM;
INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
sysdate,
F_Rec.Acid,
F_Rec.new_Flight_Index,
'Exception from bndxing loop: ' || strErrorMessage);
COMMIT;
END;
--DEBUG STATEMENT
/* Insert into bnd_error values (err_seq.NEXTVAL,
sysdate,
F_Rec.Acid,
F_Rec.new_Flight_Index,
'Checkpoint 6');
--After all xings for a flight have been collected sort Xings by name and time and grab pairwise
theSeq :=0;
OPEN XCursor;
BEGIN -- Start of Stats Loop
LOOP
FETCH XCursor INTO ad, i_aname, ilon, ilat, ialt, isec, iops; --CHANGED CODE
EXIT WHEN XCursor%NOTFOUND ;
FETCH XCursor INTO ad, o_aname, olon, olat, oalt, osec, oops; --CHANGED CODE
EXIT WHEN XCursor%NOTFOUND ;
names_match := (i_aname = o_aname); --NEW CODE
WHILE not names_match LOOP --NEW CODE
i_aname := o_aname; --NEW CODE
ilon := olon; --NEW CODE
ilat := olat; --NEW CODE
ialt := oalt; --NEW CODE
isec := osec; --NEW CODE
iops := oops; --NEW CODE
FETCH XCursor INTO ad, o_aname, olon, olat, oalt, osec, oops; --NEW CODE
EXIT WHEN XCursor%NOTFOUND; --NEW CODE
names_match := (i_aname = o_aname); --NEW CODE
END LOOP; --NEW CODE
--Calculate stats
BEGIN -- Start of In Values Loop
i:=4;
IF (iops<>2) THEN
-- Did not depart from this airspace, calculate entry altitude into airspace.
LOOP
i:=i+4;
EXIT WHEN F_Rec.flight_track.sdo_ordinates(i)>isec;
END LOOP;
IF ( F_Rec.flight_track.sdo_ordinates(i-1) = F_Rec.flight_track.sdo_ordinates(i-5) ) THEN
ialt := F_Rec.flight_track.sdo_ordinates(i-1);
ELSE
ialt:=SDO_LRS.FIND_MEASURE(
MDSYS.SDO_GEOMETRY(3302,8307,NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),
MDSYS.SDO_ORDINATE_ARRAY(F_Rec.flight_track.sdo_ordinates(i-7),
F_Rec.flight_track.sdo_ordinates(i-6),
F_Rec.flight_tracK.sdo_ordinates(i-5),
F_Rec.flight_track.sdo_ordinates(i-3),
F_Rec.flight_track.sdo_ordinates(i-2),
F_Rec.flight_track.sdo_ordinates(i-1))),
MDSYS.SDO_GEOMETRY(2001,8307,NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),
MDSYS.SDO_ORDINATE_ARRAY(ilon,ilat)));
END IF;
END IF;
EXCEPTION
WHEN OTHERS THEN
strErrorMessage := SQLERRM;
INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
sysdate,
F_Rec.Acid,
F_Rec.new_Flight_Index,
'Exception from In Values section: ' || strErrorMessage);
COMMIT;
END; -- End of In Values Loop
BEGIN -- Start of Out Values Loop
i:=4;
IF (oops<>1) THEN
-- Did not arrive in this airspace, calculate departure altitude from airspace.
LOOP
i:=i+4;
EXIT WHEN F_Rec.flight_track.sdo_ordinates(i)>osec;
END LOOP;
--Find alt at this time
IF ( F_Rec.flight_track.sdo_ordinates(i-1) = F_Rec.flight_track.sdo_ordinates(i-5) ) THEN
oalt := F_Rec.flight_track.sdo_ordinates(i-1);
ELSE
oalt:=SDO_LRS.FIND_MEASURE(
MDSYS.SDO_GEOMETRY(3302, 8307, NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),
MDSYS.SDO_ORDINATE_ARRAY(F_Rec.flight_track.sdo_ordinates(i-7),
F_Rec.flight_track.sdo_ordinates(i-6),
F_Rec.flight_track.sdo_ordinates(i-5),
F_Rec.flight_track.sdo_ordinates(i-3),
F_Rec.flight_track.sdo_ordinates(i-2),
F_Rec.flight_track.sdo_ordinates(i-1))),
MDSYS.SDO_GEOMETRY(2001,8307,NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),
MDSYS.SDO_ORDINATE_ARRAY(olon,olat)));
END IF;
END IF;
EXCEPTION
WHEN OTHERS THEN
strErrorMessage := SQLERRM;
INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
sysdate,
F_Rec.Acid,
F_Rec.new_Flight_Index,
'Exception from Out Values loop: ' || strErrorMessage);
COMMIT;
END; -- End of Out Values Loop
BEGIN -- Start of Finish Loop
--Find GCR, actual distance and duration in airspace
gcr := SDO_GEOM.SDO_DISTANCE(MDSYS.SDO_GEOMETRY(2001,8307,
MDSYS.SDO_POINT_TYPE(ilon,ilat,NULL),NULL,NULL),
MDSYS.SDO_GEOMETRY(2001,8307,
MDSYS.SDO_POINT_TYPE(olon,olat,NULL),NULL,NULL),
10,'unit=naut_mile');
--DEBUG STATEMENT
/* Insert into bnd_error values (err_seq.NEXTVAL,
sysdate,
F_Rec.Acid,
F_Rec.new_Flight_Index,
'In Finish Loop: isec: ' ||isec||' osec: '||osec
||' airspace: '||i_aname);
dist := SDO_GEOM.SDO_LENGTH(SDO_LRS.CLIP_GEOM_SEGMENT(F_Rec.flight_track,isec,osec),10,'unit=naut_mile');
dura := (osec - isec);
--Set OPS Flag
iops := iops + oops;
IF (iops=3) THEN
ops := 'B';
ELSIF (iops=2) THEN
ops := 'D';
ELSIF (iops=1) THEN
ops := 'A';
ELSE
ops := 'O';
END IF;
theSeq := theSeq + 1;
--Insert into Bndxing table
INSERT INTO Bndxing VALUES (F_Rec.Acid,
F_Rec.new_Flight_Index,
F_Rec.New_Act_Date,
theSeq,
F_Rec.Dept_Aprt,
F_Rec.Arr_Aprt,
i_aname,
round(ilon,3),
round(ilat,3),
ialt,
isec/86400 + ad,
NULL, -- IN_SPEED (TBD)
round(olon,3),
round(olat,3),
oalt,
osec/86400 + ad,
NULL, -- OUT_SPEED (TBD)
gcr,
dist,
dura,
ops, -- CHANGED CODE
nvl(F_Rec.Acft_Type,'----'),
NULL, -- IF_FLAG (NULL)
nvl(F_Rec.Physical_Class,'-'),
nvl(F_Rec.User_Class,'-'),
F_Rec.Nrp,
NULL, -- FFS_FLAG (NULL)
NULL, -- ER_SG (NULL)
NULL, -- ER_TI (NULL)
NULL, -- ER_ZT (NULL)
NULL, -- ER_DU (NULL)
NULL, -- ER_SP (NULL)
NULL -- ER_BD (NULL)
DELETE FROM bndxing_tmp
WHERE acid=F_Rec.Acid and flight_index=F_Rec.new_Flight_Index;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
strErrorMessage := SQLERRM;
INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
sysdate,
F_Rec.Acid,
F_Rec.new_Flight_Index,
'Exception from Finish loop: ' || strErrorMessage);
COMMIT;
END; -- End of Finish Loop
END LOOP;
EXCEPTION
WHEN OTHERS THEN
strErrorMessage := SQLERRM;
INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
sysdate,
F_Rec.Acid,
F_Rec.new_Flight_Index,
'Exception from Stats loop: ' || strErrorMessage);
COMMIT;
END; -- End of Stats Loop
--Reset cursor and track geometry
CLOSE XCursor;
F_Rec.flight_track.sdo_ordinates.delete;
-- delete from hist_bndxing_tmp
-- where acid=acid_var and new_flight_index=fi_var;
FETCH FCursor INTO F_Rec;
END LOOP;
--DEBUG STATEMENT
/* INSERT INTO bnd_error VALUES (err_seq.NEXTVAL,
sysdate,
acid_var,
fi_var,
'Checkpoint 7');
CLOSE FCursor;
theSeq := 1;
OPEN BCursor;
LOOP
FETCH BCursor INTO BRec;
IF BCursor%NOTFOUND THEN
EXIT;
END IF;
UPDATE bndxing
SET segment = theSeq
WHERE CURRENT OF BCursor;
theSeq := theSeq + 1;
END LOOP;
CLOSE BCursor;
EXCEPTION
WHEN OTHERS THEN
strErrorMessage := SQLERRM;
Insert into bnd_error values (err_seq.NEXTVAL,
sysdate,
acid_var,
fi_var,
'Exception from main: ' || strErrorMessage);
COMMIT;
CLOSE FCursor;
END; -- End of Main Loop
SHOW ERRORS;
--exit; -
How to improve Performance of a Query whcih is on a Vritual Cube
Hi All,
Please suggest me some tips through which we can improve the performance of a queries that were built on Viirtual Cubes.
Thanks iin advance.
Regards,
RajHi Raj,
How is your direct access datasource built ? Is this a standard datasource or generic datasource on any view/table/function module. This strengthens my second point.
Suppose you built a virtual cube on direct access datasource built on AUFK table with Order as primary key (Order master data). when you use Order as selection on query built on this virtual cube then it retrievies the data faster than firing the query on other selections.
If your selections are different. You can possibly create a secondary index on the table with selections used in query.
Regards
vamsi -
How to improve performance of select query when primary key is not referred
Hi,
There is a select query where we are unable to refrence primary key of the tables:
Since, the the below code is refrensing to vgbel and vgpos fields instead of vbeln and posnr..... the performance is very slow.
select vbeln posnr into (wa-vbeln1, wa-posnr1)
from lips
where ( pstyv ne 'ZBAT'
and pstyv ne 'ZNLN' )
and vgbel = i_vbap-vbeln
and vgpos = i_vbap-posnr.
endselect.
Please le t me know if you have some tips..hi,
I hope you are using the select statement inside a loop ...endloop get that outside to improve the performance ..
if not i_vbap[] is initial.
select vbeln posnr into table it_lips
from lips
for all entries in i_vbap
where ( pstyv ne 'ZBAT'
and pstyv ne 'ZNLN' )
and vgbel = i_vbap-vbeln
and vgpos = i_vbap-posnr.
endif. -
Any solutions from oracle to improve Performance in Oracle Jdeveloper 10g
Hi ,
We are developing ADF Applications in Oracle Jdeveloper 10g , 4 developers are working . now every one M/c Ram upgraded to 4 GB
Still my developers are getting Performance issue , Like Java Heap memory Reached . when we saw in Task Manager Memeusage reached 450,000K
then Jdeveloper dies and hang there . we have to do this at least 4 to 5 times everyday . thats where it taking a lots of time to
modify a single small changes .
What our deveoper are doing they trying to commit frequently after making a important changes in application . but sometimes developer are also
forget in between . So wee need a solution for this if Oracle fixes this issue .
Thanks
KPHi,
We never had that issue with 10g (but happens in 11g), what is the project's size? I assume very big, else your environment must have something fishy, 10g is really fast and lightweight.
Regards,
~ Simon -
Hi All,
i m having following issue kindly inform me the is there any performance diffrence between following quiries A & B.
A)
select * from
tab1 t1 , tab2 t2
where
t1.id = 100
and t2.id = 100;
B)
select * from
tab1 t1 , tab2 t2
where
t1.id = 100
and t2.id = 100
and t1.id = t2.id;
Thanks & Regards,
VikasThis forum is meant for issues related to database upgrades. Pl re-post in a more appropriate forum - such as "Database - General" General Database Discussions
Pl see these two threads on how to post a tuning request
HOW TO: Post a SQL statement tuning request - template posting
When your query takes too long ...
HTH
Srini
Maybe you are looking for
-
i have 2 iPhones with 2 different numbers but same Apple ID, why can't I set up voicemail on one phone
-
WD4J -- XI -- R/3 Scenario
Hello All Currently I am working on a scenario which requires accessing of data from R/3 4.6C through BAPI with XI as middle ware from a webdynpro application in Java. My query is that: is it possible to perform RFC lookups directly from webdynpro us
-
Mail Configuration in Nokia C5-00
I am facing problem in configuring Email in my new Nokia C5-00. I am following below steps, Menu->Application->Email->New mail box, Entering Mailid (with domain [email protected], [email protected]) & Password, Next screen is getting with "Validating
-
Upgraded iCloud storage not showing the upgrade?
Using iPhone 5s & new iPad Air.... Upgraded iCloud storage & it hasn't updated on either devices! Is there Anyway to see if you received my request & payment so I don't duplicate it?
-
.Max Files in After Effects
We are trying to create a movie with a roving drone. The movie is being created in FCP; and edited in after effects. Beacause we are only doing this for a school project we do not want to pay for any models. My question: Are we able to import .MAX, .