yazan suleiman wrote:
> where magnitude.magnitude>=?
When you pass a literal there, the planner can get a good estimate of
how many rows match that criterion, and give you a good plan based on
that. When it must prepare a plan with a parameter there, it must
assume that *any* value could be submitted, even one which would
require the entire table to be passed. The best plan to use will
depend entirely on the actual value, but PostgreSQL currently fixes a
single plan when you prepare a statement on the server.
For queries like this, you want to be sure that the query is planned
each time based on the actual value.
-Kevin