Re: Index on substring

From: Szymon Guz <mabewlun(at)gmail(dot)com>
To: Håvard Wahl Kongsgård <haavard(dot)kongsgaard(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Index on substring
Date: 2011-06-05 20:00:48
Message-ID: BANLkTinjUhGMc985QhDHKunHadM0MsGhjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2011/6/5 Håvard Wahl Kongsgård <haavard(dot)kongsgaard(at)gmail(dot)com>

> Hi, my database performance badly on substring comparison between two very
> large tables.
> In postgresql 8.4 is it possible to create a index on a substring, or must
> I create an new field for the substring match ( and then create a new index
> for that field)?
>
> --
> Håvard Wahl Kongsgård
>
> http://havard.security-review.net/
>
>

Hi,
I've checked that for 9.0, however for 8.4 should work as well:

CREATE INDEX i_test_sbstr ON test( substring(t, 5, 3) );

It is important that the substring() parameters in the index definition are
the same as you use in your query.

regards
Szymon

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Toby Corkindale 2011-06-06 01:50:43 Re: Question about configuration and SSD
Previous Message Håvard Wahl Kongsgård 2011-06-05 19:46:02 Index on substring