Re: Text pattern JOINs that use indexes - Mailing list pgsql-novice

From Tom Lane
Subject Re: Text pattern JOINs that use indexes
Date
Msg-id 25042.1079378988@sss.pgh.pa.us
Whole thread Raw
In response to Text pattern JOINs that use indexes  (Richard Brooksby <rb@ravenbrook.com>)
Responses Re: Text pattern JOINs that use indexes
List pgsql-novice
Richard Brooksby <rb@ravenbrook.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

pgsql-novice by date:

Previous
From: Richard Brooksby
Date:
Subject: Text pattern JOINs that use indexes
Next
From: Richard Brooksby
Date:
Subject: Re: Text pattern JOINs that use indexes