Why all the complexity for just a couple of million records? To be honest, I get the impression that the complexity is what makes things slow. Start with some good enough SQL statements and you should be good to go. The 1ms requirement is going to be complicated, any bitfart from the CPU or any network traffic will cause "unacceptable" delays.
↧