Re: How does Index Scan get used

From: Luis Amigo <lamigo(at)atc(dot)unican(dot)es>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How does Index Scan get used
Date: 2002-02-22 17:04:37
Message-ID: 3C767A25.78D224AA@atc.unican.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> > >
> > > create table test (test_col text);
> > > create index test_index on test (test_col);
> > > insert into test values ('abc.xyz');
> > > insert into test values ('abcxyz');
> > > insert into test values ('abc/xyz');
> > >
>

First of all when you create an index u must specify what kind of ops will use
that index, in this case create index test_index on test (test_col , text_ops)

Second, a index only will be used if there is an advantage on using it, in
this case, u have 3 unique values, unless random-page cost is lower than 3,
planner would not use it.
Third of all, if u want to learn how to use indexes, try numeric values first,
because indexing texts is a bit more difficult.

Attachment Content-Type Size
lamigo.vcf text/x-vcard 290 bytes

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Samuel J. Sutjiono 2002-02-22 17:04:38 Regular Expression for 'and' instead of 'or'
Previous Message Marc Munro 2002-02-22 17:03:57 Re: point in time recovery and moving datafiles online