On Fri, Apr 17, 2015 at 11:34 AM, Kynn Jones <kynnjo@gmail.com> wrote:
One consideration that is complication the choice of primary key is wanting to have the ability to store chunks of the data table (not the metadata table), including the PK column, as matrices of doubles. In its simplest form, this would mean using doubles as primary keys, but this seems to me a bit weird.
I'm willing to go ahead with this, but I wanted to ask for your feedback on the whole thing. In particular I'd like to know if there are there standard ways for using doubles as primary keys, and, conversely, if there are known pitfalls I should be looking out for, but I welcome any other words of wisdom you may have on this topic.
MD>>
First, please ALWAYS include the version and O/S, even with basic questions.
MD>>
I'm not sure what you mean by doubles. Do you mean bigint data type, or do you mean use two columns for a primary key? Either way it's pretty simple.
MD>>
If you mean a bigint, then probably best to use serial data type, which will default to the next value.
MD>>
If you mean use two columns for a Primary Key, the you just specify the columns.
I'd be suspect of choosing a PK whose type definition includes the word "inexact".
You also say you want to store the data as a double precision but you never actually explain what the natural key of the data is.
If you are strictly storing serial (big) integers but doing so within a double precision typed column you may be OK - but I would advise taking input from someone with more expertise on the properties of IEEE floating point numbers.