[p2-dev] Queries and p2 UI performance
If you've ever tried to use the p2 UI for a large repository, you will notice it's terribly slow (when search / expanding, etc...). Turns out the bottleneck is actually expanding the categories. This is because an 'exists' query is used to find all the IUs that satisfy the requirements of the category (all IUs that 'exist' in this category). It turns out that we don't actually use the index (capabilityIndex) in this case, so for each element in each category we check each IU.
The reason we don't use the index is because of how the query is formed. It's not actually a 'capability query' but rather an 'exists query' that asks which IU satisfies a particular required capability. The index doesn't know what this means, so it's not used.
I've managed to work on a solution to this, however it's a little hacky. Basically we need to try to inspect the query to see if it's really a capability query under the covers. If it is, then we need to inspect the query to find the 'name' of the requirement and use that in our index.
I'm certainly not a p2ql expert, so I wonder if Thomas Hallgren can take a look at my patch?