Re: [GENERAL] Re: can't seem to use index - Mailing list pgsql-general

From admin
Subject Re: [GENERAL] Re: can't seem to use index
Date
Msg-id Pine.BSF.4.10.10001111148260.58707-100000@server.b0x.com
Whole thread Raw
In response to Re: [GENERAL] Re: can't seem to use index  (Frank Mandarino <fam@risca.com>)
Responses Re: [GENERAL] Re: can't seem to use index
List pgsql-general
> > I'm trying to use an index on a varchar(32) field, but explain keeps
> > retuning a sequential scan. This is my table and index:
>
> I had a similar problem last year when trying to use an index on a
> char(8) field.  Two solutions worked for me:  1) use "bpchar_ops", and
> 2) leave out the operator class altogether.
>
Thanks, it worked. After reading your previous message, I guess I will
omit the operator class altogether considering postgresql will most likely
make a better decision than me anyways.

Furthermore, since you seem to be quite familiar with this project, are
you aware of any documentation for fine tuning postgresql? For instance,
how can I make an educated decition whether to use char(32) or
varchar(32)? From the documentation, under /docs/user/datatype960.htm, all
four character types are shown in a table but there's no explanation as to
which would be preferable in certain situations. If using explain is the
way to go, it returned a higher cost for a sequential scan on a char()
field compared to a varchar() field. Unfortunately, I suspect using char()
does have some advantages I don't know about.

Maybe these are newbie preoccupations, but I suspect there are a few of us
out there. For the moment, the best tips I've received came from this
mailing list and maybe this is the way to go.

Thanks again for the help,
Marc


pgsql-general by date:

Previous
From: Frank Mandarino
Date:
Subject: Re: [GENERAL] Re: can't seem to use index
Next
From: Sarah Officer
Date:
Subject: views containing agregates questions