How can I avoid a full table scan on this mysql query?

后端 未结 4 2134
忘掉有多难
忘掉有多难 2021-02-15 13:00
explain
select
    *
from
    zipcode_distances z 
inner join
    venues v    
    on z.zipcode_to=v.zipcode
inner join
    events e
    on v.id=e.venue_id
where
    z.z         


        
4条回答
  •  灰色年华
    2021-02-15 13:46

    Have indexed the columns in both tables?

    e.id and v.venue_id
    

    If you do not, creates indexes in both tables. If you already have, it could be that you have few records in one or more tables and analyzer detects that it is more efficient to perform a full scan rather than an indexed read.

提交回复
热议问题