|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
Delete repeating childs of a parent |
« View previous topic :: View next topic » |
Author |
Message
|
dogorsy |
Posted: Mon Feb 10, 2014 3:12 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
Gralgrathor wrote: |
dogorsy wrote: |
Yes, it is a convenient option. |
No, it's not. It requires building up a complex structure layer by layer. In stead of a subtree-copy action and a delete, you'd get any number of copy actions, depending on the depth of the first offending element. Even a looped-delete would be better.
dogorsy wrote: |
Easiest does not mean BEST |
Yes, it does. Easiest usually means the code is optimized at machine level, which increases performance. |
If you say that a looped delete would be better, then you DON'T know what you are talking about.
And obviously you don't know how to build a nested select.
and before you come up with some more rubbish, performance tests at the UK Hursley Lab have shown that the SELECT performs far better than the loop.
I am sure mgk will have a say on this. |
|
Back to top |
|
 |
Gralgrathor |
Posted: Mon Feb 10, 2014 3:20 am Post subject: |
|
|
Master
Joined: 23 Jul 2009 Posts: 297
|
dogorsy wrote: |
And obviously you don't know how to build a nested select. |
I'm not sure where you're going with this. A nested select doesn't build a layered complex structure, so you'd need multiple select, depending on the depth of the structure and the depth of the first offending element.
The question is this. I've got an incoming message:
Code: |
Root
FirstLevel
SecondLevel
ThirdLevel
SomeData
SomeData
SecondLevel
ThirdLevel
OffendingElement
OffendingElement
OffendingElement
...
SecondLevel
...
...
|
Now I want this structure copied from InputBody to OutputBody, but without *any* of the <OffendingElement>s under the second occurence of <SecondLevel>/<ThirdLevel>.
How do you do this using SELECT? |
|
Back to top |
|
 |
dogorsy |
Posted: Mon Feb 10, 2014 3:24 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
Gralgrathor wrote: |
How do you do this using SELECT? |
So, you are admitting ignorance.
I know very well how to do that , you will have to look at the infocentre, there are examples.
Try a few things, and then if you need help, say so.
Besides, in your example, you just delete SecondLevel. |
|
Back to top |
|
 |
Gralgrathor |
Posted: Mon Feb 10, 2014 4:02 am Post subject: |
|
|
Master
Joined: 23 Jul 2009 Posts: 297
|
dogorsy wrote: |
So, you are admitting ignorance. |
Well yes. Assumed that the depth of <OffendingElement> remains constant, but the occurrence in ThirdLevel[] may vary, I don't know how to formulate such a query. The documentation only gets me so far; after that it becomes trial and error. |
|
Back to top |
|
 |
dogorsy |
Posted: Mon Feb 10, 2014 4:15 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
Gralgrathor wrote: |
dogorsy wrote: |
So, you are admitting ignorance. |
Well yes. Assumed that the depth of <OffendingElement> remains constant, but the occurrence in ThirdLevel[] may vary, I don't know how to formulate such a query. The documentation only gets me so far; after that it becomes trial and error. |
I agree it is not easy. You need nested selects, as a quick rule of thumb, you need one select per level. And yes, it is trial and error, as each case/message is different. But once you get used to it, it performs far better than anything else you can think of. |
|
Back to top |
|
 |
Gralgrathor |
Posted: Mon Feb 10, 2014 5:02 am Post subject: |
|
|
Master
Joined: 23 Jul 2009 Posts: 297
|
dogorsy wrote: |
But once you get used to it, it performs far better than anything else you can think of. |
I've been doing some trial and error, and I can nearly wrap my head around all but the deepest layers of the structure.
I'm seeing a whole bunch of sub-tree copy actions in my traces, though. One of these days I'll run a benchmark of the single-copy-multiple-delete against the multiple-nested-select solution. Have to spend a few days getting the right query for my prospective data structure first. |
|
Back to top |
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|