title: Most efficient way to do a SQL 'INSERT IF NOT EXISTS'
body: <p>Which of the following would perform better?</p>
  
  <pre><code>(1) **INSERT IGNORE**
  cursor.execute('INSERT IGNORE INTO table VALUES (%s,%s)')
  
  (2) **SELECT or CREATE**
  cursor.execute('SELECT 1 FROM table WHERE id=%s')
  if not cursor.fetchone():
      cursor.execute('INSERT INTO table VALUES (%s,%s)')
  </code></pre>
  
  <p>I have to do this patter millions of time so I'm looking to find the best performance for this pattern. Which one is preferably? Why?</p>