> I made the primary key
>
> "authkey" bigint DEFAULT trunc(random()*10^15) NOT NULL
>
> Does that seem reasonable? bigint is 8 bytes. I came up with this prior to
> receiving your reply.
>
> Since I do have to use the authkey to find records, it seems I would still
> benefit by having an index for it even if I had a separate 4 byte primary
> key - so I don't understand how it would save resources or increase
> performance to avoid making this column the primary key? Admittedly, I
> don't understand indexes in depth yet, I just assumed that every
> additional
> index means additional housekeeping activities each time a record is
> changed or added.
>
> Thank you,
>
> - April
Be sure to build into your app some way of handling the error that will
happen if a random primary key is already in the table -- resubmitting it
should work fine (the odds of this happening twice become _extremely_
unlikely, unless your table is very large)
Anyone know off the top of their heads what the period for PG's random()
function is?
- J.