Load B into a python list and for each calculate maxlat, minlat, maxlong, minlong that everything outside of the box is definitely outside of your radius, if your radius is in nautical miles and lat/long in degrees. You can then raise an SQL query for points meeting criteria of minlat < lat < maxlat and minlong < long < maxlong. The resulting points can then be checked for exact distance and added to the in range list if they are in range.
I would suggest doing this in multiple processes.