Merge "Optimize queries for open/merged changes by project + branch"

This commit is contained in:
Shawn Pearce
2012-04-02 12:00:36 -07:00
committed by gerrit code review
6 changed files with 165 additions and 1 deletions

View File

@@ -101,6 +101,16 @@ public interface ChangeAccess extends Access<Change, Change.Id> {
ResultSet<Change> allClosedNext(char status, String sortKey, int limit)
throws OrmException;
@Query("WHERE open = false AND status = ? AND dest = ? AND sortKey > ?"
+ " ORDER BY sortKey LIMIT ?")
ResultSet<Change> byBranchClosedPrev(char status, Branch.NameKey p,
String sortKey, int limit) throws OrmException;
@Query("WHERE open = false AND status = ? AND dest = ? AND sortKey < ?"
+ " ORDER BY sortKey DESC LIMIT ?")
ResultSet<Change> byBranchClosedNext(char status, Branch.NameKey p,
String sortKey, int limit) throws OrmException;
@Query
ResultSet<Change> all() throws OrmException;
}