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

2015-04-19 Thread Jon Dufresne
On Sun, Apr 19, 2015 at 10:42 AM, Tomas Vondra wrote: > > > On 04/19/15 19:16, Jon Dufresne wrote: >> >> Given the table: >> >> CREATE TABLE dates (id SERIAL, d DATE NOT NULL, t TEXT NOT NULL) >> >> With an *index* on field d. The following two qu

[PERFORM] extract(year from date) doesn't use index but maybe could?

2015-04-19 Thread Jon Dufresne
Given the table: CREATE TABLE dates (id SERIAL, d DATE NOT NULL, t TEXT NOT NULL) With an *index* on field d. The following two queries are functionally equivalent: 1. SELECT * FROM dates WHERE d >= '1900-01-01' 2. SELECT * FROM dates WHERE EXTRACT(year from d) >= 1900' By functionally equivale