Pregnancy test

How long after having sex are you able to find out if you’re prego with a pharmacy pregnancy test? Is there a way to find out sooner?