I have a data source with multiple co-ordinates (can range from 1 to 10000) in one MS SQL DB whose radius can vary dynamically based on the users selection (Source A). Based on the all these co-ordinates I need to find intersecting co-ordinates (around 30000 co-ordinates) from another MS SQL DB (Source B). The radius from the second database is static (range is from 5 miles to entire US). Source A and Source B aren't aware of each other.
Currently, we are passing the first set of co-ordinates from the first DB to second DB. Then, we create a circle for the data from Source A and find intersections between the circles between circles on Source A and Source B. Source B is already storing a Spatial Area (circle) in the table so we don't have to recompute it. This is taking more than 2 minutes. We are trying to optimize it so that the time can be brought down to 1-2 secs. Wondering if anyone has ran into this problem before and optimized it?