SELECT * FROM locations WHERE id = 12345 LIMIT 1
uses the primary key (id) index, but...
SELECT * FROM locations WHERE id = get_location_id_from_ip(641923892)
LIMIT 1
does not and is verrry slow. Any ideas why? Whats weird is that it
works (uses index) on a previous db, but when I copied everything over
to a new db it doesnt. Ive ran vacuum + analyze, does the planner just
need more time to figure out that it needs to use an index?