Optimize SQL that uses between clause

前端 未结 19 1946
故里飘歌
故里飘歌 2021-01-11 18:03

Consider the following 2 tables:

Table A:
id
event_time

Table B
id
start_time
end_time

Every record in table A is mapped to exactly 1 reco

19条回答
  •  北恋
    北恋 (楼主)
    2021-01-11 18:37

    The only way out you have to speed up the execution of this query is by making use of indexes.

    Take care to put into an index your A.event_time and then put into another index B.start_time and B.end_time.

    If as you said this is the only one condition which binds the two entities together, I think this is the only solution you can take.

    Fede

提交回复
热议问题