mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-11 07:21:37 +08:00
perf(oceanbase): use FETCH FIRST for Oracle auto limit
This commit is contained in:
@@ -322,7 +322,7 @@ export const applyQueryAutoLimit = (
|
||||
if (offsetPos >= 0 && (fromPos < 0 || offsetPos > fromPos)) return { sql, applied: false, maxRows };
|
||||
const forPos = findTopLevelKeyword(main, 'for');
|
||||
if (forPos >= 0 && (fromPos < 0 || forPos > fromPos)) return { sql, applied: false, maxRows };
|
||||
return { sql: `SELECT * FROM (${main.trimEnd()}) WHERE ROWNUM <= ${maxRows}${tail}`, applied: true, maxRows };
|
||||
return { sql: `${main.trimEnd()} FETCH FIRST ${maxRows} ROWS ONLY${tail}`, applied: true, maxRows };
|
||||
}
|
||||
|
||||
const offsetPos = findTopLevelKeyword(main, 'offset');
|
||||
|
||||
Reference in New Issue
Block a user