[cvs] cvs commit: nag/docs nag_tasks.sql

Chuck Hagenbuch chuck@horde.org
Tue, 4 Dec 2001 12:49:04 -0500


Quoting Jon Parise <jon@horde.org>:

>   Remove value after task_owner in primary key.
>   
>   # I have no idea what this was meant to do in the first place.

It only uses the first n characters of the column for the key. So for instance, 
if you have a varchar(255) field, but it's for the most part going to be unique 
in the first 10 characters, then by doing:

create table foo (
  foo_id varchar(255),
  foo_otherinfo varchar(255),
  PRIMARY KEY (foo_id(10), foo_otherinfo(10)
);

... you vastly reduce the size of your indices and speed things up, while 
getting most of the benefit of the key.

I'm having trouble finding a definitive reference at the moment; it might not 
be valid for primary keys. The postgres docs seem a bit sparse; anyone know if 
it takes this syntax in any way (for a key or index instead of a primary key, 
for instance)?

-chuck

--
Charles Hagenbuch, <chuck@horde.org>
"What was and what may be, lie, like children whose faces we cannot see, in the
arms of silence. All we ever have is here, now." - Ursula K. Le Guin