Обсуждение: Speed of varchar vs. char in indices

Поиск
Список
Период
Сортировка

Speed of varchar vs. char in indices

От
Mirko Zeibig
Дата:
Hello,

I have a table:

CREATE TABLE pge (
  pge_id      SERIAL,
  pge_path    CHAR(255) CONSTRAINT ak_pge_path UNIQUE,
  PRIMARY KEY (pge_id)
);

From other tables I now reference pge_id as well as pge_path. Somewhere I
have read that indices on CHAR are faster than those on VARCHAR.

Any remarks?

TIA
Mirko

Re: Speed of varchar vs. char in indices

От
Alfred Perlstein
Дата:
* Mirko Zeibig <mirko@picard.inka.de> [010124 09:07] wrote:
> Hello,
>
> I have a table:
>
> CREATE TABLE pge (
>   pge_id      SERIAL,
>   pge_path    CHAR(255) CONSTRAINT ak_pge_path UNIQUE,
>   PRIMARY KEY (pge_id)
> );
>
> >From other tables I now reference pge_id as well as pge_path. Somewhere I
> have read that indices on CHAR are faster than those on VARCHAR.

No clue, but as a somewhat related note, I don't think indexes work
properly when a join is attempted on a CHAR and VARCHAR column.

--
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."