gjerde(at)icebox(dot)org writes:
> Then postgres is not guessing right. Even tho the table only has
> ~200 rows, the query still takes forever to finish. I have let it go for
> a few minutes, and it still wasn't done..
Something wrong there; even with a nested loop, it shouldn't take more
than a few seconds to process that query. Please dig into it a little
more (do you have gprof?) and find where it's spending the time.
regards, tom lane