SQL optimisation for formtools pagination
Merge branch 'dennis/ft-pagination-sql-speedup' into p630