Run has:draft and is:starred before secondary index
These properties are stored in the SQL database and cannot be answered by the secondary index. Instead of driving the search tree on the secondary index, use HasDraftByPredicate or IsStarredByPredicate. This avoids looking up every change in the database to see if the target user has starred it or has a draft present. Bug: issue 2160 Change-Id: I12d8fe3c041dcb3fbd0d5fd8eed8384fe6667ee2
This commit is contained in:
@@ -196,7 +196,7 @@ public class IndexedChangeQuery extends Predicate<ChangeData>
|
||||
// Index queries are assumed to be cheaper than any other type of query, so
|
||||
// so try to make sure they get picked. Note that pred's cost may be higher
|
||||
// because it doesn't know whether it's being used in an index query or not.
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -76,6 +76,6 @@ class HasDraftByPredicate extends OperatorPredicate<ChangeData> implements
|
||||
|
||||
@Override
|
||||
public int getCost() {
|
||||
return ChangeCosts.cost(ChangeCosts.PATCH_SETS_SCAN, getCardinality());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class IsStarredByPredicate extends OrPredicate<ChangeData> implements
|
||||
|
||||
@Override
|
||||
public int getCost() {
|
||||
return ChangeCosts.cost(ChangeCosts.IDS_MEMORY, getCardinality());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user