[GENERAL] function indexes, index only scan and sorting

2014-12-12 Thread Jonathan Vanasco
Can someone confirm a suspicion for me ? I have a moderately sized table (20+ columns, 3MM rows) that tracks tags. I have a lower(column) function index that is used simplify case-insensitive lookups. CREATE INDEX idx_tag_name_lower ON tag(lower(name)); I have a few complex queries

Re: [GENERAL] function indexes, index only scan and sorting

2014-12-12 Thread Tom Lane
Jonathan Vanasco postg...@2xlp.com writes: Am I correct in observing that the value of a function index can't be used for sorting ? No ... regression=# create table tt (f1 int, f2 text); CREATE TABLE regression=# create index on tt (lower(f2)); CREATE INDEX regression=# explain select * from

Re: [GENERAL] function indexes, index only scan and sorting

2014-12-12 Thread Jonathan Vanasco
On Dec 12, 2014, at 4:58 PM, Tom Lane wrote: regression=# create table tt (f1 int, f2 text); CREATE TABLE regression=# create index on tt (lower(f2)); CREATE INDEX regression=# explain select * from tt order by lower(f2); QUERY PLAN

Re: [GENERAL] function indexes, index only scan and sorting

2014-12-12 Thread Tom Lane
Jonathan Vanasco postg...@2xlp.com writes: Thank you so much for posting this test. I got a seq scan on my local machine, so I checked the version... still running 9.2.4. I tried it on production (which is 9.3.x) and got the same result as you. Hmm, well, I get the same result from 9.2.9,