From: | James Cloos <cloos(at)jhcloos(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | ILIKE vs indices |
Date: | 2012-12-28 23:04:52 |
Message-ID: | m34nj5eq1e.fsf@carbon.jhcloos.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
While tuning an application, I found the posts from 2003 recomending the
use of LOWER() and LIKE in place of ILIKE to take advantage of indices.
For this app, given the limitations of the upper-layer protocol it must
support, that change replaced about 30 minutes of repeated seq scans with
about 1 minute of repeated index scans! On a query-set often repeated
several times per day. (Probably more times per day now.)
Is there any contraindication to recasting:
foo ILIKE 'bar'
into:
LOWER(foo) LIKE LOWER('bar')
and documenting that an index has to be on LOWER(column) to benefit ILIKE?
Perhaps the parser could read the former as the latter?
-JimC
--
James Cloos <cloos(at)jhcloos(dot)com> OpenPGP: 1024D/ED7DAEA6
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-12-28 23:35:02 | Re: enhanced error fields |
Previous Message | Heikki Linnakangas | 2012-12-28 22:11:28 | Re: dynamic SQL - possible performance regression in 9.2 |