A terrible schema from a clueless programmer
It's quite hard to create something that works optimally on a first try. I think I never managed to do so!
The first schema was slow, but hey, it worked, good job! That is a huge first step. Modifying it so it runs much faster can definitely come next.