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 takes longer than you expect. What would be convincing is if you had actually *executed* the prepared query, on the same data not different data, and timed that. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq