Hi,
I'm observing slow OQL and it seems it's because the indexes are not used. Assume there are 3 regions A, B and C. given the query:
"select distinct c.branchId from A as a, B as b, C as c where a.loginId='user' and a.communityId=b.id and b.id=c.communityId"
The indexes and names are:
loginId
communityId (for A)
id
communityId (for C)
All 3 regions are replicated global scope regions. The region sizes are:
A Size=6554
B Size=1935
C Size=2177
the GF query log says:
Query Executed in 45010.18 ms; indexesUsed(3):id(Results: 0),A.loginId(Results: 11),communityId(Results: 11062) "select distinct c.branchId from A as a, B as b, C as c where a.loginId='user' and a.communityId=b.id and b.id=c.communityId"
Why so long? Why only 3 indexes? We have the data also persisted to SQL so it's pretty easy to verify same query against the region's SQL tables. In SQL same exact query executes instantly. Maybe there is an issue that the indexes A and C have same expression and name 'communityId'? Or is there a limit in GF query optimizer when it sees more than 2 joins, it doesn't consider the indexes properly?
Thank you