0
我有這個疑問:MySQL的附加鍵不起作用
EXPLAIN SELECT adressid, adressname FROM kino_adressen WHERE city ='Seattle'
:
SELECT adressid, adressname FROM kino_adressen WHERE city ='Seattle'
我想創造這樣
ALTER TABLE <tablename> ADD KEY index_abc(adressid, adressname(40))
索引但是,當我再通過檢查
它說
type = ALL
possible keys = NULL
key = NULL
...rows = 106
任何人都可以提供一些建議如何正確地做到這一點?
//編輯: 還有一個問題我不明白:
SELECT DISTINCT
titel,
regie,
darsteller,
filmbild,
kino_filme.filmid,
kino_filme.beschreibung,
fsk,
filmlaenge,
verleih,
sprachfassung
FROM
kino_filme
LEFT JOIN kino_terminefilme ON (
kino_terminefilme.filmid = kino_filme.filmid
)
LEFT JOIN kino_termine ON (
kino_terminefilme.terminid = kino_termine.terminid
)
LEFT JOIN kino_kinos ON (
kino_kinos.kinoid = kino_termine.kinoid
)
LEFT JOIN kino_adressen ON (
kino_adressen.adressid = kino_kinos.adressid
)
WHERE
kino_adressen.adressid = 32038
爲什麼kino_termine不使用任何索引? 我在創建時將其設置爲PK,之後甚至添加了一個索引,但沒有一個幫助。
這是如此快速而真實的答案,非常感謝,我不知道我必須這樣做:) – user1697061