Real time query processor, with some optimizations for speed