私には次のような声明があります。問題は、実行に約20分かかります:concatキーを持つ同じテーブルのSQL「Not In」節
select fallid, schreibdatum, fachloe, autor, titel from tbltext
where schreibdatum >= '01.01.2015'
and stornierer is null
and texttyp like 'Entl%'
and (titel like '%vorl.%' or titel like '%Vorl.%' or titel like '%vorläu%' or titel like '%Vorläu%')
and concat(fallid, fachloe) not in
(
select concat(fallid, fachloe) from tbltext
where schreibdatum >= '01.01.2015'
and stornierer is null
and texttyp like 'Entl%'
and (titel not like '%vorl.%' and titel not like '%Vorl.%' and titel not like '%vorläu%' and titel not like '%Vorläu%')
and (titel like '%Entlas%' or titel like '%entlas%')
);
私はそれを遅くするいくつかの部分があることを知っています。私は多くの好きが悪いことを知っているが、私はそれを避ける方法を見ていない。それに加えて、私は遅い "not-in-clauses"について他の質問を検索しましたが、私は同じテーブルの "concat-key"をjoinまたはexists not節にする方法を知らない。
ご協力いただければ幸いです。
理由だけではなく、条件を以下の場所でエーション'%vorl。%'のようなタイトルや '%vorläu%'のようなタイトルや '%Vorläu%'のようなタイトル) ( '%Entlas%'や '%entlasのようなタイトル% ')を単一のクエリ内に含めることができます –
単一のfallidに対して複数のエントリが存在する可能性があるためです。私は "vorl"のエントリがあるが、 "Entlas"のエントリはないすべてのfallidを知りたい。 – KaneZ