As simple in theory as it sounds I\'ve done a fair amount of research and am having trouble figuring this out.
How can I check if a MySQL table exists and if it does
You can use many different queries to check if a table exists. Below is a comparison between several:
mysql_query('select 1 from `table_name` group by 1'); or
mysql_query('select count(*) from `table_name`');
mysql_query("DESCRIBE `table_name`");
70000 rows: 24ms
1000000 rows: 24ms
5000000 rows: 24ms
mysql_query('select 1 from `table_name`');
70000 rows: 19ms
1000000 rows: 23ms
5000000 rows: 29ms
mysql_query('select 1 from `table_name` group by 1'); or
mysql_query('select count(*) from `table_name`');
70000 rows: 18ms
1000000 rows: 18ms
5000000 rows: 18ms
These benchmarks are only averages: