title: How to perform database table rename while reading from it
body: <p>After consulting the MySQL manual [1,2], it seems like performing a rename of a table needs a global table lock. Some quick experiments confirm this. This means that if any <code>SELECT</code> statements are executing against this table, the <code>RENAME</code> operation will block until the <code>SELECT</code> statements finish executing.</p>
  
  <p>I was wondering whether it is possible with InnoDB or any other database engine (PostgreSQL maybe?) where read-only operations do not block the database from performing a <code>RENAME table</code>.</p>
  
  <p>I would imagine that the <code>SELECT</code> continues to read from the new table name if the two operations happen concurrently.</p>
  
  <p>[1] <a href="https://dev.mysql.com/doc/refman/5.0/en/rename-table.html" rel="nofollow">https://dev.mysql.com/doc/refman/5.0/en/rename-table.html</a></p>
  
  <p>[2] <a href="https://dev.mysql.com/doc/refman/5.0/en/select.html" rel="nofollow">https://dev.mysql.com/doc/refman/5.0/en/select.html</a></p>