Skip site navigation (1) Skip section navigation (2)

Re: index scan with functional indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pg(at)fastcrypt(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: index scan with functional indexes
Date: 2004-01-27 17:33:01
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Dave Cramer <pg(at)fastcrypt(dot)com> writes:
> create index r_url_idx on url( fn_strrev(url));

> explain select * from url where url like fn_strrev('%beta12.html');
>                        QUERY PLAN
> ---------------------------------------------------------
>  Seq Scan on url  (cost=0.00..13281.70 rows=1 width=454)
>    Filter: ((url)::text ~~ 'lmth.21ateb%'::text)

> Is it possible to get the planner to use an index scan ?

Sure, but not that way.  Try "fn_strrev(url) like something".
You have to compare the indexed value to something...

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Bruno Wolff IIIDate: 2004-01-27 17:41:35
Subject: Re: Another optimizer question
Previous:From: Tom LaneDate: 2004-01-27 17:27:31
Subject: Re: Recursive optimization of IN subqueries

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group