#21321·vitess

Feature Request: optimize SQL tokenizer string-literal scanning

Author: timvaillancourtCreated Sep 30, 2026Updated Sep 30, 2026
LabelsComponent: Query ServingType: Performance

Feature Description

sqlparser.Tokenizer.scanString scans string literals one byte at a time, including clean literals where standard-library byte searches are substantially faster

A prototype reduces the tokenizer benchmark geomean by 37.4%. On the Lobsters query corpus, parsing improves by 4.7% and BenchmarkNormalizeVTGate improves by 3.1%; allocations are unchanged

Use Case(s)

This reduces vtgate CPU spent parsing ordinary queries, with larger gains for JSON documents, generated INSERTs and other queries carrying long string literals

AI Disclosure

OpenAI Codex and Claude Opus assisted with development, testing, review, and this issue summary