What are my options to rename a (huge) cache_form table which takes way to long? I inherited a website that has cache_form more than 33Gb.

I've followed the following steps:

CREATE TABLE new_cache_form LIKE cache_form;

RENAME TABLE cache_form TO cache_form_backup;


And in other session:

RENAME TABLE new_cache_form TO cache_form;


Query is taking long long time and site is not responding.

What could the solutions be?
"Waiting for table metadata lock" will happen with a TRUNCATE or a RENAME and once this query is slated to run all other requests behind it will be stalled. There is no way to tell if a query will have a metadata lock unless you attempt to run it. So if the query does indeed cause a metadata lock you'll want to kill that query and use DELETE FROM instead as this is a DML statement where as TRUNCATE or RENAME are DDL statements.

I created a module that handles the above logic: APDQC

If you want to investigate this you self slides 104 - 113 of my 2015 DIY Drupal 7 Performance talk is a good start. How to create a stored procedure in order to auto kill stalled queries: http://mysqlblog.fivefarmers.com/2012/08/28/identifying-and-killing-blocking-transactions-in-innodb/