A necessary condition is established for the optimal $(L^p,L^2)$ restriction theorem to hold on a hypersurface $S$, in terms of its Gaussian curvature. For some classes of flat hypersurface we give sharp thresholds for the range of admissible exponents $p$, depending on the specific geometry.