Yes, but it executes something which can be slow, because it needs to start a new process for every query.
This problem can be solved by the fcgi.
A much better solution were if you used mpm-itk ( http://mpm-itk.sesse.net/ ) works like the prefork mpm, but with itk you can define different users/groups for your virtualhosts in the main apache config. There is no need for any setuid or such tricks.