Indexing SQL for Between query with only one match?

后端 未结 3 1780
北恋
北恋 2021-01-04 11:15

We have a table with more than two million rows where all queries against it will be a Between lookup using Column1 and Column2. Also, there will

3条回答
  •  囚心锁ツ
    2021-01-04 11:58

    select * from table1 where Col1 <= 8 and Col2 >= 8
    

    Maybe the "between" with two columns is causing an issue.

    Also, you should just have 1 composite index on both columns (Col1, Col2).

提交回复
热议问题