How do I convince SQLITE to give me SEARCH semantics over a virtual table instead of SCAN semantics?
e.g. I have: explain query plan SELECT * FROM vtable WHERE value = 12345 0 | 0 | 0 | SCAN TABLE vtable VIRTUAL TABLE INDEX 1: And I'm returning in xBestIndex: pIdxInfo->idxNum = 1; pIdxInfo->idxFlags = SQLITE_INDEX_SCAN_UNIQUE; pIdxInfo->aConstraintUsage[0].argvIndex = 1; pIdxInfo->aConstraintUsage[0].omit = true; pIdxInfo->estimatedCost = 1; pIdxInfo->estimatedRows = 1; So obviously the explain might just be iffy, but I'm actually getting SCAN semantics. Well, somewhere between SEARCH & SCAN. I can perform a true search for the '12345' item between xBestIndex & xFilter, but after I returned the first item, SQLITE keeps calling back my xNext/xEof to ask for more and more items. However... I'm specifying SQLITE_INDEX_SCAN_UNIQUE so why doesn't it stop after I returned the first one? Lacking convincing it to call me more than once... I then tried to tell it that the results I return are ordered and maybe it will notice once it runs beyond the range. Since there's no way to return an unsolicited order in xBestIndex, I've tried: SELECT * FROM vtable WHERE value = 12345 ORDER BY value And then responded: pIdxInfo->orderByConsumed = 1; to the request. But nada - it still keeps calling me over and over. I know I can hack around that by mucking around in my xEof call, but is that the only way? It really does seem like SQLITE_INDEX_SCAN_UNIQUE (or something similar) should achieve SEARCH semantics directly? - Deon _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users