Hi Michael,
thank you for your example. I looked into it and yes the performance is surely not acceptable. The reason for this is that the query is not getting optimized correctly, in detail the predicate is not evaluated at an early stage which leads to a full materialization of all points as an intermediate result. I found the issue and we will bring it to the next revision.
There is a more "friendly" way to express the query by using the ST_WithinDistance predicate:
>>
WHERE location.ST_WithinDistance(ST_GeomFromEWKT('SRID=4326;POINT(-94.1167 29.7000)'),50000) = 1;
<<
However, it is suffering from the same problem currently. But in principle it is more optimizer friendly.
If you want to have an intermediate solution you can use ST_Intersects in combination with ST_Buffer which will execute much faster (on my machine with 100.000 points ca. 100ms).
>>
WHERE location.ST_Intersects(ST_GeomFromEWKT('SRID=4326;POINT(-94.1167 29.7000)').ST_Buffer(0.5)) = 1;
<<
Let me know if this works for you.
Cheers
Gerrit