Add an index and change query build strategy to speed up things a little bit