Choosing primary key type: 64 or 52 bit primary keys?

Поиск
Список
Период
Сортировка
Искать

Choosing primary key type: 64 or 52 bit primary keys?

От:
Antonio Vieiro <antonio@antonioshome.net>
Дата:
Hi all,

I'd like to use an integer number for my primary key. I need it to be
bigger than 32 bits.

As far as I understand I have two options:

a) use all the 64 bits of a 'bigint'
b) use the 52 mantissa bits of a 'double precision'

My question is, which would be faster for indexing? I assume the
bigint wins here, right?

Thanks in advance,
Antonio

Re: Choosing primary key type: 64 or 52 bit primary keys?

От:
Radoslaw Smogura <rsmogura@softperience.eu>
Дата:
I think there is no difference in indexing int or floats. Only one difference is speed of comparison of this numbers.

If you create normal system use 64bit ints.  

------------------------
Regards,
Radoslaw Smogura
(mobile)

-----Original Message-----
From: Antonio Vieiro
Sent: 22 lipca 2011 09:01
To: pgsql
Subject: [GENERAL] Choosing primary key type: 64 or 52 bit primary keys?

Hi all,

I'd like to use an integer number for my primary key. I need it to be
bigger than 32 bits.

As far as I understand I have two options:

a) use all the 64 bits of a 'bigint'
b) use the 52 mantissa bits of a 'double precision'

My question is, which would be faster for indexing? I assume the
bigint wins here, right?

Thanks in advance,
Antonio

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: Choosing primary key type: 64 or 52 bit primary keys?

От:
Achilleas Mantzios <achill@matrix.gatewaynet.com>
Дата:
bigint by all means. floating point arithmetic is somewhat more bloated/fuzzy/straight forward than integer,
and even if postgresql was perfect regarding floating point comparisons, no one can claim
the same for client languages. So define your PK as bigint.

Στις Friday 22 July 2011 10:01:58 ο/η Antonio Vieiro έγραψε:
> Hi all,
> 
> I'd like to use an integer number for my primary key. I need it to be
> bigger than 32 bits.
> 
> As far as I understand I have two options:
> 
> a) use all the 64 bits of a 'bigint'
> b) use the 52 mantissa bits of a 'double precision'
> 
> My question is, which would be faster for indexing? I assume the
> bigint wins here, right?
> 
> Thanks in advance,
> Antonio
> 



-- 
Achilleas Mantzios

Re: Choosing primary key type: 64 or 52 bit primary keys?

От:
Achilleas Mantzios <achill@matrix.gatewaynet.com>
Дата:
Στις Friday 22 July 2011 13:25:21 ο/η Achilleas Mantzios έγραψε:
> bigint by all means. floating point arithmetic is somewhat more bloated/fuzzy/straight forward than integer,
                                                                                                                                   ^^^^^^^^^^
oops sorry i mean "less straight forward"
> and even if postgresql was perfect regarding floating point comparisons, no one can claim
> the same for client languages. So define your PK as bigint.
> 
> Στις Friday 22 July 2011 10:01:58 ο/η Antonio Vieiro έγραψε:
> > Hi all,
> > 
> > I'd like to use an integer number for my primary key. I need it to be
> > bigger than 32 bits.
> > 
> > As far as I understand I have two options:
> > 
> > a) use all the 64 bits of a 'bigint'
> > b) use the 52 mantissa bits of a 'double precision'
> > 
> > My question is, which would be faster for indexing? I assume the
> > bigint wins here, right?
> > 
> > Thanks in advance,
> > Antonio
> > 
> 
> 
> 
> -- 
> Achilleas Mantzios
> 



-- 
Achilleas Mantzios
FAQ