"Heikki Linnakangas" <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Uh, how will that help? AFAICS it still has to call ts_lexize with >> every dictionary.
> No, ts_lexize is no longer in the seq scan filter, but in the sort key > that's calculated only for those rows that match the filter 'mapcfg=? > AND maptokentype=?'. It is pretty kludgey, though. Oh, I see: in the original formulation the planner can push the "WHERE dl.lex IS NOT NULL" clause down into the sorted subquery, and what with one thing and another that clause ends up getting evaluated first in the scan filter condition. We could prevent that by increasing ts_lexize's procost from 1 to 2 (or so), which might be a a good thing anyway since I suppose it's not especially cheap. It's still a klugy solution though. I think Teodor's solution is wrong as it stands, because if the subquery finds matches for mapcfg and maptokentype, but none of those rows produce a non-null ts_lexize result, it will instead emit one row with a null result, which is not what should happen. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org