Skip to content
This repository was archived by the owner on Nov 4, 2019. It is now read-only.

Query cannot be optimized using index #14

@janfabry

Description

@janfabry

The current filterByDistanceFrom can't use an index to speed up the query. Because of the trigonometry functions, every lat-lon pair has to be evaluated to find a possible match.

I think you can help the database by specifying the bounding box too (WHERE (lon > $west_limit AND lon < $east_limit AND lat > $south_limit AND lat < $north_limit) AND ABS([trig stuff here])). A semi-smart database can then use the index to prune out the rows that don't match the first part of the query, and only execute the trig functions for the remaining candidates.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions