PERF: optimise type lookup to avoid invoking procs
Merge pull request #17643 from SamSaffron/select_all_perf

PERF: optimise type lookup to avoid invoking procs