flatpages sql optimisation