This query is not hardcoded, it's based on user input. So the user may do a query based on other fact from the few hundreds available. So improving just on query, out of potential hundreds, might not be such a good idea, because the indexes might take a long time to create and require additional space. Plus the user might use custom facts that we are not aware of. We did some testing on the 100k nodes sandbox with 20 users, but on the n1 server and the query took on average 17983 ms. Then we added an index on the operatingsystem fact and on average, the request took 7272 ms. That's an improvement of approximately 60%. |