Re: extract(year from date) doesn't use index but maybe could?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2015-04-19 15:33, Tom Lane wrote:
> 
>> It's possible that in the future someone will implement an optimization 
>> like this, but I'm not aware of anyone working on that and I wouldn't 
>> hold my breath.
> 
> Yeah.  In principle you could make the planner do this.  As Adam Williams
> notes nearby, there's a problem with lack of exact consistency between
> extract() semantics and straight timestamp comparisons; but you could
> handle that by extracting indexable expressions that are considered lossy,

What about functions that are simpler such as upper()/lower()?

On 9.3, this:
`select email from users where lower(first_name) = 'yves';

is not using the index on first_name (Seq Scan on first_name). This should be
easy to implement?

-- 
http://yves.zioup.com
gpg: 4096R/32B0F416



-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance




[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux