> 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"

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to