MYSQL连接执行时间太长

时间:2018-01-09 10:55:05

标签: mysql inner-join

我在两个表上有一个简单的连接,大约需要50秒来执行,我不太清楚为什么?

继承人代码:

    SELECT

  LEFT(t1.group, 3) AS `Group`,
  max(t1.`Z-indexnummer`) As 'ZI-Nummer',
  count(t1.`Z-indexnummer`) As 'PacksDispensed',
  t2. `Artikelomschrijving: inkoophoeveelheid (aantal)`as 'Packsize',
  t2.`Prijs: apotheekinkoop (ex. BTW)` As 'Prijs EX BTW',
  Afleverapotheek, Zorgverzekeraar, Basisproduct, Etiketnaam,
  t2.`Gm.: productnaam: PRK=prescriptie (code)`, t2.`Naam: productverantwoordelijke`,
  t2.`Inkoopkanaal (code)`,
  t3.mnvddd
FROM My_Data as t1
INNER JOIN ZINummer as t2 ON t1.`Z-indexnummer` = t2.`Artikelnummer: ZI-nummer`
INNER JOIN Idea as t3 ON t1.`Z-indexnummer` = t3.atkode
WHERE 

t1.`VPV-Weekaflevering` = '0, Gewone Levering'

  group by t1.`Z-indexnummer`
  order by PacksDispensed desc;

有没有人有任何想法?非常感谢。

由于

0 个答案:

没有答案