On the optimal polynomial approximation of stochastic PDEs by Galerkin and collocation methods