How does XDB optimize XML Query?
I found the query speed of XDB is much slower than Berkeley XML DB.
How does XDB optimize XML Query?
Are there any documents on this subject?
And can XDB create indices on XMLType ( e.g. the index on element/attribute value and/or structure index)? if yes, how to do that?
lezhou had a valid question and asked about:
"I found the query speed of XDB is much slower than Berkeley XML DB"
"How does XDB optimize XML Query?"
These point to a "XML DB Concepts Guide", which does not yet exist.
The procedures are explained, the methods are explained. If you enable event tracing as described in the XMLDB Developers Guide 10gR2, you will see statements in your trace file which will tell you more about the XML DB architecture (and therefor you can deduct performance impact) then the manual will reveal.
An other example:
The xdbconfig.xsd file is neatly explained - in regards of http-port-etc
But not what the implecations are if you alter one of the other ones (the not explained parameters).
If you know the architecture (GROUND LEVEL), you can give an correct answer to the initial question "I found the query speed of XDB is much slower than Berkeley XML DB. How does XDB optimize XML Query?"
The balanced tree index is constructed the same way (on the same theory) in Oracle, DB2, but apparantly X is faster because in with the same buildup/architecture/databasestructure for both products, with the same data, with the same X --> value Y is beter constructed and delivers a better performance.
apples = apples
oracle xmldb = berkeley xmldb --> how can i test the o.apples=b.apples and that under these circumstances o.apples are faster ;-)
THEREFOR:
"I have to disagree a little bit...("It speaks about all these in detail").
Still waiting for the XMLDB Concepts Guide / Administrators Guide / Performance Guide.
Similar Messages
-
How does u find whether query touches aggregates or not?
Hi gurus
How does u find whether query touches aggregates or not?
Thanks in advance
RajHi Rajaiah.
You can test this from TA RSRT -> Execute and debug -> Display aggregate found.
Hope it helps.
BR
Stefan -
Can anyone tell me how can i optimize this query...
Can anyone tell me how can i optimize this query ??? :
Select Distinct eopersona.numident From rscompeten , rscompet , rscv , eopersona , rscurso , rseduca , rsexplab , rsinteres
Where ( ( (LOWER (rscompeten.nombre LIKE '%caracas%') AND ( rscompeten.id = rscompet.idcompeten ) AND ( rscv.id = rscompet.idcv ) AND ( eopersona.id = rscv.idpersona ) )
OR ( (LOWER (rscurso.nombre) LIKE '%caracas%') AND ( rscv.id = rscurso.idcv ) AND ( eopersona.id = rscv.idpersona ) )
OR ( (LOWER (rscurso.lugar) LIKE '%caracas%') AND ( rscv.id = rscurso.idcv ) AND ( eopersona.id = rscv.idpersona ) )
OR ( (LOWER (rseduca.univinst) LIKE '%caracas%)' AND ( rscv.id = rseduca.idcv ) AND ( eopersona.id = rscv.idpersona ) )
OR ( (LOWER (rsexplab.nombempre) LIKE '%caracas%' AND ( rscv.id = rsexplab.idcv ) AND ( eopersona.id = rscv.idpersona ) )
OR ( (LOWER (rsinteres.descrip) LIKE '%caracas%' AND ( rscv.id = rsinteres.idcv ) AND ( eopersona.id = rscv.idpersona ) )
OR ( (LOWER (rscv.cargoasp) LIKE '%caracas%' AND ( eopersona.id = rscv.idpersona ) )
OR ( LOWER (eopersona.ciudad) LIKE '%caracas%' AND ( eopersona.id = rscv.idpersona )
PLEASE IF YOU FIND SOMETHING WRONG.. PLEASE HELP ME.. this query takes me aproximatelly 10 minutes and the database is really small ( with only 200 records on each table )You are querying eight tables, however in any of your OR predicates you're only restricting 3 or 4 of those tables. That means that the remaining 4 or 5 tables are generating cartesian products. (n.b. the cartesian product of 5 tables with 200 rows each results in g 200^5 = 320,000,000,000 rows) Then you casually hide this behind "distinct".
A simple restatement of your requirements looks like this:
Select eopersona.numident
From rscompeten,
rscompet,
rscv,
eopersona
Where LOWER (rscompeten.nombre) LIKE '%caracas%'
AND rscompeten.id = rscompet.idcompeten
AND rscv.id = rscompet.idcv
AND eopersona.id = rscv.idpersona
UNION
Select eopersona.numident
From rscurso ,
rscv,
eopersona
Where LOWER (rscurso.nombre) LIKE '%caracas%'
AND rscv.id = rscurso.idcv
AND eopersona.id = rscv.idpersona
UNION
Select eopersona.numident
From rscurso ,
rscv,
eopersona
Where LOWER (rscurso.lugar) LIKE '%caracas%'
AND rscv.id = rscurso.idcv
AND eopersona.id = rscv.idpersona
UNION
...From there you can eliminate redundancies as desired, but I imagine that the above will perform admirably with the data volumes you describe. -
Hi
Can someone please tell me how to work on <b>XML Query</b>. Mainly regarding what details to give for <b>Source URL</b> and <b>Transform URL</b>.
Thanks in Advance
Muzammil P.THi Muzammil,
XML query is used to get the xml documents in the server. One more thing is you can execute all queries and transactions built on xMII. For queries you need to use URL like http://<server name>/Lighthammer/Illuminator?QueryTemplate=<QT path>&Param.1=<value1>&Param.2=<Value 2>..
Similar way you can execute the transactions as http://<server name>/Lighthammer/Runner?Transaction=<Transaction name with path>&InpueParameter=<value 1>&OutputParameter=<TrOutput>..
The main advantage is you can execute any type of query and transaction. Dynamically you can change this values from the front end also..
These all the things i know in XML, may be there are some other features are also avialable..
Thanks,
Rajesh.
PS : Please award points if the answer is useful. -
How does log-configuration.xml work?
Hi,
Anyone has an idea how the "log-configuration.xml" works in Enterprise Application Project? If this properties file is configured properly, what is to be done in the code so that the log/trace messages can be written to a designated destination?
I have been trying to find a appropriate documentation, but have not been successful so far.
Appreciate if someone can share his/her experience with me.
- TeecheuHello,
I can not tell how the files works, but the documentation about this topic can be seen here:
Portal Developer Guide -> Portal Runtime Technology -> Portal Application Archives ->
Defining a Logger Configuration.
(http://help.sap.com/saphelp_nw04/helpdata/en/b1/441e40777cdd5fe10000000a155106/frameset.htm)
Hope that helps,
Jordan -
How does Oracle manage to query a view?
Hello,
We are using an Oracle 9i database.
We are using Discoverer, but I experience some difficulties understanding a query built by Discoverer.
I think this is a basic explanation that I want. That's the reason why I decided to post my message under this forum.
The query I would like an explanation is such as this :
SELECT C.colB, count(C.col1), count(C.col2)
FROM (select b.colA, b.colB, a.col1, MAX(a.col2)
FROM tableA, tableB
WHERE a.joinB = b.joinA
GROUP BY b.colA, b.colB, a.col1) C
WHERE C.colA = 'blabla'
GROUP BY C.colB;
So, my question is :
Is the sub-select, (maybe it's not the right name!), executed regardless the condition "C.colA = 'blabla'", basically does it build the full view regardless the "external" condition ?
or, is the sub-select aware of the condition when it is built into memory ?
Is there a web-site, or documentation about such question?
In advance, thanks a lot for your help.
OlivierCheck if the following helps. In your case subquery will be executed first because of 'MAX'.
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96533/opt_ops.htm#1005152
/*****Extract from above link**********/
Mergeable and Nonmergeable Views
The optimizer can merge a view into a referencing query block when the view has one or more base tables, provided the view does not contain any of the following:
Set operators (UNION, UNION ALL, INTERSECT, MINUS)
A CONNECT BY clause
A ROWNUM pseudocolumn
Aggregate functions (AVG, COUNT, MAX, MIN, SUM) in the select list
When a view contains one of the following structures, it can be merged into a referencing query block only if Complex View Merging is enabled:
A GROUP BY clause
A DISTINCT operator in the select list
/*********************************************/ -
Hi,
I'm on 10.2.0.3 and got query like that:
desc SSS_ARCHIVE2
Name Null? Type
SSS_TASK_ID VARCHAR2(32)
SSS_ID VARCHAR2(30)
SSS_CORRELATION_ID VARCHAR2(32)
SSS_SKELETON_ID VARCHAR2(32)
SSS_CUSTOMER_ID VARCHAR2(32)
SSS_OPERATOR VARCHAR2(32)
SSS_STATUS_DATE NOT NULL DATE
SSS_AUDIT_UC NOT NULL VARCHAR2(512)
SSS_AUDIT_DC NOT NULL TIMESTAMP(6)
SSS_AUDIT_UM VARCHAR2(512)
SSS_AUDIT_DM TIMESTAMP(6)
SSS_AUDIT_ST NOT NULL NUMBER(1)
SSS_CREATION_DATE DATE
SSS_DESCRIPTION VARCHAR2(512)
SSS_DATA BLOB
SSS_DATA2 CLOB
create table ARH_2 as
SELECT SSS_task_id, extractValue(value(taskhist),'/task/taskId') taskId,
extractValue(value(taskhist), '/task/id') id_,
extractValue(value(typeId), '/typeId') typeId,
rownum wiersz FROM
sss_archive2,
TABLE(xmlsequence(extract(xmltype(SSS_archive2.SSS_data2),'/ns2:ArchivisedTask/taskHistory/task','xmlns:ns2="http://some.com/qservice/model" xmlns:ns3="http://some.com/qservice/method"'))) taskhist,
TABLE (xmlsequence(extract(value(taskhist),'/task/typeId'))) typeId
where
SSS_task_id=extractValue(value(taskhist), '/task/taskId')
and SSS_audit_st=1
Plan hash value: 2424165471
| Id | Operation | Name | E-Rows | OMem | 1Mem | Used-Mem |
| 1 | LOAD AS SELECT | | | 519K| 519K| 519K (0)|
| 2 | COUNT | | | | | |
| 3 | NESTED LOOPS | | 267M| | | |
| 4 | NESTED LOOPS | | 16360 | | | |
|* 5 | TABLE ACCESS FULL | SSS_ARCHIVE2 | 631K| | | |
|* 6 | COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE | | | | |
| 7 | COLLECTION ITERATOR PICKLER FETCH | XMLSEQUENCEFROMXMLTYPE | | | | |
Predicate Information (identified by operation id):
5 - filter("SSS_AUDIT_ST"=1)
6 - filter("SSS_TASK_ID"=EXTRACTVALUE(VALUE(KOKBF$),'/task/taskId'))
Note
- dynamic sampling used for this statement
- Warning: basic plan statistics not available. These are only collected when:
* hint 'gather_plan_statistics' is used for the statement or
* parameter 'statistics_level' is set to 'ALL', at session or system levelThere is about 582966 records in SSS_ARCHIVE2 and SSS_AUDIT_ST=1 is none selective 90% rows.
Is there a proper way to extract data from xml ?
Regards.
GregAh, yes the namespaces can be a pain (blame Microsoft, it was their idea).
Here's another example using namespaces...
-- With namespace
SQL> ed
Wrote file afiedt.buf
1 WITH t as (select XMLTYPE('
2 <RECSET xmlns:aa="http://www.w3.org">
3 <aa:REC>
4 <aa:COUNTRY>1</aa:COUNTRY>
5 <aa:POINT>1800</aa:POINT>
6 <aa:USER_INFO>
7 <aa:USER_ID>1</aa:USER_ID>
8 <aa:TARGET>28</aa:TARGET>
9 <aa:STATE>6</aa:STATE>
10 <aa:TASK>12</aa:TASK>
11 </aa:USER_INFO>
12 <aa:USER_INFO>
13 <aa:USER_ID>5</aa:USER_ID>
14 <aa:TARGET>19</aa:TARGET>
15 <aa:STATE>1</aa:STATE>
16 <aa:TASK>90</aa:TASK>
17 </aa:USER_INFO>
18 </aa:REC>
19 <aa:REC>
20 <aa:COUNTRY>2</aa:COUNTRY>
21 <aa:POINT>2400</aa:POINT>
22 <aa:USER_INFO>
23 <aa:USER_ID>3</aa:USER_ID>
24 <aa:TARGET>14</aa:TARGET>
25 <aa:STATE>7</aa:STATE>
26 <aa:TASK>5</aa:TASK>
27 </aa:USER_INFO>
28 </aa:REC>
29 </RECSET>') as xml from dual)
30 -- END OF TEST DATA
31 select x.country, x.point, y.user_id, y.target, y.state, y.task
32 from t
33 ,XMLTABLE(XMLNAMESPACES('http://www.w3.org' as "aa"),
34 '/RECSET/aa:REC'
35 PASSING t.xml
36 COLUMNS country NUMBER PATH '/aa:REC/aa:COUNTRY'
37 ,point NUMBER PATH '/aa:REC/aa:POINT'
38 ,user_info XMLTYPE PATH '/aa:REC/*'
39 ) x
40 ,XMLTABLE(XMLNAMESPACES('http://www.w3.org' as "aa"),
41 '/aa:USER_INFO'
42 PASSING x.user_info
43 COLUMNS user_id NUMBER PATH '/aa:USER_INFO/aa:USER_ID'
44 ,target NUMBER PATH '/aa:USER_INFO/aa:TARGET'
45 ,state NUMBER PATH '/aa:USER_INFO/aa:STATE'
46 ,task NUMBER PATH '/aa:USER_INFO/aa:TASK'
47* ) y
SQL> /
COUNTRY POINT USER_ID TARGET STATE TASK
1 1800 1 28 6 12
1 1800 5 19 1 90
2 2400 3 14 7 5
SQL> -
How does Firefox handle xml:base when generating GET requests for SVG image elements?
I am loading an SVG image at the following URL:
http://localhost/howl/svg/id/543
The source for this SVG code is:
<svg xml:base="/howl/">
<svg width="535" height="325" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<image xlink:href="file/id/532" />
</svg>
</svg>
As you can see, the SVG code is located at one path, but the <image> is relative to the root, hence the wrapping xml:base attribute.
The actual requests in Firefox, according to Tomcat Logging are:
GET /howl/svg/id/543
GET /howl/file/id/532
However, Firebug's Net tab shows these requests:
GET /howl/svg/id/543
GET /howl/svg/id/file/id/532 (Incorrect, doesn't happen)
GET /howl/file/id/532
When I test the same thing in Safari and Chrome, all three GET requests actually happen, the incorrect one resolving in a 404.
I suspect that Firefox is generating all three requests, but discarding the incorrect one and Firebug is not aware of this. As a result, Firebug shows all three requests, but the incorrect one never resolves.
So, I'm curious about the behavior or whether I am doing this incorrectly.
Thanks!A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.<br />
The helpers at that forum are more knowledgeable about web development issues.<br />
You need to register at the mozillaZine forum site in order to post at that forum.<br />
See http://forums.mozillazine.org/viewforum.php?f=25 -
How Does FrameMaker Support XML Schemas?
Hi All,
I'm wondering how FM supports XML Schemas. I need to validate the uniqnuess of the value of an element in my XML. Let's say I have an XML like this one:
<Param>
<name>Parameter 1 name</name>
<description>Parameter 1 description</description>
<code>12345</code>
</Param>
<Param>
<name>Parameter 2 name</name>
<description>Parameter 2 description</description>
<code>6789</code>
</Param>
The value of <code> must be unique throughout the XML file. As far as I know, I can add a validation of the uniqnuess of <code> into my XML schema. The question is whether this uniqnuess check will be supported by FM.
Any advice is appreciated.
Thank you very much!It should (though I have not tested it myself). Framemaker 11 uses XercesC 2.7 for parsing the incoming/outgoing XML and it supports unique constrains. EDD cannot check the possible violation, however.
BR, Martti -
How should I optimize this query
Hi
I have following query
SELECT /*+ USE_HASH (bp,rp) */ TO_CHAR (part_name)
FROM base_part bp,risk_assessment_part rp
WHERE bp.part_number = rp.part_number and risk_activity_code = 1
Explain Plan for this is
SELECT STATEMENT Optimizer Mode=CHOOSE
NESTED LOOPS
TABLE ACCESS FULL GQTS6USER.BASE_PART ROWS 4M , BYTES 331M, COST 7731
INDEX UNIQUE SCAN GQTS6USER.XPK_RISK_ASSESSMENT_PART ROWS 1, BYTES 22
Is there any way to optimize qry execution time???Make sure you have indexes on the columns used in join and filter conditions. Gather current statistics. Remove the TO_CHAR. Test the query with and without the hint and compare times and execution plans. Bear in mind the optimizer may choose to ignore a hint if it determines that there is a better plan.
-
SELECT c1,c2 FROM tabla WHERE c1=(SELECT MIN(c1) FROM tabla)
(i want to get an unique register which contains the minimum value in the table for the field c1)C1 C2
1 -1
2 -2
3 -3
4 -4
5 -5
6 -6
7 -7
8 -8
9 -9
10 -10
10 rijen zijn geselecteerd.
SQL>
SQL> SELECT c1,c2 FROM tabla WHERE c1=(SELECT MIN(c1) FROM tabla)
2 /
C1 C2
1 -1
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 FILTER
2 1 TABLE ACCESS (FULL) OF 'TABLA'
3 1 SORT (AGGREGATE)
4 3 TABLE ACCESS (FULL) OF 'TABLA'
SQL>
SQL> SELECT c1,c2
2 FROM
3 (
4 SELECT c1,c2, ROW_NUMBER() OVER (ORDER BY C1) RN
5 FROM tabla
6 )
7 WHERE RN = 1
8 /
C1 C2
1 -1
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 VIEW
2 1 WINDOW (SORT PUSHED RANK)
3 2 TABLE ACCESS (FULL) OF 'TABLA'
SQL>
SQL> select min(c1) keep (dense_rank first order by c1) c1
2 , min(c2) keep (dense_rank first order by c1) c2
3 from tabla
4 /
C1 C2
1 -1
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 SORT (AGGREGATE)
2 1 TABLE ACCESS (FULL) OF 'TABLA'Regards,
Rob. -
How can I optimize this query's performance
SELECT pu.user_id,
cd.owner,
cd.somedata
FROM client_detail cd,
client_detail_user_xref pu
WHERE cd.device_id = 'xxxxxxxxx'
AND cd.client_detail_id = pu.client_detail_id(+)
AND(cd.alt_user_id = '12345' OR pu.user_id = '67890')
Plan hash value: 3532311591
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 247 | 1374 (1)| 00:00:17 |
|* 1 | FILTER | | | | | |
| 2 | NESTED LOOPS OUTER | | 1 | 247 | 1374 (1)| 00:00:17 |
|* 3 | TABLE ACCESS FULL | CLIENT_DETAIL | 1 | 226 | 1371 (1)| 00:00:17 |
| 4 | TABLE ACCESS BY INDEX ROWID| CLIENT_DETAIL_USER_XREF | 1 | 21 | 3 (0)| 00:00:01 |
|* 5 | INDEX RANGE SCAN | CLIENT_DETAIL_USER_PK | 1 | | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter("CD"."ALT_USER_ID"='12345' OR "PU"."USER_ID"='67890')
3 - filter("CD"."DEVICE_ID"='xxxxxxxxx')
5 - access("CD"."CLIENT_DETAIL_ID"="PU"."CLIENT_DETAIL_ID"(+))
Edited by: user13805875 on Feb 24, 2011 5:13 AMIf you are posting a Performance Related Question. Please read
{thread:id=501834} and {thread:id=863295}.
Following those guide will be very helpful. -
How I can optimize this SQL query
I require your help, I want to know how I can optimize this query
SELECT
"F42119". "SDLITM" as "Code1"
"F42119". "SDAITM" as "Code2"
"F42119". "SDDSC1" as "Product"
"F42119". "SDMCU" as "Bodega"
Sum ("F42119". "SDSOQS" / 10000) as "Number",
Sum ("F42119". "SDUPRC" / 10000) as "preciou"
Sum ("F42119". "SDAEXP" / 100) as "Value",
Sum ("F42119". "SDUNCS" / 10000) as "CostoU"
Sum ("F42119". "SDECST" / 100) as "Cost"
"F4101". "IMSRP1" as "Division"
"F4101". "IMSRP2" as "classification",
"F4101". "IMSRP8" as "Brand"
"F4101". "IMSRP9" as "Aroma"
"F4101". "IMSRP0" as "Presentation"
"F42119". "SDDOC" as "Type",
"F42119". "SDDCT" as "Document",
"F42119". "SDUOM" as "Unit"
"F42119". "SDCRCD" as "currency"
"F0101". "ABAN8" as "ABAN8"
"F0101". "ABALPH" as "Customer"
"F0006". "MCRP22" as "Establishment"
from "PRODDTA". "F0101" "F0101"
"PRODDTA". "F42119" "F42119"
"PRODDTA". "F4101" "F4101"
"PRODDTA". "F0006" "F0006"
where "F42119". "SDAN8" = "F0101". "ABAN8"
and "F0006". "MCMCU" = "F42119". "SDMCU"
and "F4101". "IMITM" = "F42119". "SDITM"
and "F42119". "SDDCT" in ('RI', 'RM', 'RN')
and CAST (EXTRACT (MONTH FROM TO_DATE (substr ((to_date ('01-01-'| | to_char (round (1900 + (CAST ("F42119". "SDDGL" as int) / 1000))),' DD- MM- YYYY ') + substr (to_char (CAST ("F42119". "SDDGL" as int)), 4,3) -1), 1,10))) AS INT) in : Month
and CAST (EXTRACT (YEAR FROM TO_DATE (substr ((to_date ('01-01-'| | to_char (round (1900 + (CAST ("F42119". "SDDGL" as int) / 1000))),' DD- MM- YYYY ')+ Substr (to_char (CAST ("F42119". "SDDGL" as int)), 4,3) -1), 1,10))) AS INT) in: Year
and trim ("F0006". "MCRP22") =: Establishment
and trim ("F4101". "IMSRP1") =: Division
Group By "F42119". "SDLITM"
"F42119". "SDAITM"
"F42119". "SDDSC1"
"F4101". "IMSRP1"
"F42119". "SDDOC"
"F42119". "SDDCT"
"F42119". "SDUOM"
"F42119". "SDCRCD"
"F0101". "ABAN8"
"F0101". "ABALPH"
"F4101". "IMSRP2"
"F4101". "IMSRP8"
"F4101". "IMSRP9"
"F4101". "IMSRP0"
"F42119". "SDMCU"
"F0006". "MCRP22"
I appreciate the help you can give meIt seems to me that part of fixing it could be how you join the tables.
Instead of the humongous where clause, put the applicable conditions on the join.
You have
from "PRODDTA". "F0101" "F0101"
"PRODDTA". "F42119" "F42119"
"PRODDTA". "F4101" "F4101"
"PRODDTA". "F0006" "F0006"
where "F42119". "SDAN8" = "F0101". "ABAN8"
and "F0006". "MCMCU" = "F42119". "SDMCU"
and "F4101". "IMITM" = "F42119". "SDITM"
and "F42119". "SDDCT" in ('RI', 'RM', 'RN')
and CAST (EXTRACT (MONTH FROM TO_DATE (substr ((to_date ('01-01-'| | to_char (round (1900 + (CAST ("F42119". "SDDGL" as int) / 1000))),' DD- MM- YYYY ') + substr (to_char (CAST ("F42119". "SDDGL" as int)), 4,3) -1), 1,10))) AS INT) in : Month
and CAST (EXTRACT (YEAR FROM TO_DATE (substr ((to_date ('01-01-'| | to_char (round (1900 + (CAST ("F42119". "SDDGL" as int) / 1000))),' DD- MM- YYYY ')+ Substr (to_char (CAST ("F42119". "SDDGL" as int)), 4,3) -1), 1,10))) AS INT) in: Year
and trim ("F0006". "MCRP22") =: Establishment
and trim ("F4101". "IMSRP1") =: Division
INSTEAD try something like
from JOIN "PRODDTA". "F0101" "F0101" ON "F42119". "SDAN8" = "F0101". "ABAN8"
JOIN "PRODDTA". "F42119" "F42119" ON "F0006". "MCMCU" = "F42119". "SDMCU"
JOIN "PRODDTA". "F4101" "F4101" ON join condition
JOIN "PRODDTA". "F0006" "F0006" ON join condition.
Not sure exactly how you need things joined, but above is the basic idea. Remove criteria for joining the tables from the WHERE clause and put them
in the join statements. That might clean things up and make it more efficient. -
Need to optimize a query....
select AC.ACCT_ID,
AC.EFF_STR_DT AC_EFF_STR_DT,
AC.EFF_END_DT AC_EFF_END_DT,
(select min(CORP_ACCT_ID)
from D236OT00.GOLD_CUST_CSR_ACC GA
where (AC.WBS_CD_LEVEL_01 = GA.CORP_ACCT_ID)) CORP_ACCT_ID,
ASEG.SEGMENT_TYPE,
ASEG.SEGMENT_CODE,
AC.WBS_CD_LEVEL_01,
AC.WBS_CD_LEVEL_02,
AC.WBS_CD_LEVEL_03,
AC.WBS_CD_LEVEL_04,
AC.WBS_CD_LEVEL_05,
AC.WBS_CD_LEVEL_06,
AC.WBS_CD_LEVEL_07,
AC.WBS_CD_LEVEL_08,
AC.WBS_CD_LEVEL_09,
AC.WBS_CD_LEVEL_10
from D236OT00.ACC1_ACCOUNT_NB AC LEFT OUTER JOIN D236OT00.ASEG_ACCT_SEG_NB ASEG
ON(AC.ACCT_ID = ASEG.ACCT_ID and ASEG.RECORD_EFF_END_DT = '9999-12-31'
and ASEG.RECORD_EFF_END_TM = '23.59.59'
and CURRENT DATE between ASEG.EFF_STR_DT and ASEG.EFF_END_DT)
where AC.ACCT_ID = ? and AC.RECORD_EFF_END_DT = '9999-12-31' and
AC.EFF_END_DT > CURRENT DATE and AC.INTR_CMPNY_CD in ('PO', 'BO') and
AC.ACCT_STAT_CD not in ('O', 'V', 'S')
how can i optimize this query for better performance?Try this version
select AC.ACCT_ID,
AC.EFF_STR_DT AC_EFF_STR_DT,
AC.EFF_END_DT AC_EFF_END_DT,
crop_acct.exp,
ASEG.SEGMENT_TYPE,
ASEG.SEGMENT_CODE,
AC.WBS_CD_LEVEL_01,
AC.WBS_CD_LEVEL_02,
AC.WBS_CD_LEVEL_03,
AC.WBS_CD_LEVEL_04,
AC.WBS_CD_LEVEL_05,
AC.WBS_CD_LEVEL_06,
AC.WBS_CD_LEVEL_07,
AC.WBS_CD_LEVEL_08,
AC.WBS_CD_LEVEL_09,
AC.WBS_CD_LEVEL_10
from D236OT00.ACC1_ACCOUNT_NB AC,
D236OT00.ASEG_ACCT_SEG_NB ASEG ,
(select min(CORP_ACCT_ID) exp
from D236OT00.GOLD_CUST_CSR_ACC GA
) CORP_ACCT,
where AC.ACCT_ID = ASEG.ACCT_ID
and ASEG.RECORD_EFF_END_DT = '9999-12-31'
and ASEG.RECORD_EFF_END_TM = '23.59.59'
and CURRENTDATE between ASEG.EFF_STR_DT and ASEG.EFF_END_DT
and AC.ACCT_ID = ?
and AC.RECORD_EFF_END_DT = '9999-12-31'
and AC.EFF_END_DT > CURRENTDATE
and AC.INTR_CMPNY_CD exists ('PO', 'BO')
and AC.ACCT_STAT_CD not exists ('O', 'V', 'S')
See if it works -
How to tune the performance of Oracle SQL/XML query?
Hi all,
I am running Oracle 9i and like to run the following Oracle SQL/XML query. It takes about 3+ hour and still not finish. If I get rid all the XML stuffs it only take minutes to run. Does anybody know how to what's the reason of this slow and how to tune it?
SELECT XMLElement("CUSTOMER",
XMLForest(C_CUSTKEY "C_CUSTKEY", C_NAME "C_NAME", C_ADDRESS "C_ADDRESS", C_PHONE "C_PHONE", C_MKTSEGMENT "C_MKTSEGMENT", C_COMMENT "C_COMMENT"),
(SELECT XMLAgg(XMLElement("ORDERS",
XMLForest(O_ORDERKEY "O_ORDERKEY", O_CUSTKEY "O_CUSTKEY", O_ORDERSTATUS "O_ORDERSTATUS", O_ORDERPRIORITY "O_ORDERPRIORITY", O_CLERK "O_CLERK", O_COMMENT "O_COMMENT"),
(SELECT XMLAgg(XMLElement("LINEITEM",
XMLForest(L_ORDERKEY "L_ORDERKEY", L_RETURNFLAG "L_RETURNFLAG", L_LINESTATUS "L_LINESTATUS", L_SHIPINSTRUCT "L_SHIPINSTRUCT", L_SHIPMODE "L_SHIPMODE", L_COMMENT "L_COMMENT")
FROM LINEITEM
WHERE LINEITEM.L_ORDERKEY = ORDERS.O_ORDERKEY)
FROM ORDERS
WHERE ORDERS.O_CUSTKEY = CUSTOMER.C_CUSTKEY)
FROM CUSTOMER ;
Thanks very much in advance for your time,
Jinghao Liuajallen wrote:
Why not something more like
SELECT *
FROM fact1 l,
FULL OUTER JOIN fact1 d
ON l.company = d.company
AND l.transactiontypeid = 1
AND d.transactiontypeid = 2;
Because this is not an equivalent of the original query.
drop table t1 cascade constraints purge;
drop table t2 cascade constraints purge;
create table t1 as select rownum t1_id from dual connect by level <= 5;
create table t2 as select rownum+2 t2_id from dual connect by level <= 5;
select * from (select * from t1 where t1_id > 2) t1 full outer join t2 on (t1_id = t2_id);
select * from t1 full outer join t2 on (t1_id = t2_id and t1_id > 2);
T1_ID T2_ID
3 3
4 4
5 5
6
7
T1_ID T2_ID
1
2
3 3
4 4
5 5
6
7
Maybe you are looking for
-
Problem with PO InfoUpdate. PB00 + RL01 becomes new PB00
Hi We are trying har to implement the correct use of conditions on Vendor / Sub-Vendor / PO and so on. But we have one problem. We have added condition RL01 with the value of 20% discount on Sub-Vendor "NDP" The Info Record for Material X and Vendor
-
System Error when launching any CC app?
I've had CC for almost a year, now. Everything has been working quite nicely. The other day I got notification that there were 3 updates, which I gleefully installed. Now, whenever I try to launch any of my CC apps (Illustrator, Photoshop, Dreamweave
-
Why does Apply IOS8 not support CarPlay in New Zealand yet?
Hi Apple and community, why is New Zealand not listed in countries that support CarPlay in IOS 8 but Australia is? It is frustrating as we have cars and 3rd party Pioneer head units that support CarPlay but Apple is not allowing our country to have t
-
I have downloaded LR5 Upgrade onto my PC (Windows 7). The LR5 new features work. So far the program is working as expected, except that when an image is deleted using LR5, the image disappears from LR5 and appears in the recycle bin as it should, but
-
Airport Extreme - IP Camera Setup for Internet Viewing
I just purchased the Airport Extreme N router and I'm trying to configure it to view 2 IP Cameras I have over the Internet. The settings are a bit different from my old router (Dlink DIR-655) and I can't seem to find any instructions. I have succesul