pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yves Dorfsman <yves@zioup.com>
To: pgsql-performance@postgresql.org
Subject: Re: extract(year from date) doesn't use index but maybe could?
Date: Sun, 19 Apr 2015 16:05:14 -0600
Message-ID: <5534269A.10605@zioup.com> (raw)
In-Reply-To: <6287.1429479191@sss.pgh.pa.us>
References: <CADhq2b51G0QrjNz_vH6e_SLyu=tR0A0G0zHhFsP7rqRr+6FA3w@mail.gmail.com>
	<5533E8F4.2050400@2ndquadrant.com>
	<CADhq2b67QTAD7AkhGm3GZMwCUDU6kR70mpKEEnM=S5h1yRtdgg@mail.gmail.com>
	<55341A3C.1080101@2ndquadrant.com>
	<6287.1429479191@sss.pgh.pa.us>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (10+ messages)  latest in thread

Message-ID: <5534269A.10605@zioup.com>
Permalink:  ../5534269A.10605@zioup.com/
Also on:    postgresql.org/message-id/5534269A.10605@zioup.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: yves@zioup.com
  Subject: Re: extract(year from date) doesn't use index but maybe could?
  In-Reply-To: <5534269A.10605@zioup.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox