Is it faster to drop a table and recreate it or is it faster to drop all the records in the table?
The table in question will only have up to 25 records with 12 fields each.
I suppose dropping all records then optimizing table is slower than dropping an recreating an empty table.
What do best practices indicate?
Thanks!
Which is faster...
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Which is faster...
I'm not sure. I would assume dropping the table faster, but unless you have millions or more of records I'm not sure it would be measurable and worth the time to consider. It would be easier and less code to truncate the table, and I would go that route.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
- stevenrokz
- Forum Newbie
- Posts: 2
- Joined: Thu Jan 28, 2010 5:24 am
Re: Which is faster...
In table with less records dropping & recreating a table would be faster process, but dropping a table with huge data , i am not sure about
Re: Which is faster...
With only 25 rows, it doesn't really matter. I'd say go with whichever makes your PHP code simpler.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.