pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Bertheau <mbertheau.pg@googlemail.com>
To: A.Burbello <burbello3000@yahoo.com.br>
Cc: Postgres Adm List <pgsql-admin@postgresql.org>
Subject: Re: Search string without tsearch
Date: Wed, 30 Jan 2008 10:34:02 +0600
Message-ID: <684362e10801292034g1a077655i4b67e314eb92f37a@mail.gmail.com> (raw)
In-Reply-To: <440310.20885.qm@web36204.mail.mud.yahoo.com>
References: <440310.20885.qm@web36204.mail.mud.yahoo.com>

2008/1/28, A.Burbello <burbello3000@yahoo.com.br>:
> Hi people,
>
> I would like to some suggestion to search person name
> in a table that has more than 150 milions of rows ...
>
> e.g ... name like 'JOHN%SMITH';
>
> I know there is contrib Tsearch, but I can't for
> political reasons.
> Is there any way to do with good performance???

For LIKE 'John%Smith' you can create one index on the column and one
on reverse(column), and use LIKE 'John%' AND LIKE reverse('%Smith').
The first condition should use the forward index, the second one the
reverse index.

The reverse function needs to be implemented in C for speed, I'm sure
someone else on the list can help out with that.

Markus



view thread (4+ messages)

Message-ID: <684362e10801292034g1a077655i4b67e314eb92f37a@mail.gmail.com>
Permalink:  ../684362e10801292034g1a077655i4b67e314eb92f37a@mail.gmail.com/
Also on:    postgresql.org/message-id/684362e10801292034g1a077655i4b67e314eb92f37a@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: mbertheau.pg@googlemail.com, burbello3000@yahoo.com.br
  Subject: Re: Search string without tsearch
  In-Reply-To: <684362e10801292034g1a077655i4b67e314eb92f37a@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox