Given a semialgebraic set S, we study the ring B of polynomials that are bounded on S. The size of B can be seen as a measure for the ``compactness'' of S. In general, B is not a finitely generated R-algebra. In this talk, we will discuss necessary and sufficient conditions for B to be finitely generated. In particular, we show that B(S) is finitely generated if S is of dimension at most 2 and sufficiently regular. If time permits, we will also address some applications to certificates of positivity. (joint work with Claus Scheiderer)