Skip to content

Commit d7459d1

Browse files
committed
improve looselyIterateObjectID performance for large table (initial oID timeout)
1 parent 4360a9f commit d7459d1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/main/java/picoded/dstack/jsql/JSql_DataObjectMap.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@ public String looselyIterateObjectID(String currentID) {
612612
// Result set to fetch next ID
613613
JSqlResult r = null;
614614
if (currentID == null) {
615-
r = sqlObj.select(primaryKeyTable, "oID", null, null, "oID ASC", 1, 0);
615+
// By searching against oID > "", we provide a hint to use the oID index
616+
r = sqlObj.select(primaryKeyTable, "oID", "oID > ?", new Object[] { "" }, "oID ASC", 1, 0);
616617
} else {
617618
r = sqlObj.select(primaryKeyTable, "oID", "oID > ?", new Object[] { currentID },
618619
"oID ASC", 1, 0);

0 commit comments

Comments
 (0)