Re: [SQL] Index working, but not inside function

2007-07-10 Thread Tom Lane
Patrick Clery <[EMAIL PROTECTED]> writes: > When I execute the function the query stalls and is apparently not taking > advantage of the index. Your example doesn't demonstrate any such thing; what seems more likely is that there are a whole lot of rows matching 'United States' and so the query t

[SQL] Index working, but not inside function

2007-07-10 Thread Patrick Clery
## THE PROBLEM I'm trying to write a function that will select the ID of a row from a very large table (2M rows) using an index (places_autocomplete_idx). When I execute the function the query stalls and is apparently not taking advantage of the index. However, executing the same query outside o