3 ms·
where coalesce(a, '') = coalesce(b, '')
by trts 7y ago
where coalesce(a, '') = coalesce(b, '')
- SigmundA 7y agoNormally can't use an index as every value has to be coalesced before comparison.
- danaliv 7y agoYou can index the results of functions (or other expressions) in at least some databases. PostgreSQL can do this, for example. CREATE INDEX idx ON tbl (coalesce(col, '')) Combining this with UNIQUE can make for some neat tricks.