For most CLASSUSEWITH it checks for existence using the relationship on CLASSSTRUCTURE (the parent object, not CLASSUSEWITH) that matches the OBJECTNAME, WORKORDER in this case. It's not looking just for an exact match but also looks for ones below it in the hierarchy. For example, if you are trying to delete the CLASSUSEWITH for the classification WORKORDER\FACILITIES and have WO on WORKORDER\FACILITIES\HVAC Maximo can't allow that either.
You are probably correct that the query is slow. There are indexes for CLASSSTRUCTUREID on some objects but the ones that are most commonly used (ASSET, ITEM, LOCATIONS, WORKORDER, etc.) do not have an index out of the box. I can't think of other scenarios out of the box where this is searched on so it's one of those subjective decisions to make. Sometimes it's better to have a poor performing query than add the overhead of an index, especially on a busy table like WORKORDER. But if your users search on it for example then it is something I'd probably index.
------------------------------
Steven Shull
------------------------------