hallo,
ich bräuchte mal etwas Hilfe für eine SQL Anfrage, die dauert einfach zu lange.
EXPLAIN gibt mir das hier aus
Das Problem sind sicherlich die anweisungen bei denen "type=all" steht doch leider weiß ich nicht wie ich das mit den Indizes mache.
Wäre sehr dankbar für eure vorschläge
ich bräuchte mal etwas Hilfe für eine SQL Anfrage, die dauert einfach zu lange.
PHP:
SELECT te.adressnr, te.datum
FROM (SELECT adressnr, datum FROM tap_eingang WHERE datum BETWEEN '2005-10-01' AND '2005-10-31') te
LEFT JOIN ( SELECT aa.adressnr , pd.planzeit_von FROM per_dienstplan pd
INNER JOIN per_dienstplan_tourendaten pdt ON pd.dienstplan_id=pdt.dienstplan_id
INNER JOIN adr_abholadressen aa ON
pdt.abholadress_id=aa.abholadress_id WHERE date(pd.planzeit_von) BETWEEN '2005-10-01' and '2005-10-31') tmp ON te.adressnr=tmp.adressnr AND te.datum=date(tmp.planzeit_von) WHERE tmp.adressnr IS NULL
EXPLAIN gibt mir das hier aus
PHP:
id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 13326
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 29449 Using where; Not exists
3 DERIVED pd ALL PRIMARY NULL NULL NULL 24068 Using where
3 DERIVED pdt ref dienstplan_id,
abholadress_id dienstplan_id 4 DB350647.pd.dienstplan_id 11
3 DERIVED aa eq_ref PRIMARY PRIMARY 4 DB350647.pdt.abholadress_id 1
2 DERIVED tap_eingang range datum datum 3 NULL 12706 Using where
Das Problem sind sicherlich die anweisungen bei denen "type=all" steht doch leider weiß ich nicht wie ich das mit den Indizes mache.
Wäre sehr dankbar für eure vorschläge