Simple as possible"nested loop"XML (XPATH)?
What is the best way to view the entries to an XML file with the following structure as a nested list (actually it must become a form where it is possible to control all entries).I can out of each level (see the code), but it seems not to be possible to nest loops for.
Advice if it is directly possible with XPath or should I check the result of a loop to output in the other or it would even be better to make a query on the XML result?
Thank you, excellent!
I tried somwhere along this before, but it didn't work then. I have propably just forgot to bring the book of signs to the correct place or something ;-)
But yes, your solution is exactly what I was looking for!
Thank you
Tags: ColdFusion
Similar Questions
-
Hi, I'm a relatively new to programming of LV, so be gentle.
In a Word, I am running nested loops than the material test power on and off cycles. The parameters for each loop is entered on the front panel of the user. For example, the power supply at the time, how many times to read in the data, power supply off time and the number of cycles power is a typical customer task ask me to do. Therefore, I decided to do a generic as possible executable vi instead of writing code (in which I request is trivial), that my technicians can easily use.
I want to put a counter - down in this vi, even a journey of one. I'll take the more the off time multiplied by the number of cycles and display on the front panel. For some reason that I can't find a simple way such that when the last cycle ended if poster zero before the program ends.
For example, the total is equal to 60 minutes and 10-minute cycle. I run the program and the display shows 60 during the first cycle, after the first cycle is complete and the second cycle begins the display turns 50, and so on until that last cycle where you can read 10. Then the program ends and the screen 10. How can I get a last beat of this kind it says 0 and 0 poster before the end of the program?
Thank you!
Wire a zero to a local variable of this indicator so that it can turn when the while loop ends.
-
Save several bays of nested loops
Hello
My vi generates several bays in each iteration of the loop, and I would like to save the data. I did work with the files before recording, but it's never with nested loops. I don't know how to keep the information of the iteration of one loop at the other. I would like suggestions. I made this sample & simple vi (attached file) that simulates the question I have. I have a file with a time column and different columns of food beside him.
The first question I have is that I generate the time table only once, but a table of signal several times, so how can I keep the time table to drop several times? The other question, as stated above, saves the data in the table signal getting lost in the nested loops...
Thank you
A
1. the first element of the first matrix signal IS always zero. The Signal to simulate always starts at zero. You compare it to the indicator of "first date". Who got by converting the dynamic data type to a scalar. And it's always the last element of the actual data. And since the "first out" is replaced with each iteration of the inner loop, the number you see at the end is actually the latest iteration of the data. Look at "First release" in comparison with the last element of your last column of the table and you will see they are the same.
2. the reason why you have a first column that consists of the steps is because that's what you have wired to initialize the shift register. If you look at my example, you will see that I have an empty array. (The zero is gray.) You, the 0 is not dimmed meaning there is an element. Expand this table to view more items and expand the digital field and you will see more digits. They correspond to what is in your first column.
-
use OPT_ESTIMATE or CARDINALITY tip for correct estimation of nested loops
I'm using Oracle 11.2.0.3. Below the execution below plan, how can I use tip OPT_ESTIMATE or CARDINALITY to teach optimization E-lines for ID 9 (Nested Loop) 30553 instead of 6.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers | OMem | 1Mem | Used-Mem | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 0 | SELECT STATEMENT | | 1 | | | 4604 (100)| | 30553 |00:00:02.56 | 208K| | | | | 1 | SORT ORDER BY | | 1 | 6 | 7044 | 4604 (1)| 00:01:05 | 30553 |00:00:02.56 | 208K| 41M| 2086K| 36M (0)| |* 2 | HASH JOIN OUTER | | 1 | 6 | 7044 | 4603 (1)| 00:01:05 | 30553 |00:00:02.10 | 208K| 38M| 3120K| 39M (0)| |* 3 | HASH JOIN OUTER | | 1 | 6 | 6870 | 4599 (1)| 00:01:05 | 30553 |00:00:01.97 | 208K| 38M| 3120K| 39M (0)| |* 4 | HASH JOIN OUTER | | 1 | 6 | 6744 | 4591 (1)| 00:01:05 | 30553 |00:00:01.85 | 208K| 37M| 3121K| 39M (0)| |* 5 | HASH JOIN OUTER | | 1 | 6 | 6570 | 4584 (1)| 00:01:05 | 30553 |00:00:01.74 | 208K| 37M| 3121K| 38M (0)| |* 6 | HASH JOIN OUTER | | 1 | 6 | 6414 | 4576 (1)| 00:01:05 | 30553 |00:00:01.60 | 208K| 37M| 3121K| 38M (0)| | 7 | NESTED LOOPS | | 1 | | | | | 30553 |00:00:01.44 | 208K| | | | | 8 | NESTED LOOPS | | 1 | 6 | 6318 | 4572 (1)| 00:01:05 | 30553 |00:00:01.31 | 182K| | | | | 9 | NESTED LOOPS | | 1 | 6 | 1830 | 4568 (1)| 00:01:04 | 30553 |00:00:01.11 | 124K| | | | |* 10 | HASH JOIN | | 1 | 2069 | 270K| 2499 (1)| 00:00:35 | 30646 |00:00:00.46 | 23738 | 6539K| 2033K| 7965K (0)| |* 11 | TABLE ACCESS BY INDEX ROWID | DSCLR | 1 | 5079 | 158K| 533 (1)| 00:00:08 | 91395 |00:00:00.28 | 6460 | | | | | 12 | BITMAP CONVERSION TO ROWIDS | | 1 | | | | | 197K|00:00:00.16 | 615 | | | | | 13 | BITMAP AND | | 1 | | | | | 4 |00:00:00.14 | 615 | | | | | 14 | BITMAP OR | | 1 | | | | | 4 |00:00:00.07 | 276 | | | | | 15 | BITMAP CONVERSION FROM ROWIDS| | 1 | | | | | 2 |00:00:00.02 | 69 | | | | |* 16 | INDEX RANGE SCAN | XIF913DSCLR | 1 | 274K| | 14 (0)| 00:00:01 | 68407 |00:00:00.01 | 69 | | | | | 17 | BITMAP CONVERSION FROM ROWIDS| | 1 | | | | | 4 |00:00:00.05 | 207 | | | | |* 18 | INDEX RANGE SCAN | XIF913DSCLR | 1 | 274K| | 42 (0)| 00:00:01 | 209K|00:00:00.03 | 207 | | | | | 19 | BITMAP CONVERSION FROM ROWIDS | | 1 | | | | | 5 |00:00:00.06 | 339 | | | | |* 20 | INDEX RANGE SCAN | XIF910DSCLR | 1 | 274K| | 67 (0)| 00:00:01 | 239K|00:00:00.04 | 339 | | | | | 21 | NESTED LOOPS | | 1 | | | | | 21749 |00:00:00.10 | 17278 | | | | | 22 | NESTED LOOPS | | 1 | 3404 | 339K| 1965 (1)| 00:00:28 | 22772 |00:00:00.03 | 1246 | | | | | 23 | TABLE ACCESS FULL | TMP_RPT_BD_STATE_DATA_DWNLD | 1 | 3255 | 257K| 11 (0)| 00:00:01 | 3255 |00:00:00.01 | 27 | | | | |* 24 | INDEX RANGE SCAN | XIE2OCRN | 3255 | 7 | | 1 (0)| 00:00:01 | 22772 |00:00:00.03 | 1219 | | | | |* 25 | TABLE ACCESS BY INDEX ROWID | OCRN | 22772 | 1 | 21 | 1 (0)| 00:00:01 | 21749 |00:00:00.06 | 16032 | | | | |* 26 | VIEW PUSHED PREDICATE | | 30646 | 1 | 171 | 1 (0)| 00:00:01 | 30553 |00:00:00.63 | 101K| | | | | 27 | WINDOW BUFFER | | 30646 | 1 | 21 | 1 (0)| 00:00:01 | 46946 |00:00:00.59 | 101K| 2048 | 2048 | 2048 (0)| |* 28 | TABLE ACCESS BY INDEX ROWID | DSCLR_FLNG | 30646 | 1 | 21 | 1 (0)| 00:00:01 | 46946 |00:00:00.32 | 101K| | | | |* 29 | INDEX RANGE SCAN | XIE1DSCLR_FLNG | 30646 | 2 | | 1 (0)| 00:00:01 | 46946 |00:00:00.21 | 59862 | | | | |* 30 | INDEX RANGE SCAN | XPKH760_RGLTY_ACTN_DSCLR | 30553 | 1 | | 1 (0)| 00:00:01 | 30553 |00:00:00.18 | 57541 | | | | | 31 | TABLE ACCESS BY INDEX ROWID | H760_RGLTY_ACTN_DSCLR | 30553 | 1 | 748 | 1 (0)| 00:00:01 | 30553 |00:00:00.11 | 26218 | | | | | 32 | TABLE ACCESS FULL | DSCLR_ST_TYPE_TBL | 1 | 4 | 64 | 4 (0)| 00:00:01 | 4 |00:00:00.01 | 5 | | | | | 33 | TABLE ACCESS FULL | RGLTY_RSLTN_TYPE_TBL | 1 | 12 | 312 | 7 (0)| 00:00:01 | 12 |00:00:00.01 | 10 | | | | | 34 | TABLE ACCESS FULL | INTTR_TYPE_TBL | 1 | 14 | 406 | 7 (0)| 00:00:01 | 14 |00:00:00.01 | 10 | | | | | 35 | TABLE ACCESS FULL | SNCTN_TYPE_TBL | 1 | 15 | 315 | 7 (0)| 00:00:01 | 15 |00:00:00.01 | 10 | | | | | 36 | TABLE ACCESS FULL | PRDCT_TYPE_TBL | 1 | 25 | 725 | 4 (0)| 00:00:01 | 25 |00:00:00.01 | 5 | | | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Query Block Name / Object Alias (identified by operation id): ------------------------------------------------------------- 1 - SEL$A8B7A3F4 11 - SEL$A8B7A3F4 / D@SEL$13 23 - SEL$A8B7A3F4 / OH@SEL$1 24 - SEL$A8B7A3F4 / O@SEL$13 25 - SEL$A8B7A3F4 / O@SEL$13 26 - SEL$13512960 / DF@SEL$13 27 - SEL$13512960 28 - SEL$13512960 / DF1@SEL$14 29 - SEL$13512960 / DF1@SEL$14 30 - SEL$A8B7A3F4 / H7@SEL$2 31 - SEL$A8B7A3F4 / H7@SEL$2 32 - SEL$A8B7A3F4 / DS@SEL$9 33 - SEL$A8B7A3F4 / RST@SEL$11 34 - SEL$A8B7A3F4 / ITT@SEL$3 35 - SEL$A8B7A3F4 / ST@SEL$5 36 - SEL$A8B7A3F4 / PT@SEL$7 Outline Data ------------- /*+ BEGIN_OUTLINE_DATA IGNORE_OPTIM_EMBEDDED_HINTS OPTIMIZER_FEATURES_ENABLE('11.2.0.3') DB_VERSION('11.2.0.3') OPT_PARAM('optimizer_index_cost_adj' 20) ALL_ROWS OUTLINE_LEAF(@"SEL$13512960") PUSH_PRED(@"SEL$A8B7A3F4" "DF"@"SEL$13" 11) OUTLINE_LEAF(@"SEL$A8B7A3F4") ELIMINATE_JOIN(@"SEL$2D47CDEA" "DTT"@"SEL$13") OUTLINE(@"SEL$14") OUTLINE(@"SEL$A8B7A3F4") ELIMINATE_JOIN(@"SEL$2D47CDEA" "DTT"@"SEL$13") OUTLINE(@"SEL$2D47CDEA") MERGE(@"SEL$3FAACB6D") OUTLINE(@"SEL$15") OUTLINE(@"SEL$3FAACB6D") MERGE(@"SEL$11") MERGE(@"SEL$A1A6E401") OUTLINE(@"SEL$12") OUTLINE(@"SEL$11") OUTLINE(@"SEL$A1A6E401") MERGE(@"SEL$9") MERGE(@"SEL$BFB1842A") OUTLINE(@"SEL$10") OUTLINE(@"SEL$9") OUTLINE(@"SEL$BFB1842A") MERGE(@"SEL$7") MERGE(@"SEL$EEDE2B8C") OUTLINE(@"SEL$8") OUTLINE(@"SEL$7") OUTLINE(@"SEL$EEDE2B8C") MERGE(@"SEL$5") MERGE(@"SEL$A6B38458") OUTLINE(@"SEL$6") OUTLINE(@"SEL$5") OUTLINE(@"SEL$A6B38458") MERGE(@"SEL$171BE69E") MERGE(@"SEL$3") OUTLINE(@"SEL$4") OUTLINE(@"SEL$171BE69E") MERGE(@"SEL$AF02BF1E") OUTLINE(@"SEL$3") OUTLINE(@"SEL$2") OUTLINE(@"SEL$AF02BF1E") MERGE(@"SEL$13") OUTLINE(@"SEL$1") OUTLINE(@"SEL$13") FULL(@"SEL$A8B7A3F4" "OH"@"SEL$1") INDEX(@"SEL$A8B7A3F4" "O"@"SEL$13" ("OCRN"."ORG_PK" "OCRN"."DSCLR_DSCLB_FL" "OCRN"."DSCLR_RPTBL_FL")) BITMAP_TREE(@"SEL$A8B7A3F4" "D"@"SEL$13" AND(OR(1 1 ("DSCLR"."FORM_TYPE_CD") 2 ("DSCLR"."FORM_TYPE_CD")) ("DSCLR"."DSCLR_TYPE_CD"))) NO_ACCESS(@"SEL$A8B7A3F4" "DF"@"SEL$13") INDEX(@"SEL$A8B7A3F4" "H7"@"SEL$2" ("H760_RGLTY_ACTN_DSCLR"."FLNG_PK" "H760_RGLTY_ACTN_DSCLR"."DSCLR_PK" "H760_RGLTY_ACTN_DSCLR"."REC_SEQ_NB")) FULL(@"SEL$A8B7A3F4" "DS"@"SEL$9") FULL(@"SEL$A8B7A3F4" "RST"@"SEL$11") FULL(@"SEL$A8B7A3F4" "ITT"@"SEL$3") FULL(@"SEL$A8B7A3F4" "ST"@"SEL$5") FULL(@"SEL$A8B7A3F4" "PT"@"SEL$7") LEADING(@"SEL$A8B7A3F4" "OH"@"SEL$1" "O"@"SEL$13" "D"@"SEL$13" "DF"@"SEL$13" "H7"@"SEL$2" "DS"@"SEL$9" "RST"@"SEL$11" "ITT"@"SEL$3" "ST"@"SEL$5" "PT"@"SEL$7") USE_NL(@"SEL$A8B7A3F4" "O"@"SEL$13") NLJ_BATCHING(@"SEL$A8B7A3F4" "O"@"SEL$13") USE_HASH(@"SEL$A8B7A3F4" "D"@"SEL$13") USE_NL(@"SEL$A8B7A3F4" "DF"@"SEL$13") USE_NL(@"SEL$A8B7A3F4" "H7"@"SEL$2") NLJ_BATCHING(@"SEL$A8B7A3F4" "H7"@"SEL$2") USE_HASH(@"SEL$A8B7A3F4" "DS"@"SEL$9") USE_HASH(@"SEL$A8B7A3F4" "RST"@"SEL$11") USE_HASH(@"SEL$A8B7A3F4" "ITT"@"SEL$3") USE_HASH(@"SEL$A8B7A3F4" "ST"@"SEL$5") USE_HASH(@"SEL$A8B7A3F4" "PT"@"SEL$7") SWAP_JOIN_INPUTS(@"SEL$A8B7A3F4" "D"@"SEL$13") INDEX_RS_ASC(@"SEL$13512960" "DF1"@"SEL$14" ("DSCLR_FLNG"."DSCLR_PK" "DSCLR_FLNG"."BLLBL_FL")) END_OUTLINE_DATA */
This plan gives you an idea of why your initial synchronization has been long - most of your readings are one-piece readings and you have read 53 724 blocks. If you estimate 1 centisecond by read (which could be on a reasonable charge system) then it is 537 seconds. to 5 milliseconds per read, it's still 268 seconds or 4 minutes and 30 seconds.
A quick break down of some (the worst case) potential time - only you can say whether or not some of these readings will be always/often/never being cached in the file or at the SAN level.
Line 11 - physical reads 6 400 done - it's a tree bitmap then the readings are in the order of physical table with no. rereads. Call 5ms by read-online 32 seconds. L
| * 11 | TABLE ACCESS BY INDEX ROWID | DSCLR | 1. 5079. 158K | 533 (1) | 00:00:08 | 91395 | 00:00:01.27 | 6460. 6400 | | | |
The hash join takes us from 6 400 to 11 788 because it joins, lines 21 to 25 (nested loop) in which most of the work is the random access table with some automatic caching: 26 seconds. Do a search here rather than indexed 22 000 access? Which would be faster, which would charge less.
| * 25. TABLE ACCESS BY INDEX ROWID | OCRN | 22050. 1. 21. 1 (0) | 00:00:01 | 21059 | 00:01:04.74 | 15634 | 5280. | | |
Three nested loops that introduce more readings:
11788 9-> 26386:14 600 of the predicate view pushed which some lies but a very large index and a table of random access 73 seconds
8 26386-> 33783:7 400 index line 30 - big clue about 37 seconds Access hides
33783 7-> 53691:19 900 31 table access - large table line, not much caching, 100 seconds.
In each case, you can ask if an analysis would take less time than all of these random reads.
NOTE - all I'm pointing our here where you potentially use a lot of time so that you can ask whether or not you should do little of the query in this way, or if there is an alternative, or if the work you're doing is absolutely necessary. If you want to optimize the query you should consider the intent of the query and think your way through a reasonable join order to see if you can imagine an effective way to get the same data. I have written a few articles and presentation on an approach that begins by drawing - here is a link to an article I wrote for a group of SQL Server: https://www.simple-talk.com/sql/performance/designing-efficient-sql-a-visual-approach/
and a video I did with Kyle Hailey, while he was working for Embarcadero:Tune in for the ultimate SQL Tune-off | Landing pages
Concerning
Jonathan Lewis
-
Help to find the best way to interior design (Nested Loops of sliders?)
Oracle 11G
First here the table I work with, for example data
ID FID ANNOTATION DESIGNATION LOW HIGH SEQ 1 1008755360 FC1053, 81-82 FC1053 81 82 1 2 1008755360 XD, 3-24 XD 3 24 2 3 1008756293 FC1053, 81-82 FC1053 81 82 1 4 1008756293 XD, 3-24 XD 3 24 2 Each FID is a different line, these two lines are connected physically, that's why I've shown them here on the table. Each line has a 'meter', in this case, each line has 2 lines of account that are the same.
From there, we can say that FC1053, 81 and 82 are connected between the 2 cables. XD DESIGNATION means that cables are connect not really so I can't ignore those.
We have a different way to show that they connect other than only those data and I need to connect each other too much. For this I need the Info
FID1 LOW HIGH FID2 1008755360 81 82 1008756293 So my first design was the hepatitis hase sliders 2 with the data in the table, as shown above. I would then have a nested loop. The first slider to select the first record, then go down to the second loop where I compare all other records the first record and then go back in the outer loop to move to the next record, then return once again to the inner loop to compare the values again.
LOOP1
LOOP 2
If LOOP1. IDF! LOOP2 =. IDF THEN
IF LOOP1. ANNOTATION = LOOP2. ANNOTATION THEN
-CONNECT THE DATA
ON THE OTHER
IF LOOP1. DESCRIPTION = LOOP2. DESIGNATION THEN
IF LOOP2. LOW BETWEEN LOOP1. LOW AND LOOP1. THEN HIGH
IF LOOP2. HIGH BETWEEN LOOP1. LOW AND LOOP1. HGH THEN
-CONNECT THE DATA
END IF;
END IF;
END IF;
END IF;
END IF;
END LOOP;
-Open and close done to reset the cursor to the front/top
CLOSE CURSOR LOOP2;
OPEN CURSOR LOOP2
END LOOP;
The problem with this approach is once the outside loop moves the next value of the IDF, that logic will connect them once again, but this time with the FIDs reverse which is essentially the same thing as it does not matter the direction in which they are connected. I almost feel that once I found the link I need to remove that line from the cursor (which isn't possible).
FID1 LOW HIGH FID2 1008755360 81 82 1008756293 1008756293 81 82 1008755360 I was able to
1. make a list of all those I have connected and check against that
2 use some kind of collection
3. use a temporary table to hold the data
4 something that I have not yet thought
I really appreciate in advance for any help I get.
If your query mapping is correct, this is the result of your query with the addition of the values of sum for the strand/down running. Manually change the incorrect in the output bit numbers so that we can move on to find another solution.
with gc_count like)
Select
Sum(current_high-current_low+1) on strand_high (g3e_fid seq order partition),
Sum(current_high-current_low+1) more (partition of g3e_fid order of seq).
strand_low (current_high-current_low),
t.* from b$ gc_count t
)
Select
a.g3e_fid, a.current_designation, a.current_low, a.current_high, a.strand_high, a.strand_low,
b.g3e_fid, b.current_designation, b.current_low, b.current_high, b.strand_high, b.strand_low
gc_count a, gc_count b
where a.g3e_fid in (1008757155,1008757159,1009999655)
and in b.g3e_fid (1008757155,1008757159,1009999655)
and a.g3e_fid > b.g3e_fid
and ((a.count_annotation = b.count_annotation)
or (a.current_designation = b.current_designation
and a.current_low b.current_low and b.current_high and a.current_high between b.current_low and b.current_high)
order of b.seq
/
G3E_FID CURRENT_DESIGNATION CURRENT_LOW CURRENT_HIGH STRAND_HIGH STRAND_LOW G3E_FID CURRENT_DESIGNATION CURRENT_LOW CURRENT_HIGH STRAND_HIGH STRAND_LOW
---------- --------------------- ----------- ------------ ----------- ---------- ---------- --------------------- ----------- ------------ ----------- ----------
GAGA GAGA 1008757159 1008757155 1 1 2 2 1 2 2 1
1008757159 3 8 8 3 1008757155 3 8 8 3 F1DM F1DM
1008757159 9 10 10 9 1008757155 9 10 10 9 F2 F2
1008757159 11 14 14 11 1008757155 11 14 14 11 F1DM F1DM
1009999655 17 18 6 5 1008757155 15 18 18 15 F2 F2
1008757159 15 16 16 15 1008757155 15 18 18 15 F2 F2
1009999655 21 24 4 1 1008757155 21 24 24 21 F2 F2
7 selected lines.
Elapsed time: 00:00:00.06
-
Nested loops in the XSLT handling
Hello
I want to manage nested loops for each within the transformation roadmap.
I have two collections of source and a target collection.
I have to search the value of key in source1 source2 and if the key is found, I map the value of the target, and if the key is not found, maybe I want to the key itself to target.
This is the input samples and the results expected from the transformation roadmap. Please help turn in the required format.
Entry
----------------------
------------------------
< Source1Collection >
< Group1 >
< key > < / keys >
i < value > < / value >
< / Group1 >
< Group2 >
b < Key > < / key >
II < value > < / value >
< / Group2 >
Group < 3 >
< Key > c < / keys >
III < value > < / value >
< / Group 3 >
< / Source1Collection >
---------------------------------------
< Source2Collection >
< Feild1 > z < / Feild1 >
< Feild1 > x < / Feild1 >
c < Feild1 > < / Feild1 >
< Feild1 > v < / Feild1 >
b < Feild1 > < / Feild1 >
< / Source2Collection >
----------------------------------------
Output
--------------------------------------
--------------------------------------
< TargetCollection >
< Field1 > one < / Feild1 >
b < Field1 > < / Feild1 >
III < Field1 > < / Feild1 >
< / TargetCollection >is it possible that I can keep the position of the corresponding source2Key "?" This will help me to map the corresponding value of the sourceKey2 to the target.
For something like that...
1 one 2 two 3 three You can use the following to get the value of a respective key...
Thus, when $key = '2' the expression above will return "two"...
I hope this helps...
See you soon,.
Vlad -
Not the same State (<>) of nested loops
Hi gurus and Experts.
I need advice/suggestion on the query plan below. This plan is go for Nested Loops, am not able to force to go to the hash join or Merge Join with tips.
Can someone help me please what is happening, and it is possible to escape from nested loops.
I don't want to take the help of index for this scenario.
D/B: Oracle 11 g 2,
create table parent as with main as (select --+materialize round(dbms_random.value(low=>1,high=>100)) SAMPLE_ID,dbms_random.string(opt=>'U',len=>10) SAMPLE_TEXT,rownum id from dual connect by level<=100000) select sample_id,rpad(sample_text,10,'*') padding,sample_text,id from main order by id
create table child as with main as (select --+materialize round(dbms_random.value(low=>1,high=>100)) SAMPLE_ID,dbms_random.string(opt=>'U',len=>10) SAMPLE_TEXT,rownum id from dual connect by level<=10000) select sample_id,rpad(sample_text,10,'*') padding,sample_text,id from main order by id
select --+use_hash(p c) p.id from parent p,child c where p.id<>c.id
Plan SELECT STATEMENT ALL_ROWSCost: 973,076 Bytes: 8,999,910,000 Cardinality: 999,990,000 3 NESTED LOOPS Cost: 973,076 Bytes: 8,999,910,000 Cardinality: 999,990,000 1 TABLE ACCESS FULL TABLE APP.CHILD Cost: 12 Bytes: 40,000 Cardinality: 10,000 2 TABLE ACCESS FULL TABLE APP.PARENT Cost: 97 Bytes: 499,995 Cardinality: 99,999
902629 wrote:
I need advice/suggestion on the query plan below. This plan is go for Nested Loops, am not able to force to go to the hash join or Merge Join with tips.
You will not be able to use a hash join
http://docs.Oracle.com/CD/E11882_01/server.112/e16638/optimops.htm#i36043
>
The optimizer uses hash join to join two tables if they are added by using an equijoin and if one of the following conditions are met:
>You may be able to force a sort merge join, it does not mention if different will work, I don't see how it would be
http://docs.Oracle.com/CD/E11882_01/server.112/e16638/optimops.htm#i49183
>
Sort merge joins are useful when the join condition between two tables is a condition of inequality such as <,>,> <=,>, or > =. Fusion type joints are more successful than joins loops nested for large sets of data. You cannot use hash joins unless there is a condition of equality.
>I can't imagine this treatment an antijoin more efficiently than nested If loops.
=,> -
Partition pruning, nested loops
Hello
I'm having a problem with obtaining the size of partition in a query. I managed to dumb down the problem to the two tables and a minimum query (see below).
Basically I have a partitioned table "Made each year" and a table of assistance 'Current year' that contain always 1 row. The sole purpose of this line is to say which is the year curent, it was the previous year and that next year will be. (In the real problem, there is no standard timeperiods, so we can't calculate just previous and next by adding/subtraction 1 as would be possible in this example).
The following query is executed as I want.
It runs a scan on current_year and then nested loop on the facts. And the size of the partition that was happening.
The following query is where I have my problem.select sum(decode(a.year_key, b.curr_year, some_measure)) as curr_year_measure from yearly_fact_t a ,current_year b where a.year_key = b.curr_year; ------------------------------------------------------------------------------------------------------------ | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | ------------------------------------------------------------------------------------------------------------ | 0 | SELECT STATEMENT | | 1 | 39 | 4 (0)| 00:00:01 | | | | 1 | SORT AGGREGATE | | 1 | 39 | | | | | | 2 | NESTED LOOPS | | 1 | 39 | 4 (0)| 00:00:01 | | | | 3 | INDEX FAST FULL SCAN | SYS_C00247890 | 1 | 13 | 2 (0)| 00:00:01 | | | | 4 | PARTITION RANGE ITERATOR| | 1 | 26 | 2 (0)| 00:00:01 | KEY | KEY | |* 5 | TABLE ACCESS FULL | YEARLY_FACT_T | 1 | 26 | 2 (0)| 00:00:01 | KEY | KEY | ------------------------------------------------------------------------------------------------------------ Predicate Information (identified by operation id): --------------------------------------------------- 5 - filter("A"."YEAR_KEY"="B"."CURR_YEAR")
The xplan base is the same, but for some reason any cbo abandoned and decide to analyze all the partitions, which was not highly scalable data on production :)
I would have thought that the plan would be the same.
select sum(decode(a.year_key, b.curr_year, some_measure)) as curr_year_measure ,sum(decode(a.year_key, b.prev_year, some_measure)) as prev_year_measure from yearly_fact_t a ,current_year b where a.year_key = b.curr_year or a.year_key = b.prev_year; ------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | ------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 52 | 13 (0)| 00:00:01 | | | | 1 | SORT AGGREGATE | | 1 | 52 | | | | | | 2 | NESTED LOOPS | | 4 | 208 | 13 (0)| 00:00:01 | | | | 3 | TABLE ACCESS FULL | CURRENT_YEAR | 1 | 26 | 4 (0)| 00:00:01 | | | | 4 | PARTITION RANGE ALL| | 4 | 104 | 9 (0)| 00:00:01 | 1 | 6 | |* 5 | TABLE ACCESS FULL | YEARLY_FACT_T | 4 | 104 | 9 (0)| 00:00:01 | 1 | 6 | ------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 5 - filter("A"."YEAR_KEY"="B"."CURR_YEAR" OR "A"."YEAR_KEY"="B"."PREV_YEAR")
What can I do to get the size of partition that you want to occur in the second query?-- drop table yearly_fact_t purge; -- drop table current_year purge; create table current_year( curr_year number(4) not null ,prev_year number(4) not null ,next_year number(4) not null ,primary key(curr_year) ,unique(prev_year) ,unique(next_year) ); insert into current_year(curr_year, prev_year, next_year) values(2010, 2009, 2011); commit; create table yearly_fact_t( year_key number(4) not null ,some_dim_key number not null ,some_measure number not null ) partition by range(year_key)( partition p2007 values less than(2008) ,partition p2008 values less than(2009) ,partition p2009 values less than(2010) ,partition p2010 values less than(2011) ,partition p2011 values less than(2012) ,partition pmax values less than(maxvalue) ); insert into yearly_fact_t(year_key, some_dim_key, some_measure) values(2007,1, 10); insert into yearly_fact_t(year_key, some_dim_key, some_measure) values(2008,1, 20); insert into yearly_fact_t(year_key, some_dim_key, some_measure) values(2009,1, 30); insert into yearly_fact_t(year_key, some_dim_key, some_measure) values(2010,1, 40); commit;
Or better yet, what is it in my query that prevents it from happening?
We do not have Oracle Database 10 g Enterprise Edition Release 10.2.0.4.0 - 64 bit.
Best regards
RonnieI think that the decision of condition influenced gold optimizer. You can rewrite your query to use UNION ALL to see if it helps.
select sum(decode(year_key, curr_year, some_measure)) as curr_year_measure ,sum(decode(year_key, prev_year, some_measure)) as prev_year_measure from (select a.year_key, b.curr_year, some_measure from yearly_fact_t a ,current_year b where a.year_key = b.curr_year UNION ALL select a.year_key, b.curr_year, some_measure from yearly_fact_t a ,current_year b where a.year_key = b.prev_year);
Published by: user503699 on February 17, 2010 14:59
-
Need help for the conversion of the nested loops to use the stream
I'm trying to teach me how to effectively use the java stream, but finds it difficult to find the correct syntax for a problem of nested loop. I would like to convert the following code to use the Java 8 stream instead of nested loops. Can anyone provide an example or a solution?
/** * Return all members of stringListOne that begin with any of the strings in * stringListTwo * * @return all members of stringListOne that begin with any of the strings in * stringListTwo */ Set<String> getFilteredStrings(Set<String> stringListOne, Set<String> stringListTwo) { Set<String> stringListOneFiltered = new HashSet<String>(); for (String next : stringListOne) { for (String nextPrefix : stringListTwo) { if (next.startsWith(nextPrefix)) { stringListOneFiltered.add(next); } } } return stringListOneFiltered; }
Here's a test case for the above code:
/** * Test method for {@link scratchpad.MyClass#getFilteredStrings(java.util.Set, java.util.Set)}. */ @Test public final void testGetFilteredStrings() { MyClass uut = new MyClass(); Set<String> stringListOne = new HashSet<String>(); stringListOne.add("until"); stringListOne.add("unite"); stringListOne.add("under"); stringListOne.add("prepare"); stringListOne.add("pretend"); stringListOne.add("prefix"); stringListOne.add("prepend"); stringListOne.add("post"); stringListOne.add("positive"); stringListOne.add("postgame"); stringListOne.add("postpone"); Set<String> stringListTwo = new HashSet<String>(); stringListTwo.add("post"); stringListTwo.add("pre"); stringListTwo.add("und"); Set<String> result= uut.getFilteredStrings(stringListOne, stringListTwo); System.out.println(result); assertEquals(8, result.size()); }
Thanks for any help you can provide! I get the hang of using the course of water, but this particular code was difficult.
tmbc
I found the following solution to my question:
GetFilteredStrings (Set stringListOne, the value {Set
stringListTwo) Predicate startsWith
= p-> stringListTwo.stream () .anyMatch (prefix-> p.startsWith (prefix)); Return stringListOne.stream () .filter (startsWith) .collect (Collectors.toSet ());
}
-
More simple workflow possible cut pieces of video and video filling in first
I'm looking for the workflow as simple as possible cut out pieces of a video and video filling in first. I am a novice, so I'm not so familiar with the software.
Basically I have a subscription to the first (cc version) purcased since it is able to manage any video format. I may have a few images of the GoPro video taken from screenshot software, something taken with a video camera, etc. Although the video contains parts I want to throw. I need to quickly cut that out and trom it.
I'm looking:
How to mark a part of a video. That cut.
Mark the beginning and end of a video. That cut.
Export the video as a MP4 file or another file format which reads easily on a Windows machine with good quality.
I want to use keyboard shortcuts as much as possible.
Looking forward to your expert advice.
There are two basic approaches, with multiple ways to accomplish each. I'll limit to a single workflow for each approach.
APPROACH A: only inserting the segments you want from the Source monitor in the sequence
- Double-click A Clip to load it in the Source monitor
- In LUN Source, use the JKL keys to rub to the first image of a segment you want to use.
- Press I to develop
- JKL in the last image of the same segment
- Press O to set the point
- Press, [comma] to insert in/out segment in the timeline (see below for a note on the creation of a sequence)
- Repeat steps 2 through 6 for other segments of the same clip.
- Repeat the foregoing for Clips B to Z
B APPROACH: By cutting out segments you don't want the sequence
- Add Clips A to Z of a sequence in the order you want to run
- In the timeline panel, use JKL to rub the last image of a segment you want to cut.
- Press O
- Press (quote) to "extract" (cut the defined segment and the gap) [not required to Point to the first segment because first will assume that frame 0 is the entry point...]
- JKL to the first frame of the next Segment to be cut
- Press I
- JKL in the last image to cut out
- Press O
- Press on '
- Repeat for the rest of the content of the sequence.
These workflows is for on the simplest possible sequence: a series of clips on the same track (i.e. no compositing superposition or Picture-in-Picture) with all the sequential clips the clip a source, then another. If you want to have several layers or cut Clip a to B new Clip in Clip, then things become more complicated.
As to the sequence, since you work with the contents of a series of cameras, you can have clips of different resolutions (SD, HD and even Ultra HD). In this case, you must decide what sequence parameters to use. You usually get the best results by setting the sequence to match content with its very small dimensions, then reduce other content at your leisure; Scaling up generally returns the quality degradation.
While you might start thinking you're doing a very simple mounting, the complexity is almost sure to grow, in order to invest in the time to become familiar with the basic workflows will pay dividends. Here is a good starting point: How to create a video with Premiere Pro | Adobe first Pro CC tutorials
-
Lookup - XML () Xpath function defective - internal error XPath
Hello
I used lookup - xml () function Xpath to look up values from an XML file.
When he finds a key in input value it works fine.
But when he does not find a value for the specified key, it gives the error: internal error xpath.
Code:
oraext:Lookup-XML('oramds:/apps/GETSPRIVIFC/lov/ResourceCode.XML','/resource/ResourceCodes/ResourceCode','Name','Value',$input)
Error:
< exception class = "com.collaxa.cube.xml.xpath.XPathException" >
XPath expression cannot run. An error occurs during the processing of the XPath expression
expression; the expression is
oraext:Lookup-XML('oramds:/apps/GETSPRIVIFC/lov/ResourceCode.XML','/resource/ResourceCodes/ResourceCode','Name','Value',$input).
The XPath expression cannot run; the reason was: internal xpath error.
Check the root cause of detailed described in the text of the exception message and
Make sure the XPath query is correct.
< cell >
< f > com.collaxa.cube.xml.xpath.BPELXPathUtil.evaluate #262 < /f >
< f > com.collaxa.cube.engine.ext.bpel.v1.wmp.BPEL1AssignWMP.__executeStatements #137 < /f >
< f > com.collaxa.cube.engine.ext.bpel.common.wmp.BaseBPELActivityWMP.perform #158 < /f >
< f > com.collaxa.cube.engine.CubeEngine._performActivity #2463 < /f >
< f > com.collaxa.cube.engine.CubeEngine.handleWorkItem #1115 < /f >
< f > com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal #73 < /f >
< f > com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage #220 < /f >
< f > com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory #328 < /f >
< f > com.collaxa.cube.engine.CubeEngine.createAndInvoke #679 < /f >
< f > com.collaxa.cube.engine.ejb.impl.CubeEngineBean.createAndInvoke #103 < /f >
< f > com.collaxa.cube.engine.ejb.impl.CubeEngineBean.syncCreateAndInvoke #145 < /f >
< f > com.collaxa.cube.engine.ejb.impl.bpel.BPELEngineBean.syncCreateAndInvoke #111 < /f >
< f > sun.reflect.GeneratedMethodAccessor4027.invoke < /f >
< f > sun.reflect.DelegatingMethodAccessorImpl.invoke #25 < /f >
< f > java.lang.reflect.Method.invoke #597 < /f >
< f > com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed #149 < /f >
< f >... < /f >
< / stack >
< / exception >
< root class = "javax.xml.xpath.XPathExpressionException" >
internal xpath error
< cell >
< f > oracle.xml.xpath.JXPathExpression.evaluate #242 < /f >
< f > com.collaxa.cube.xml.xpath.BPELXPathUtil.evaluate #240 < /f >
< f > com.collaxa.cube.engine.ext.bpel.common.BPELWMPHelper.evalFromValue #339 < /f >
< f > com.collaxa.cube.engine.ext.bpel.v1.wmp.BPEL1AssignWMP.__executeStatements #137 < /f >
< f > com.collaxa.cube.engine.ext.bpel.common.wmp.BaseBPELActivityWMP.perform #158 < /f >
< f > com.collaxa.cube.engine.CubeEngine._performActivity #2463 < /f >
< f > com.collaxa.cube.engine.CubeEngine.performActivity #2334 < /f >
< f > com.collaxa.cube.engine.CubeEngine.handleWorkItem #1115 < /f >
< f > com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal #73 < /f >
< f > com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage #220 < /f >
< f > com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory #328 < /f >
< f > com.collaxa.cube.engine.CubeEngine.endRequest #4350 < /f >
< f > com.collaxa.cube.engine.CubeEngine.endRequest #4281 < /f >
< f > com.collaxa.cube.engine.CubeEngine.createAndInvoke #679 < /f >
< f > com.collaxa.cube.engine.ejb.impl.CubeEngineBean.createAndInvoke #103 < /f >
< f > com.collaxa.cube.engine.ejb.impl.CubeEngineBean.syncCreateAndInvoke #145 < /f >
< f >... < /f >
< / stack >
< / root >This is the expected behavior. It be handled.
Looks like you are using it for LOV, the best option is DVM.
Based on the DS, there is an option for defaultValue, if the digital Voltmeter has no value, then the default value is sent back rather the exception.
DVM:lookupValue(dvmLocation,sourceColumnName,sourceValue,targetColumnName,DefaultValue)
http://docs.Oracle.com/CD/E15523_01/integration.1111/e10224/bp_appx_functs.htm
Thank you
Vijay -
Is the merge join Cartesian intensibe more CPU than nested loops?
Hello
just wonderning which access method is more intensive CPU, supposed to leave we got 2 the same rank sources and make joing via merge join Cartesian and then case is nested loop.
I know that nl can be CPU due to the tight loop access, but what abour MJC?
I can see bufferd sort but not sure is that cpu friendly?
Concerning
GregGThe simplest answer I think is "it depends on the situation." Two of them could be disaster in different situations. Nested loops are suitable for a type of join and Cartesian for another.
-
Hello
A fundamental question about Nested Loops, what is the number of rows in the inner table means (4 in this example)? This is the average number of lines that oracle had to read by loop?
Thank you.
SYS> SHOW PARAMETER optimizer_features_enable NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ optimizer_features_enable string 11.2.0.1 HR> EXEC DBMS_STATS.GATHER_TABLE_STATS (USER , 'EMPLOYEES' , CASCADE => TRUE ) PL/SQL procedure successfully completed. HR> EXEC DBMS_STATS.GATHER_TABLE_STATS (USER , 'DEPARTMENTS' , CASCADE => TRUE ) PL/SQL procedure successfully completed. HR> SELECT COUNT(*) FROM employees ; COUNT(*) ---------- 107 HR> SELECT COUNT(*) FROM departments ; COUNT(*) ---------- 27 SELECT /*+ USE_NL(e d) */ e.last_name , d.department_name FROM employees e , departments d WHERE e.department_id = d.department_id; Execution Plan ---------------------------------------------------------- Plan hash value: 2968905875 ------------------------------------------------------------------ | Id | Operation | Name | Rows | Bytes | Cost | ------------------------------------------------------------------ | 0 | SELECT STATEMENT | | 106 | 2862 | 24 | | 1 | NESTED LOOPS | | 106 | 2862 | 24 | | 2 | TABLE ACCESS FULL| DEPARTMENTS | 27 | 432 | 2 | |* 3 | TABLE ACCESS FULL| EMPLOYEES | *4* | 44 | 1 | ------------------------------------------------------------------
Hello
A fundamental question about Nested Loops, what is the number of rows in the inner table means (4 in this example)? This is the average number of lines that oracle had to read by loop?
Hello
in fact, it's exactly what it is, with the exception of is not the true Oracle number was read, it is an estimate.
You can track 10053 and see how the optimizer reach these numbers. The optimizer calculates the cardinality of the join using the following formula:
cardinality (employees) * *(join selectivity) cardinality (departments).
and join selectivity is essentially 1/greater (num_distinct (departments.department_id), (departments.department_id) num_distinct), adjusted for null values (not NULL values in this particular case, so no adjustment is necessary).
If you plug the values you get for the cardinality of the join:
107 * 27 * join selectivity, which join selectivity = 1/greater(11, 27) = 1/27 = 0.036691, so 107 * 27 * 0.036 ~ = 106.
4 comes from this number by dividing the cardinality expected join (106) by the estimated number of iterations of the nested loop (27).
It is not true the optimizer assumes an even distribution here - if it did, then it should get to 11 employees by Department, not 4 (because num_distinct (employees.department_id) = 11, not 4).
If you are interested in these issues, please refer to the excellent book by Jonathan Lewis "Cost based fundamentals", is all explained quite well in there.
Best regards
Nikolai -
Is it possible to import xml into Adobe Muse to fill the content similar to InDesign?
Is it possible to import xml into Adobe Muse to fill the content similar to InDesign?
The only way I see that this would be possible through the use of JS that you can insert by using the object-> the option Insert HTML code, you can retrieve the XML to the HTML from here - http://www.w3schools.com/xml/xml_to_html.asp
In order to check this, simply download the sample XML file from the following location - http://www.w3schools.com/xml/cd_catalog.xml and save it somewhere locally. Now to add this file to your Muse project using the file-> add files to the download option, then it appears in the active panel.
Add the code to your page and update the path that references the file cd_catalog.xml to assets/cd_catalog.xml. Now on the preview of the page in the browser, you should see the HTML populated from the XML.
Thank you
Vinayak
-
When oracle uses a nested loop join full?
Hello!
Oracle database uses a complete nested loop join? I mean, imagine 2 tables without any index... is there a case where Oracle made a full scan of the inner table for each row in the outer table? I know it's the original algorithm of the nested loop join, but some databases prefer to do a temp table to autoindex the internal table and never does a full scan of the inner table...
Thank you!!http://download.Oracle.com/docs/CD/B10501_01/server.920/a96533/optimops.htm#49548
is 100% clear in its language. Simply click on it.
A nested loop join involves the following steps:The optimizer determines the driving table and it designates as the outer table.
The other table is referred to as the inner table.
For each row in the outer table, Oracle access all rows from the inner table. The outer loop is for each row in the outer table, and the inner loop is for each line of the internal table. The outer loop appears before the inner loop in the execution plan, as follows:
NESTED LOOPS
outer_loop
inner_loopConcerning
Girish Sharma
Maybe you are looking for
-
I went to play a specific album "White whale" in 'My music' in iTunes this morning. I have played many times before. But today, the album is grayed out and is not... All my other albums are great. Anyone know what's happened here? (I tried searching
-
Satellite L500 - FN toolbar disappeared
I updated to Windows 7 and since then, the "easy tool bar" enabled by FN disappeared.do I need a driver?Thank you
-
VGN-FW530FHave tried looking online without result. I can prove that it is my laptop. I would like to finish my taxes! Need help please... Thank you!
-
Cursor stuck while playing Mahjong
During the game of Mahjong from Microsoft, the cursor hangs. My system is Windows 7 Ultimate on a DELL Latitiude laptop. What can we do?
-
How do successive adds fail?
Hello I have a script (in another language, no Win shell), which is running on Windows XP Pro, which he calls Windows > echo > foobar.txt thousands of times for different channels (between 10 and 250 characters, no space, no special characters). The