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:
Shawn Pearce
2013-10-10 00:46:21 -07:00
parent 2a568add87
commit 2d1de10e7f
3 changed files with 3 additions and 3 deletions

View File

@@ -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

View File

@@ -76,6 +76,6 @@ class HasDraftByPredicate extends OperatorPredicate<ChangeData> implements
@Override
public int getCost() {
return ChangeCosts.cost(ChangeCosts.PATCH_SETS_SCAN, getCardinality());
return 0;
}
}

View File

@@ -79,7 +79,7 @@ class IsStarredByPredicate extends OrPredicate<ChangeData> implements
@Override
public int getCost() {
return ChangeCosts.cost(ChangeCosts.IDS_MEMORY, getCardinality());
return 0;
}
@Override