Patrick Clery <Patrick(dot)Clery(at)gmail(dot)com> 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