avoid using pk if entire table query
Fix optimisation on H2 side