Indexing Null Values in PostgreSQL

后端 未结 5 1922
暗喜
暗喜 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:09

    Did you try to create a combined index on othertable(m_id, col1, col2, col3)?

    You should also check the execution plan (using EXPLAIN) rather than checking the system tables for the index usage.

    PostgreSQL 9.0 (currently in beta) will be able to use and index for a IS NULL condition. That feature got postponed

提交回复
热议问题