Posted: Mon Feb 11, 2013 9:04 am Post subject: Deleting set of records from list without looping in WMB
Apprentice
Joined: 08 Jul 2009 Posts: 30
I am looking for a solution to delete set of records matching slection criteria from a large list without looping through the list. This is something similar to "DELETE FROM TABLE WHERE(<matching condition>)" SQL statement.
The actual scenario is, we have big list of records from backend service which have parent child relationship based on an element say "ParentId" in the records. I loop through the list and use SELECT statement on this list to fetch the related records and process them. Then I will create separate message by grouping the records having the same ParentId. I will keep track of ParentId's processed so that the records having the same ParentId is not processed again. Another thing to note here is, records having the same ParentId can appear anywhere in the list which need not be sequential.
To have good response time, I thought it would be better to delete the records processed using SELECT statement so that list becomes smaller and smaller and processing time would become more efficient.
I did not find a simpler way to delete the processed records without looping and hence posting this in this forum. Please let me know if there is a way in ESQL to delete set of records without looping and which simulates SQL DELETE statement.
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
And what is wrong with looping? I think that data structure (perhaps one of the ROW -type trees) you are using doesn't support index or other concept that it could be using to select all the matching records from the arbitary ordered set. I think that at the background the DELETE / SELECT -algorithm need to loop all remaining records anyway.
I think that it might be possible to join the selection / assignment to the new data structure and deletion of the used record in the same loop so you need to loop through your data only as many times as you have parents in your data.
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