Although the underlying tiles are projected to epsg:3857, the Maps API accepts Latitude/Longitude pairs in epsg:4326 (vs y/x coordinates in meters, which would be implied by 3857).
Therefore if you want to draw a polygon on the map, you would pass the API latitude/longitude and it will be projected appropriately to match the underlying data (note you may wish to specify geodesic:true in your overlay options in the API)
That said you didn't specify what projection your data in PostGIS is index as, so I can't say whether you need to change anything.
I suspect the issue relates to the very real difference existing between geometry
objects, existing on a plane map surface, and geography
objects, existing on a curved globe surface.
It is always more accurate (but slower) to do calculations with geography
types on a globe. Projecting features from a globe onto a plane always incurs distortion.
Looking at your SQL code, on the 3rd line you do cast to geography
but for the "incomplete" reasons. You do it to use meters instead of degrees for the distance measure, and that is good. You should also do it because you get more accurate results.
Now, in the 1st line of your SQL code, you make a point out of coordinate parameters, but it is by default a geometry
and so you end up not comparing like with like. Try casting the point you make to geography
and see what happens.
Like this, i think:
ST_SetSRID(ST_MakePoint($1, $2),4326)::geography
If you draw circles using GMaps, they are probably not representing true circles on the globe. If "GMaps" (not sure what you mean, exactly) uses the Web Mercator projection, then a drawn circle really represents an "egg" shape on the globe, with the pointed end up north. That's how the Mercator projection distorts things -- things get hugely stretched as one moves away from the equator.
Best Answer
Google Maps, like most web maps, works in WGS84, Web Mercator (Auxiliary Sphere) - EPSG 3857. http://spatialreference.org/ref/sr-org/epsg3857-wgs84-web-mercator-auxiliary-sphere/
Planar units are meters.
Also, see this similar question.