Re: VARCHAR -vs- CHAR: huge performance difference?

Поиск
Список
Период
Сортировка
От C. Bensend
Тема Re: VARCHAR -vs- CHAR: huge performance difference?
Дата
Msg-id 55909.63.227.74.41.1087349538.squirrel@webmail.stinkweasel.net
обсуждение исходный текст
Ответ на Re: VARCHAR -vs- CHAR: huge performance difference?  ("Scott Marlowe" <smarlowe@qwest.net>)
Список pgsql-admin
> Were those fields populated just like the varchar fields?  If not, then
> the test proves little.  If so, I find it hard to believe that char(x)
> would be any faster than varchar.  They're all handled about the same.

Hi Scott,

   Yes, the new table was populated from the data from the original, via
a:

INSERT INTO emails2 SELECT * FROM emails;

   This should be correct, yes?

> If you want to do count(*) on the table, do it by having a table with
> nothing but IDs in it that is referenced by the table with all the
> text.  PostgreSQL can't really optimized aggregate functions with
> indexes, so it always winds up doing seq scans.

   I have also tried doing a count(column) on the emails table, using a
column that is indexed.  It showed no improvement - I would have
expected at least a little gain.  And here's the clincher - when I do
a count(*) on a different table with the same number of rows but only
four varchar columns, it returns the result in 75ms.  (!!!)

Benny


--
"Oh, the Jedis are going to feel this one!"       -- Professor Farnsworth,
                                                     "Futurama"

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: VARCHAR -vs- CHAR: huge performance difference?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Out of memory error