Hallo,
ich habe eine Abfrage erstellt die viele "Blöcke" enthält.
Jeder Block sind mehrere select Abfragen mit Funktionen usw.
Ich habe diese Abfragen immer optimiert (probiert) und die Ergebnisse (bei 50000 Datensätzen) waren hervorragend. > 1 Sek
Auch alle Blöcke untereinander funktionieren echt gut, sol lange ich das ganze begrenze auf TOP 1000. > 5 Sek.
Bei TOP 2000 bin ich dann gleich bei 100 Sek
Kann es sein das der RAM Servers zu ist?
Wie finde ich herraus wo das Problem ist?
Anbei mal ein Ausschnitt eines "Blocks" (hier ohne Funktionen) der sich immer wieder mit anderen Merkmalen und Bedingungen wiederholt:
[highlight=sql](select String from specs where (ItemID = (SELECT Item FROM Specs s WHERE s.text is NULL and (s.ItemID=i.ID or s.ItemID=i.ParentID or s.ItemID=(SELECT ParentID FROM Items i2 WHERE i2.ID=i.ParentID)
or s.ItemID=(SELECT i3.ParentID FROM Items i2 LEFT JOIN Items i3 on i3.ID=i2.ParentID WHERE i2.ID=i.ParentID) or s.ItemID=(SELECT i4.ParentID FROM Items i2 LEFT JOIN Items i3 on i3.ID=i2.ParentID LEFT JOIN Items i4
on i4.ID=i3.ParentID WHERE i2.ID=i.ParentID)) AND s.SpecType=428)) and (Spectype = '2') and (Language = 'DE')) as i_MerkmalEinheit11,
(select String from specs where (ItemID = (SELECT Item FROM Specs s WHERE s.text is NULL and (s.ItemID=i.ID or s.ItemID=i.ParentID or s.ItemID=(SELECT ParentID FROM Items i2 WHERE i2.ID=i.ParentID) or s.ItemID=
(SELECT i3.ParentID FROM Items i2 LEFT JOIN Items i3 on i3.ID=i2.ParentID WHERE i2.ID=i.ParentID) or s.ItemID=(SELECT i4.ParentID FROM Items i2 LEFT JOIN Items i3 on i3.ID=i2.ParentID LEFT JOIN Items i4
on i4.ID=i3.ParentID WHERE i2.ID=i.ParentID)) AND s.SpecType=431)) and (Spectype = '2') and (Language = 'DE')) as i_MerkmalEinheit21,
(select String from specs where (ItemID = (SELECT Item FROM Specs s WHERE s.text is NULL and (s.ItemID=i.ID or s.ItemID=i.ParentID or s.ItemID=(SELECT ParentID FROM Items i2 WHERE i2.ID=i.ParentID) or s.ItemID=
(SELECT i3.ParentID FROM Items i2 LEFT JOIN Items i3 on i3.ID=i2.ParentID WHERE i2.ID=i.ParentID) or s.ItemID=(SELECT i4.ParentID FROM Items i2 LEFT JOIN Items i3 on i3.ID=i2.ParentID LEFT JOIN Items i4
on i4.ID=i3.ParentID WHERE i2.ID=i.ParentID)) AND s.SpecType=434)) and (Spectype = '2') and (Language = 'DE')) as i_MerkmalEinheit31,[/highlight]
ich habe eine Abfrage erstellt die viele "Blöcke" enthält.
Jeder Block sind mehrere select Abfragen mit Funktionen usw.
Ich habe diese Abfragen immer optimiert (probiert) und die Ergebnisse (bei 50000 Datensätzen) waren hervorragend. > 1 Sek
Auch alle Blöcke untereinander funktionieren echt gut, sol lange ich das ganze begrenze auf TOP 1000. > 5 Sek.
Bei TOP 2000 bin ich dann gleich bei 100 Sek
Kann es sein das der RAM Servers zu ist?
Wie finde ich herraus wo das Problem ist?
Anbei mal ein Ausschnitt eines "Blocks" (hier ohne Funktionen) der sich immer wieder mit anderen Merkmalen und Bedingungen wiederholt:
[highlight=sql](select String from specs where (ItemID = (SELECT Item FROM Specs s WHERE s.text is NULL and (s.ItemID=i.ID or s.ItemID=i.ParentID or s.ItemID=(SELECT ParentID FROM Items i2 WHERE i2.ID=i.ParentID)
or s.ItemID=(SELECT i3.ParentID FROM Items i2 LEFT JOIN Items i3 on i3.ID=i2.ParentID WHERE i2.ID=i.ParentID) or s.ItemID=(SELECT i4.ParentID FROM Items i2 LEFT JOIN Items i3 on i3.ID=i2.ParentID LEFT JOIN Items i4
on i4.ID=i3.ParentID WHERE i2.ID=i.ParentID)) AND s.SpecType=428)) and (Spectype = '2') and (Language = 'DE')) as i_MerkmalEinheit11,
(select String from specs where (ItemID = (SELECT Item FROM Specs s WHERE s.text is NULL and (s.ItemID=i.ID or s.ItemID=i.ParentID or s.ItemID=(SELECT ParentID FROM Items i2 WHERE i2.ID=i.ParentID) or s.ItemID=
(SELECT i3.ParentID FROM Items i2 LEFT JOIN Items i3 on i3.ID=i2.ParentID WHERE i2.ID=i.ParentID) or s.ItemID=(SELECT i4.ParentID FROM Items i2 LEFT JOIN Items i3 on i3.ID=i2.ParentID LEFT JOIN Items i4
on i4.ID=i3.ParentID WHERE i2.ID=i.ParentID)) AND s.SpecType=431)) and (Spectype = '2') and (Language = 'DE')) as i_MerkmalEinheit21,
(select String from specs where (ItemID = (SELECT Item FROM Specs s WHERE s.text is NULL and (s.ItemID=i.ID or s.ItemID=i.ParentID or s.ItemID=(SELECT ParentID FROM Items i2 WHERE i2.ID=i.ParentID) or s.ItemID=
(SELECT i3.ParentID FROM Items i2 LEFT JOIN Items i3 on i3.ID=i2.ParentID WHERE i2.ID=i.ParentID) or s.ItemID=(SELECT i4.ParentID FROM Items i2 LEFT JOIN Items i3 on i3.ID=i2.ParentID LEFT JOIN Items i4
on i4.ID=i3.ParentID WHERE i2.ID=i.ParentID)) AND s.SpecType=434)) and (Spectype = '2') and (Language = 'DE')) as i_MerkmalEinheit31,[/highlight]
Comment