title: Is there any alternative for mysql concat with better performance?
body: <p>I am trying to apply join over two table, the column on which join needs to be applied values for them are not identical due to which i need to used concat but the problem is its taking very long time to run. So here is  the example:</p>
  
  <p>I have two tables:</p>
  
  <ol>
  <li><p>Table: MasterEmployee 
  Fields: varchar(20) id, varchar(20) name, Int age, varchar(20) status</p></li>
  <li><p>Table: Employee
  Fields: varchar(20) id, varchar(20) designation, varchar(20) name, varchar(20) status</p></li>
  </ol>
  
  <p>I have constant prefix: 08080</p>
  
  <p>Postfix of constant length 1 char but value is random.</p>
  
  <p>id in Employee = 08080 + {id in MasterEmployee} +{1 char random value}</p>
  
  <h2><strong>Sample data:</strong></h2>
  
  <p>MasterEmployee:</p>
  
  <p>999, John, 24, approved</p>
  
  <p>888, Leo, 26, pending</p>
  
  <p>Employee:</p>
  
  <p>080809991, developer, John, approved</p>
  
  <p>080808885, Tester, Leo, approved</p>
  
  <h2>Here is the query that i am using:</h2>
  
  <pre><code>select * from Employee e  inner join MasterEmployee me
      on e.id like concat('%',me.id,'%')
   where e.status='approved' and me.status='approved';
  </code></pre>
  
  <p>Is there any better way to do the same ?? because i need to run same kind of query over very large dataset.</p>