How to optimize the query with a join of virtual tables
I'm working on a query that is get the data of virtual tables 2 and bone is formed by the Union, all say 4 queries and b is formed by the Union, all say 3 queries
then these two virtual tables and b are joined on a column common and data are extracted from their part.
Problem is that there is about 1 minutes each in the two virtual tables has and b. If individual a and b queries virtual takes about 5 seconds to retrieve data
but the join on column takes about 25 seconds to retrieve data.
Can someone guide me how to optimize the recovery of joining 2 virtual tables having large data
Thank you
Please read these:
When your query takes too long
When your query takes too long...
How to post a SQL tuning request
HOW to: Validate a query of SQL statement tuning - model showing
Tags: Database
Similar Questions
-
How to transpose the query with the following result
Dear all,
Can someone tell me a method to convert my query result
Details are provided in
http://obiee11ge.blogspot.com/2010/07/how-to-transpose-query-with-following.html
Concerning
MustafaHello
Try this
Create a request combined with,criterion no. 1: model, revenue (Actual), Cogs (Actual), Opex (Actual), PL (Actual)
in the dummy column fx enter the "Real" value
criterion 2: model, revenue (Yago), Cogs (YAgo), Opex (Yago), PL (Yago)
in the dummy column fx enter the value as "Yago".
criterion 3: model, revenue (Budget), Cogs (Budget), Opex (Budget), PL (Budget)
in the dummy column fx enter the value as 'Budget '.
Now go to the columns of result and set names coumn (revenue, COGS, Opex, PL) for the result set.
For the Dumny, remove column header.In a sheet view, you will get the result.
Thank you
Vino -
How to write the query with parameters below and is null
Hi, I need to recover the data if the parameter is passed on the ground, else retrieve all records where the field is nullExample of
CREATE TABLE DEPT
(DEPTNO NUMBER (2),)
DNAME VARCHAR2 (14).
LOC VARCHAR2 (13));INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK');
INSERT INTO VALUES DEPT (20, 'SEARCH', 'DALLAS');
insert into dept values (30, 'SALES', 'CHICAGO');
INSERT INTO VALUES DEPT (40, 'OPERATIONS', 'BOSTON');ALTER table dept add (object_id number);
insert into dept values (50, 'OPERATIONS', 'BOSTON', 1);
insert into dept values (60, 'OPERATIONS', 'BOSTON', 1);
INSERT INTO VALUES DEPT (70, 'OPERATIONS', 'BOSTON', 2);Select * from Department where object_id =: p_object_id
If I pass the object_id 1, it shloud retrieve the values of dept with object_id 1, but if I don't pass the object_id, it must retrieve all records where object_id is null
IF 1 is passed as the id of the object, he must recover, 50, 60, if 1 is not passed as object_id it should 10,20,30,40 retive
It works fine for me separately as,.
Select * from Department where object_id =: p_object_id - 1
Select * from Department where the object_id is null;
Is it possible to do in a single query.
Thank you
SELECT * FROM dept WHERE object_id = :p_object_id OR (object_id is null and :p_object_id is null)
is an approach. It's a little talkative, but the meaning is clear. If you can identify a value that would never appear in the data (for example-1)
WHERE nvl( object_id, -1 ) = nvl(p_object_id, -1 );
Justin
-
PL/SLQ - how to create the query with the total horizontal current
Hello:
I am creating a report in the following format
Year name Reg1 Reg2 Reg3
Al 2001 3 4 5
2001 4-1-1
2001 7 5 6
2002 sue 2 4 1
2002 Al 1 3 6
Jim 2002 6 1 3
2002 16 15 16
2003 Jim 4-2 - 3
2003 5 4 - 2
2003 20 16 23
Note that totals are piling up horizontally, broken on the year. How to do that, please? Thank you very much!
Al
-
Rewrite the query with joins, and group by
Hello
It's an interview question.
Table names: bookshelf_checkout
virtual library
And the join condition between these two tables is title
We need to rewrite under request without using the join condition and group by clause?
When I was in College, I read most of SELECT statements can be replaced by operations base SQL (DEFINE the OPERATORS). Now, I am rewriting the query with SET operators, but not able to get the exact result.SELECT b.title,max(bc.returned_date - bc.checkout_date) "Most Days Out" FROM bookshelf_checkout bc,bookshelf b WHERE bc.title(+)=b.title GROUP BY b.title;
Kindly help me on this.
Thank you
SuriSomething like that?
1 WITH books AS ( 2 SELECT 'title 1' title FROM dual UNION ALL 3 SELECT 'title 2' FROM dual UNION ALL 4 SELECT 'title 3' FROM dual ), 5 bookshelf AS ( 6 SELECT 'title 1' title, DATE '2012-05-01' checkout_date, DATE '2012-05-15' returned_date FROM dual UNION ALL 7 SELECT 'title 1' title, DATE '2012-05-16' checkout_date, DATE '2012-05-20' returned_date FROM dual UNION ALL 8 SELECT 'title 2' title, DATE '2012-04-01' checkout_date, DATE '2012-05-15' returned_date FROM dual ) 9 SELECT bs.title, MAX(bs.returned_date - bs.checkout_date) OVER (PARTITION BY title) FROM bookshelf bs 10 UNION 11 (SELECT b.title, NULL FROM books b 12 MINUS 13* SELECT bs.title, NULL FROM bookshelf bs) SQL> / TITLE MAX(BS.RETURNED_DATE-BS.CHECKOUT_DATE)OVER(PARTITIONBYTITLE) ------- ------------------------------------------------------------ title 1 14 title 2 44 title 3
Lukasz
-
Hello
Kindly let me know how to print the query, and the parameters passed to it? I tried with the params parameter in super.executeQueryForCollection (qc, params, noUserParams); but could not succeed.
I need save the query and the parameters passed to it. Kindly help.
Thanks in advance,
Kalpana.
Here you go
Coding with Passion: Oracle ADF - Debug Mode object query with parameters
-
Structure of the query with parameters
Hello
Consume the web service, the results in a file xml with complex structures.
The function below the structure of the query
< TemplateName CcResultItems = "CgrInfo_1" >
My question is how to reorganize the query to obtain the results of the structure
< TemplateName CcResultItems = "CgrOwners_4" >
which should return three rows.Kind regards
Kostadincreate or replace
FUNCTION WS_SELECT_XML RETURN VARCHAR2 AS
XML_VAR XMLTYPE: = XMLTYPE)
"" ' < soap envelope: xmlns:soap = 'http://www.w3.org/2003/05/soap-envelope"" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" container = "http://www.w3.org/2001/XMLSchema" >. "
< soap: Header >
"< XmlSoapHeader xmlns ="https://test.wstestx.com/XWS2/ "/>"
< / soap: Header >
< soap: Body >
"< ProcessRequestResponse xmlns ="https://test.wstestx.com/XWS2/">."
< ProcessRequestResult > <! [CDATA [< CcResponse >
< TemplateName CcResultItems = "CgrInfo_1" >
< CcResultItem > < InfoMessage > < / InfoMessage > < IsitTerminated > 0 < / IsitTerminated > < IdObject > 365124 < / IdObject > < sanctuary ObjectlName > < / ObjectlName > < ObjectTaxNumber > 305089321502 < / ObjectTaxNumber > < / CcResultItem >
< / CcResultItems >
< TemplateName CcResultItems = "CgrUnits_2" >
< / CcResultItems >
< TemplateName CcResultItems = "CgrActors_3" >
< CcResultItem > < IdObject > 365124 < / IdObject > < UnitNo > 0 < / UnitNo > < EntityTYPEcode > 1 < / EntityTYPEcode > < EntityTYPEdesc > person < / EntityTYPEdesc > < / CcResultItem >
< / CcResultItems >
< TemplateName CcResultItems = "CgrOwners_4" >
< CcResultItem > < IdObject > 365124 < / IdObject > < EntityTYPEcode > 1 < / EntityTYPEcode > < EntityTYPEdesc > person < / EntityTYPEdesc > < OwnerID > 610697843014 < / OwnerID > < OwnerName > ALEX < / OwnerName > < / CcResultItem >
< CcResultItem > < IdObject > 365124 < / IdObject > < EntityTYPEcode > 1 < / EntityTYPEcode > < EntityTYPEdesc > person < / EntityTYPEdesc > < OwnerID > 840645947005 < / OwnerID > < OwnerName > JOHN < / OwnerName > < / CcResultItem >
< CcResultItem > < IdObject > 365124 < / IdObject > < EntityTYPEcode > 2 < / EntityTYPEcode > < company EntityTYPEdesc > < / EntityTYPEdesc > < OwnerID > 703454 < / OwnerID > < OwnerName > BROWN < / OwnerName > < / CcResultItem >
< / CcResultItems >
< TemplateName CcResultItems = "CgrActivities_5" >
< / CcResultItems >
< TemplateName CcResultItems = "CgrMembership_6" >
< / CcResultItems >
< TemplateName CcResultItems = "CgrFounding_7" >
< CcResultItem > < IdObject > 365124 < / IdObject > < FoundingDate > 2007-08-16 13:53 < / FoundingDate > < Total > 146701.00 < / Total > < / CcResultItem >
< / CcResultItems >
[[< / CcResponse >]] > < / ProcessRequestResult >
< / ProcessRequestResponse >
< / soap: Body >
< / envelope soap: >
');
BEGIN
FOR R IN)
WITH T AS (SELECT (XML_VAR) DOUBLE COLLAR)
SELECT x2.*
FROM XMLTable)
XMLNamespaces)
' http://www.w3.org/2003/05/soap-envelope ' LIKE 'SOAP'
, by default ' https://test.wstestx.com/XWS2/ '
)
, ': soap envelope / soap: Body/ProcessRequestResponse/ProcessRequestResult '
by the way XML_VAR
path of CcResponse clob columns '.'
) x 1
XMLTABLE)
' / CcResponse/CcResultItems.
XMLPARSE PASSAGE (DOCUMENT X 1.) CCRESPONSE)
COLUMNS
TemplateName VARCHAR2 (140) path "@TemplateName"
, IDOBJECT VARCHAR2 (140) PATH "CcResultItem/IdObject.
, PATH of VARCHAR2 (340) OBJECTLNAME ' CcResultItem/ObjectlName '.
, PATH of VARCHAR2 (140) VRSKA 'CcResultItem '.
) X 2
WHERE X 2. TemplateName = "CgrInfo_1."
-WHERE X 2. TemplateName = "CgrActors_3."
-WHERE X 2. TemplateName = "CgrOwners_4."
) LOOP
DBMS_OUTPUT. Put_line (' IdObject: ' |) R.IDOBJECT | ' ObjectlName: ' | R.ObjectlName | "TemplateName ' |" R.TemplateName);
END LOOP;
DBMS_OUTPUT. Put_line ("- end -");
RETURNS A NULL VALUE.
END WS_SELECT_XML;Based on your query, I'll assume that you started with
Extract data from webservice response
In my opinion, it comes of the change you are looking for
FOR R IN ( SELECT x2.TemplateName, x3.idobject, x3.OWNERID FROM XMLTable( XMLNamespaces( 'http://www.w3.org/2003/05/soap-envelope' AS "soap" , default 'https://test.wstestx.com/XWS2/' ) , 'soap:Envelope/soap:Body/ProcessRequestResponse/ProcessRequestResult' passing XML_VAR columns CcResponse clob path '.' ) x1 , XMLTABLE( '/CcResponse/CcResultItems[@TemplateName="CgrOwners_4"]' PASSING XMLPARSE(DOCUMENT X1.CCRESPONSE) COLUMNS TemplateName VARCHAR2(20) PATH '@TemplateName' , ItemXML XMLTYPE PATH 'CcResultItem' ) X2 , XMLTABLE( '/CcResultItem' PASSING x2.itemXML COLUMNS IDOBJECT VARCHAR2(20) PATH 'IdObject' , OWNERID VARCHAR2(20) PATH 'OwnerID' ) X3 )
As Odie post pointed out. The first (x 1) XMLTable retrieves the content of ProcessRequestRequest and by doing this, delete the CDATA tag. We now have a CLOB that resembles XML. The second XMLTable (x 2) converts this CLOB into an XMLType and looking for the node that matches the XPath expression. It's where I've hardcoded in your query to search for a specific node. As you want node has a repeated structure that you want to retrieve each row, I spent structures repeatedly in the third XMLTable (x 3) so he could analyze. You could combine x 2 and x 3 using XQuery, but I suggest starting by this method I found that it's easier to understand what is happening.
To test out your code, simply replace the line
by the way XML_VAR
with
from XMLTYPE ("... the content of the SOAP Message...")
and run the query. You can do this to debug the query as you and just do a SELECT * to see what all went from XMLTable to XMLTable, so went to check the correct data.
-
Uses oracle ebs r12
I have a table of data is
Operation_seq Type statusflag SeqNum
1 10A Y
2 20 b Y
3 30 c Y
4 40 D Y
5 50 e N
6 60 f Y
I want to write a query in which I want to take only 1 record operation_seq = 50 and Statusflag is N and all other interventions seq status is there.
My query must return only 50 operation when the status of 50 is N and any other status is Y.
Help, please.
Thank you
LavanLAVANKV wrote:
This statusflag can be (null or N), then how to frame the query.Simply wrap the statusflag with NVL column, you should be good.
SQL> with t 2 as 3 ( 4 select 1 seqnum, 10 operation_seq, 'a' type, 'Y' statusflag from dual union all 5 select 2 seqnum, 20 operation_seq, 'b' type, 'Y' statusflag from dual union all 6 select 3 seqnum, 30 operation_seq, 'c' type, 'Y' statusflag from dual union all 7 select 4 seqnum, 40 operation_seq, 'd' type, 'Y' statusflag from dual union all 8 select 5 seqnum, 50 operation_seq, 'e' type, '' statusflag from dual union all 9 select 6 seqnum, 60 operation_seq, 'f' type, 'Y' statusflag from dual 10 ) 11 select seqnum, operation_seq, type, statusflag 12 from ( 13 select t.*, count(decode(statusflag, 'Y', 1, null)) over() cnt_1, count(*) over() cnt_2 14 from t 15 ) 16 where operation_seq = 50 17 and nvl(statusflag, 'N') = 'N' 18 and cnt_2-cnt_1 = 1 19 / SEQNUM OPERATION_SEQ T S ---------- ------------- - - 5 50 e
-
How to write the query option in expdp
Hi Please someone help me how to write the query option in expdp... .in expdp using the query option...
where AM columnname between 5 May 12 02:57:00.000' and ' 02:59:59.999 6 May 12: ';
Please do what is necessary...Pavan Kumar says:
QUERY = (columnname scott.test: "where between 5 May 12 02:57:00.000 h ' and ' 6 May 12 AM 02:59:59.999'")Who will fail in databases, because you assume nls_date_format. How it is difficult to put to_date() surround channels? Rather than play with quotation marks, using one parfile thusly.
query=table_owner.table_1:"where business_date between to_date('20120505025700 am','yyyymmddhhmiss am') and to_date('20120505025959 am','yyyymmddhhmiss am')" query=table_owner.table_2:"where business_date between to_date('20120505025700 am','yyyymmddhhmiss am') and to_date('20120505025959 am','yyyymmddhhmiss am')" query=table_owner.table_3:"where business_date between to_date('20120505025700 am','yyyymmddhhmiss am') and to_date('20120505025959 am','yyyymmddhhmiss am')"
You do not have to have all the clauses in a single line, as they are side by side parfile, which would be enough. For this reason parfile is better than the command line in order to avoid all the back-citing dance.
-
How to play the song with .wma extension
How to play the song with .wma extension
If it does not DRM, use VLC. If so, no Mac OS X software can play or convert.
(142864)
-
Hello
Dose anyone know how to fix the error with the code: 0xe7210001, message: unable to load powrprof, object: CLSD-no-it is found;
OR: Fingerprintsoftware OR error: replicas THotkey.exe message window and the computer freezesMaleware scanned and virus, also in safe mode, found no infection, reinstalled driver fingerprint, but nothing has changed.
grateful for the help!
Hello
> message: unable to load powrprof, object: CLSD-no-it is found;
In my view, this would mean that there is a problem with Toshiba Power Saver
What laptop Toshiba, you have exactly?Maybe reinstall Power Saver could help. You can find it on the official website of Toshiba.
-
How to have the sidebar with thumbnails by default in the application preview?
I'm on OSX El Capitan 10.11.3 on iMac, and whenever I open a PDF file, there is no sidebar. I have to every time click on the Sidebar icon, then select the thumbnails. I would like to be on by default, but cannot find the option or how to edit the plist file...
If the thumbnails is checked in the menu 'View' preview, it should always open a PDF file with the open sidebar. Unless of course, it's a single page PDF.
-
all my data records on the local disk c, how to share the data with the other drive, local drive d.
Hi Jasonbichard,
1. what type of drive is D? Is - this another partition on the same disk?
2 Windows operating system you are using?
You can change the location of the disk to save the data in the d: instead of C: and check if it helps.
a. navigate to the location (username) C:\Users\.
b. right click on the folder that you want to change the location, and then select Properties.
c. click on the location tab and change the location to D: drive.d. click on apply and Ok.
-
How to concatenate the string with a digital command?
Hello
How to concatenate the string with a digital command?
Thank you.
I think I forgot to add the semicolon, what you can do is, drag the CONCATENATE function and add semicolon.
-
How to open the labview with function of Labview program to stop smoking inside?
Hi any idea how to open the labview with the Labview function program to stop smoking inside?
I forgot to add and define the condition of the type for this program.
If the program is an application, she closed immediately.
If it is still the work of labview, it will go directly to editing without closing the program.
I so need to retrieve, open it and make some changes.
Clement
Place the VI in a project and open it from there, then it should not autorun. App.kind application property allows you to decide whether to close or not.
/Y
Maybe you are looking for
-
Satellite C660 - jerking and seeds regularly during media playback
Hello, my Satellite C660 experiences technical problems when playing audio and video. I play 320KO ripped mp3s in Winamp and generally Watch youtube when the glitch regularly and jerk, audio and video. These occur about one second at a time, but the
-
What can I do with the ipad gone amok?
My ipad is crazy, none of the release buttons working, can't access apps and he talks just when I touch a button. I have no control, cannot stop it, made the "home" button and the sleep but button it starts to go back to the same situation. I connect
-
Can ' t install El Capitan on App Store
Has started to install, but had to restart when only 700 MB where downloaded, cannot resume, he is stuck in Pause. MacBook Pro OSX 10.10.5
-
I received the following email, which is potentially a scam is it prompts you to click on a link. Has anyone received the same email? Thank you! Ana From: "Flavia". Date: January 8, 2016 at 06:14:36 GMT + 1 Subject: Update your account Dear customer,
-
My documents and attachments in my email are open in Notepad form vs pdf
If I try to open an e-mail that I sent to someone who was in the form of pdf and it says pdf. It opens in Notepad and Icannot display it. I don't know why it does this