indexing and LIKE

From: Patrik Kudo <kudo(at)partitur(dot)se>
To: pgsql-sql(at)postgresql(dot)org
Subject: indexing and LIKE
Date: 2001-10-11 12:28:34
Message-ID: 20011011141651.B50778-100000@tb303.partitur.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi!

If I want to be able to search for stringmatches using LIKE, doing
something like the following:

select id, name from table1 where lower(name) like 'somestring%';

Actually I will be joining with some other table on id too, but the join
will produce a substancial amount of data to be filtered with the LIKE
clause so I figure if it'd be possible to index on lower(name) somehow,
it would result in an appreciated speed gain.

Is it at all possible to create an index on lower(name), and in that case,
what type of index and using what syntax? Is it possible to create a
multicolumn index on both id and name? Both id and name are of type
"text".

TIA,
Patrik Kudo

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bob Vloon 2001-10-11 15:43:57 SQL reference card
Previous Message Alexander Deruwe 2001-10-11 10:48:02 BIGINT's and indexes.