SEEK子句实现
适用于 ✅ 开源版 ✅ 专业版 ✅ 企业版
SELECT id, value FROM t WHERE (value, id) > (2, 533) ORDER BY value, id LIMIT 5
create.select(T.ID, T.VALUE) .from(T) .orderBy(T.VALUE, T.ID) .seek(lastValue, lastId) .limit(5) .fetch();
该 ROW
谓词在语法上是最佳的,但可能不会被方言的底层优化器优化到最佳状态。 因此,有两种方法可以影响此谓词的生成,从而可能帮助优化器选择正确的索引
-- Settings.renderRowConditionForSeekClause = false to turn off using the ROW syntax WHERE value > 2 OR value = 2 AND id > 533 -- Settings.renderRedundantConditionForSeekClause = true to add an additional redundant predicate WHERE value >= 2 AND (value, id) > (2, 533) WHERE value >= 2 AND (value > 2 OR value = 2 AND id > 533)
Settings settings = new Settings() .withRenderRowConditionForSeekClause(false) // Default to true .withRenderRedundantConditionForSeekClause(true); // Default to false
反馈
您对此页面有任何反馈吗? 我们很乐意听到您的意见!