List:General Discussion« Previous MessageNext Message »
From:Gavin Towey Date:May 15 2009 12:14am
Subject:RE: MAC address as primary key - BIGINT or CHAR(12)
View as plain text  
A MAC address is just a number, it doesn't contain letters unless you're doing something
silly like storing the HEX representation of it. Do not use CHAR!  This does DOUBLE for
all of you storing IP addresses!



Since a MAC address is going to be between 48 and 64 bits, then BIGINT is appropriate. 
When you select the value you can do SELECT HEX(mac) FROM table; to get a more readable
version of it.   When you're storing values you can do: INSERT INTO table (mac) VALUES
(x'FFEEDDCCBBAA9988');  to convert a hex string to the numeric value.





Date: Thu, 14 May 2009 09:53:58 -0400

To: Ilia KATZ <ikatz@stripped>

From: Fish Kungfu <fish.kungfu@stripped>

Cc: mysql@stripped

Subject: Re: MAC address as primary key - BIGINT or CHAR(12)

Message-ID: <f76e38f90905140653o4f6513aft103e8c3b526b3962@stripped>



--001636e90cddd7f9c70469dfa8fe

Content-Type: text/plain; charset=ISO-8859-1

Content-Transfer-Encoding: 7bit



Since MAC addreses also contain letters, BIGINT wouldn't work.  So, yes, I

would say go with CHAR(12).



On May 14, 2009 9:43 AM, "Ilia KATZ" <ikatz@stripped> 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


________________________________
The information contained in this transmission may contain privileged and confidential
information. It is intended only for the use of the person(s) named above. If you are not
the intended recipient, you are hereby notified that any review, dissemination,
distribution or duplication of this communication is strictly prohibited. If you are not
the intended recipient, please contact the sender by reply email and destroy all copies
of the original message.

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