This is not a good idea. If you use it as a substitute for a uniqueness constraint, it means you aren't really preventing duplicate entries. There's a race condition present whereby two different clients can perform the query and both conclude that the userid is available.
If, on the other hand, you do (correctly!) have the uniqueness constraint too, then in the case above you will (hopefully) have the code to detect the error caused by uniqueness violation anyway, so why bother with the lookup first?