Isak,
> Looks to me like most of the time is spent doing "not in (select a ton
> of rows from bilkaib)".
>
> Try something like "not exists (select null from bilkaib b where
> b.dokumnr = dok.dokumnr and alusdok = 'LY')".
Thank you very much.
Query seems to return now immediately.
dok.dokumnr is not null
bilkaib.dokumnr can be null
I hope that modified query produces same results as original.
Andrus.