On Wed, Dec 05, 2007 at 11:32:59AM +0200, Andrus wrote: > I do'nt have this index. > dok.kuupaev||dok.kellaaeg conditon should applied after index search is > performed. > It filters out only a small number of rows additionally to the plain kuupaev > filter. > So adding index on dok.kuupaev||dok.kellaaeg is not reasonable IMHO. Your problem is that it is doing that, except postgres is assuming that it does filter more rows. In actual fact the extra condition is making no difference whatsoever. So postgres assumes the result will only give 10 rows and so a nested loop is better. As for the index problem, I don't know but it will probably work better. Have a nice day, -- Martijn van Oosterhout <kleptog@xxxxxxxxx> http://svana.org/kleptog/ > Those who make peaceful revolution impossible will make violent revolution inevitable. > -- John F Kennedy
Attachment:
signature.asc
Description: Digital signature