Sql optimizations on /period/

Prefetch the previous period for each player. Greatly decreases the number of queries.