List:General Discussion« Previous MessageNext Message »
From:Thomas Spahni Date:May 14 2009 2:33pm
Subject:Re: MAC address as primary key - BIGINT or CHAR(12)
View as plain text  
On Thu, 14 May 2009, Ilia KATZ wrote:

> Hi.
> Currently I have a table:
> 1. MAC address defined as BIGINT
> 2. MAC address set as primary key
>
> Should I consider changing it to CHAR(12)?
>
> Replies will be appreciated.
> Ilia

Hi

It depends. You may convert the MAC address to a decimal integer and store 
it as a BIGINT. Use UNSIGNED as well; there are no negative numbers 
involved. This may gain some speed and saves storage space.

The drawback I can see is that these numbers are not human readable, but 
you may convert back to HEX when retrieving data.

And it may break when they start using larger MAC addresses eventually.

Thomas
Thread
MAC address as primary key - BIGINT or CHAR(12)Ilia KATZ14 May
  • Re: MAC address as primary key - BIGINT or CHAR(12)Fish Kungfu14 May
    • Re: MAC address as primary key - BIGINT or CHAR(12)kabel14 May
    • RE: MAC address as primary key - BIGINT or CHAR(12)Ilia KATZ14 May
  • RE: MAC address as primary key - BIGINT or CHAR(12)Jerry Schwartz14 May
  • Re: MAC address as primary key - BIGINT or CHAR(12)Thomas Spahni14 May
  • Re: MAC address as primary key - BIGINT or CHAR(12)Jim Lyons14 May
  • RE: MAC address as primary key - BIGINT or CHAR(12)Daevid Vincent14 May
Re: MAC address as primary key - BIGINT or CHAR(12)Pete Wilson14 May
  • Re: MAC address as primary key - BIGINT or CHAR(12)Jim Lyons14 May
Re: MAC address as primary key - BIGINT or CHAR(12)Pete Wilson14 May
RE: MAC address as primary key - BIGINT or CHAR(12)Gavin Towey15 May
Re: MAC address as primary key - BIGINT or CHAR(12)Gavin Towey15 May