从理论的角度来看,lower(column)
索引在通过SELECT
语句访问时比简单的column
索引更快:
CREATE INDEX idx_indexname ON yourtable (LOWER(columnname) ASC NULLS LAST);
VS
CREATE INDEX idx_indexname ON yourtable (columnname ASC NULLS LAST);
我会使用以下声明:
SELECT columnname FROM yourtable WHERE lower(columnname) LIKE 'myString'