Let $G$ be a graph with degrees $d_{1},\ldots,d_{n}$. I am interested in upper bounds on $$ \sum_{i=1}^{n}{d_{i}^{2}}. $$ An example is de Caen's bound: $$ \sum_{i=1}^{n}{d_{i}^{2}} \leq e(\frac{2e}{n-1}+n-2), $$ where $e$ is the number of edges. His bound is very elegant but far from tight. I have read many papers which give other bounds but now I am a bit confused and would love to know if someone can supply a definitive answer.

P.S. The quantity in question is also known as the "first Zagreb index", mostly in chemistry-related circles.