Einzelnen Beitrag anzeigen

omata

Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
 
Delphi 7 Enterprise
 
#10

Re: SQL-Performanceeinbruch bei SELECT

  Alt 21. Mai 2007, 21:41
Hallo alzaimar,

hier mal mein Vorschlag...
SQL-Code:
SELECT [150 Felder]
FROM ([order] JOIN inlinevariables ON icID = 3) o
INNER JOIN customer c
  ON o.cuID = c.cuID
INNER JOIN CustomerAddress ca
  ON c.cuID = ca.cuID
     AND ca.catype = 0
INNER JOIN Address a
  ON ca.adID = a.adID
LEFT JOIN OrderProperty op
  ON o.orID = op.orID
LEFT JOIN Carrier cr
  ON o.crID = cr.crID
LEFT JOIN CarrierProperties cp
  ON o.orPartnercrID = cp.crID
LEFT JOIN OrderPrices op3
  ON o.orID = op3.orID
     AND op3.pmID IN (10, 13, 14)
LEFT JOIN OrderPricemodelparameter op50
  ON o.orID = op50.orID
     AND op50.ppID = 50
LEFT JOIN OrderPricemodelparameter op79
  ON o.orID = op79.orID
     AND op79.ppID = 79
LEFT JOIN OrderPricemodelparameter op36
  ON o.orID = op36.orID
     and op36.ppID = 36
LEFT JOIN OrderPricemodelparameter op53
  ON o.orID = op53.orID
     AND op53.ppID = 53
LEFT JOIN OrderPricemodelparameter op38
  ON o.orID = op38.orID
     AND op38.ppID = 38
LEFT JOIN OrderPricemodelparameter op39
  ON o.orID = op39.orID
     AND op39.ppID = 39
LEFT JOIN OrderPricemodelparameter op40
  ON o.orID = op40.orID
     and op40.ppID = 40
LEFT JOIN (SELECT *
           FROM OrderAddress oa1
           INNER JOIN Address ao1
             ON oa1.adID = ao1.adID
           WHERE oa1.oaType = 0) oa1
  ON o.orID = oa1.orID
LEFT JOIN (SELECT *
           FROM OrderAddress oa2
           INNER JOIN Address ao2
             ON oa2.adID = ao2.adID
           WHERE oa2.oaType = 1) oa2
  ON o.orID = oa2.orID
LEFT JOIN (SELECT *
           FROM OrderAddress oa3
           INNER JOIN Address ao3
             ON oa3.adID = ao3.adID
           WHERE oa3.oaType = 2) oa2
  ON o.orID = oa3.orID
LEFT JOIN (SELECT *
           FROM OrderAddress oa4
           INNER JOIN Address ao4
             ON oa4.adID = ao4.adID
           WHERE oa4.oaType = 3) oa4
  ON o.orID = oa4.orID
LEFT JOIN (SELECT *
           FROM OrderAddress oa5
           INNER JOIN Address ao5
             ON oa5.adID = ao5.adID
           WHERE oa5.oaType = 4) oa5
  ON o.orID = oa5.orID
LEFT JOIN (SELECT *
           FROM OrderAddress oa6
           INNER JOIN Address ao6
             ON oa6.adID = ao6.adID
           WHERE oa6.oaType = 5) oa6
  ON o.orID = oa6.orID
LEFT JOIN (SELECT *
           FROM OrderAddress oa7
           INNER JOIN Address ao7
             ON oa7.adID = ao7.adID
           WHERE oa7.oaType = 6) oa7
  ON o.orID = oa7.orID
Zitat von Gecko:
Ich würds mal mit MySQL versuchen. MSSQL 2000 ist denke nichtmehr so ganz der neuste Stand...
Das ist der Brüller! Ich bin fast vom Stuhl geruscht vor lachen. Danke für diesen Witz.

@Jelly: Sorry, den konnte ich mir jetzt nicht verkneifen.

Gruss
Thorsten
  Mit Zitat antworten Zitat