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

Re: Seq scan with a like operator

From: "Jouneau Luc" <Luc(dot)Jouneau(at)diamant(dot)jouy(dot)inra(dot)fr>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Seq scan with a like operator
Date: 2004-07-23 15:24:31
Message-ID: 011e01c470c9$26b637f0$4703668a@pc502jlo (view raw or flat)
Thread:
Lists: pgsql-admin
> LIKE requires a different kind of index.  See
> <http://www.postgresql.org/docs/7.4/static/indexes-opclass.html>.
Thanks for the answer peter,

I didn't notice it when I red the doc, but if I create the index as
specified then it is the query with equal operator which use a seq scan.
Do I have to create 2 indexes on the same column (with different datatype)
in order to support different kind of queries ?
Well, It seems quite strange to me :
Suppose you have an user interface in which user can parameter his query on
4 varchar fields (independantly, i.e field 4 does not need to have field 1,2
or 3 filled), and you allow to use generic character such as '*' or '?'
(which will be translated into '%' and '_'). User can also fill in exact
values.
Then you would have to create 4*2=8 indexes to handle every combinations of
possible queries.

It would also mean that support both exact generic queries double the
indexing task on update/insert/delete.

Am I wrong ?

Luc Jouneau


In response to

Responses

pgsql-admin by date

Next:From: Peter EisentrautDate: 2004-07-23 16:00:07
Subject: Re: Seq scan with a like operator
Previous:From: Peter EisentrautDate: 2004-07-23 14:54:33
Subject: Re: Seq scan with a like operator

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