title: When should I create another field as Primary Key?
body: <p>I'm developing a home automation system using MySQL. I have some arduinos connected through ethernet shields and a Raspberry Pi that manages them using a MQTT server. This server handles the communication between all the devices (each arduino is only connected to the raspberry, which processes the request and sends another request to the same or another arduino).</p>
  
  <p>Also, each arduino is identified by its MAC address.</p>
  
  <p>I have an input (for reading switches and sensors) and an output (turning on and off lamps) system using the arduinos. Each value is stored in the input and output tables.</p>
  
  <p><strong>device</strong></p>
  
  <pre><code> - id : CHAR(12) PK NOT NULL // The MAC Address
   - type : VARCHAR(5) NOT NULL // I also manage a door lock system
  </code></pre>
  
  <p><strong>input</strong></p>
  
  <pre><code> - device : CHAR(12) NOT NULL // FK from device table
   - selection : TINYINT NOT NULL // Selects input port
   - value : INT // Stores the input value
  </code></pre>
  
  <p>The output table is very similar. Both tables have other fields not important to my question.</p>
  
  <p>When someone presses a switch a message is sent to the server, the server processes the request, updates the database and sends back other messages to other arduinos according to a set of tables that manages triggers.</p>
  
  <p>I started noticing some delay turning on the lamp and after some code dump I found out that the majority of the time is spent on the database query.</p>
  
  <p>Is it better if instead of using the MAC address as the PK I create another field (INT AUTO_INCREMENT)? What engine is fastest os better for this situation?</p>
  
  <p><em>PS: The server runs a long running PHP script (it was the best language I knew at the time I started developing this and I was using the web UI as a reference. I know that Python may be better for this case).</em></p>