I have a csv dump from one of our other systems with 117,000 records. Each record(line) is unique but one field in the record may point to a parent, which is another record in the file. This is an original dump so no elements are in PI-AF yet for any records. I have dumped my csv file into a DataTable so I can work with it.
Now the problem - slow! I loop through my Datatable and search to see if the record is in PI-AF using the FindElementsByAttribute because the element name isn't unique but two of the attributes together are unique. My first few loops through my filtered Datatable are small so it doesn't take long but as I move down my creation of the tree structure, I have one loop of 9,000 entries and another loop of 107,000 entries. One of my smaller loops is 216 records, and for me to search to see if it exists, or if its parent is present takes me 5 minutes. My code has been running for 22 hours now and it is working on my 107,000 record loop. I have tried to make it faster finding the record's parent AFElement by using FindElement (.FindElement(myPISystemPrimary, tmpElementGUID, tmpVersionID)) but the code still runs slow. Should I expect this type of performance with AF searches in VB.Net or is there another way to search, or is my approach wrong?