From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | Wei Weng <wweng(at)kencast(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Does this matter? |
Date: | 2002-11-01 20:23:48 |
Message-ID: | 200211011223.48962.josh@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance pgsql-sql |
Wei,
> Does it make a performance difference if I use a char(20) or a char(36)
> as the primary key? My thought is no, but I would like to hear more
> opinions.
Yes, it does, though probably minor unless you have millions of records. CHAR
is padded out to the specified length. Therefore the index on a char(36)
column will be a little larger, and thus a little slower, than the char(20).
Now, there would be no difference between VARCHAR(20) and VARCHAR(36) unless
you used some of the extra 16 characters on most rows.
Either way, for tables of a few thousand records, I doubt that you'll notice
the difference. BTW, why not use a SERIAL value as a surrogate primary key?
> And a little further off topic(since we have many database experts
> here), does it matter on MS SQL server 7?
Yes, same reason.
--
-Josh Berkus
Aglio Database Solutions
San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Wei Weng | 2002-11-01 20:52:22 | Re: Does this matter? |
Previous Message | Wei Weng | 2002-11-01 20:18:01 | Does this matter? |
From | Date | Subject | |
---|---|---|---|
Next Message | Wei Weng | 2002-11-01 20:52:22 | Re: Does this matter? |
Previous Message | Wei Weng | 2002-11-01 20:18:01 | Does this matter? |