varchar() vs char16 performance

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Postgres Hackers List <hackers(at)postgresql(dot)org>
Subject: varchar() vs char16 performance
Date: 1998-03-11 14:39:23
Message-ID: 3506A21B.AEA75623@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I ran some timing tests to check the performance of varchar() vs char16.
The results of the test indicate that there is no difference in
performance (within the timing scatter of the tests):

char16 vc(16)
0.99s 1.05s 1 row (this measures startup time, not types)
39.29s 39.28s ~65000 rows

The char2,4,8,16 types seem to have no value-added over the
better-supported char(), varchar(), text types; I am considering
removing them from the backend, and instead have the parser
transparently translate the types into varchar() (or char() - I'm not
certain which is a better match for the types) for v6.4. Applications
would not have to be changed.

Comments?

- Tom

The test is included below:

-- create table c16 (c char16);
create table c16 (c varchar(16));

copy c16 from 'c16.copy';

select count(*) from c16 where c = 'hi there';

select count(*) from c16 where c = 'test string';

select count(*) from c16 where c != 'hi there';

select count(*) from c16 where c != 'test string';

delete from c16;

drop table c16;

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-03-11 14:41:07 Re: [HACKERS] attlen weirdness?
Previous Message The Hermit Hacker 1998-03-11 13:11:48 Re: [HACKERS] attlen weirdness?