Indexing Null Values in PostgreSQL

后端 未结 5 1921
暗喜
暗喜 2021-02-12 03:32

I have a query of the form:

select m.id from mytable m
left outer join othertable o on o.m_id = m.id
    and o.col1 is not null and o.col2 is not null and o.col3         


        
5条回答
  •  暖寄归人
    2021-02-12 04:22

    A single index on m_id, col1, col2 and o.col3 would be my first thought for this query.

    And use EXPLAIN on this query to see how it is executed and what takes so much time. You could show us the results to help you out.

提交回复
热议问题