DoS is a broad subject. The acronym stands for Denial of Service. It's a class of attacks meant to cause your server to work way harder than necessary, thereby denying resources to typical and honest users.
The issue in this case is the sql queries. You see, there are two connections going on here, one from the browser to the apache server and the other from the apache server to the mysql server.
Apache does fairly well at preventing too much data from "flooding" a PHP app, but the setting is very liberal (2 to 8 megabytes). The type of vulnerability we are trying to secure from in this post occurs at the second level, between the script and the database server.
If someone was able to put 2 megs of data in the username field, and the poster doesn't trim it down, then he COULD end up with a 2 megabyte query being sent on his end. This would slow down the database and possibly expose the system to deadlocks and intense lag (depending on how his setup is).
Now, mysql does have a limiter for query length, but in many situations users don't know how to set it or it's out of their control.
In the end, it's simply smarter to check inputs for length as well as validity before passing them in a query.