John Naylor <jcnay...@gmail.com> writes: > A few months ago I was looking into faster search algorithms for > ScanKeywordLookup(), so this is interesting to me. While an optimal > full replacement would be a lot of work, the above ideas are much less > invasive and would still have some benefit. Unless anyone intends to > work on this, I'd like to flesh out the offset-into-giant-string > approach a bit further:
Have at it... > Since PL/pgSQL uses the core scanner, we'd need to use offsets in its > reserved_keywords[], too. Those don't change much, so we can probably > get away with hard-coding the offsets and the giant string in that > case. (If that's not acceptable, we could separate that out to > pl_reserved_kwlist.h and reuse the above tooling to generate > pl_reserved_kwlist_{offset,string}.h, but that's more complex.) plpgsql isn't as stable as all that: people propose new syntax for it all the time. I do not think a hand-maintained array would be pleasant at all. Also, wouldn't we also adopt this technology for its unreserved keywords, too? regards, tom lane