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

Re: Text pattern JOINs that use indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Brooksby <rb(at)ravenbrook(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Text pattern JOINs that use indexes
Date: 2004-03-15 19:29:48
Message-ID: 25042.1079378988@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Richard Brooksby <rb(at)ravenbrook(dot)com> writes:
> explain select * from files where name like 'foo%';

This is indexable because the LIKE pattern is a constant at plan time,
and so the planner can see that there's a useful range constraint
extractable from the pattern.

> explain select * from test join files on files.name like test.filename  
> || '%';

This is not indexable, because the LIKE pattern is not constant.

			regards, tom lane

In response to

Responses

pgsql-novice by date

Next:From: Richard BrooksbyDate: 2004-03-15 20:53:36
Subject: Re: Text pattern JOINs that use indexes
Previous:From: Richard BrooksbyDate: 2004-03-15 18:48:25
Subject: Text pattern JOINs that use indexes

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