Best way to purge a table
Best way to purge a table
am 09.11.2009 17:20:30 von keven.jones
Hi,
I need to get rid of all data in one table of my database. The table just h=
as old
Data that I no longer need. What is the best way to accomplish this?
If I simply drop the table what can I do prior to dropping the table to ens=
ure
I can recreate the table right after I drop it? I still need the table just=
not
The data in it. I'm running out of space.
Thank you=
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg
Re: Best way to purge a table
am 09.11.2009 18:22:25 von Mikhail Berman
If DELETE FROM [table_name] is not suitable for your task then try ->
TRUNCATE [table_name] : http://dev.mysql.com/doc/refman/5.0/en/truncate.html
Regards,
Mikhail
Jones, Keven wrote:
> Hi,
>
> I need to get rid of all data in one table of my database. The table just has old
> Data that I no longer need. What is the best way to accomplish this?
>
> If I simply drop the table what can I do prior to dropping the table to ensure
> I can recreate the table right after I drop it? I still need the table just not
> The data in it. I'm running out of space.
>
> Thank you
>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
Re: Best way to purge a table
am 09.11.2009 19:04:33 von John Daisley
Just truncate the table, this will get rid of data whilst preserving the
table structure.
eg: truncate tablename;
regards
John
On Mon, 2009-11-09 at 11:20 -0500, Jones, Keven wrote:
> Hi,
>
> I need to get rid of all data in one table of my database. The table just has old
> Data that I no longer need. What is the best way to accomplish this?
>
> If I simply drop the table what can I do prior to dropping the table to ensure
> I can recreate the table right after I drop it? I still need the table just not
> The data in it. I'm running out of space.
>
> Thank you
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
RE: Best way to purge a table
am 09.11.2009 23:36:41 von Jerry Schwartz
>-----Original Message-----
>From: Jones, Keven [mailto:Keven.Jones@ncr.com]
>Sent: Monday, November 09, 2009 11:21 AM
>To: mysql@lists.mysql.com
>Subject: Best way to purge a table
>
>Hi,
>
>I need to get rid of all data in one table of my database. The table just has
>old
>Data that I no longer need. What is the best way to accomplish this?
>
>If I simply drop the table what can I do prior to dropping the table to
>ensure
>I can recreate the table right after I drop it? I still need the table just
>not
>The data in it. I'm running out of space.
>
[JS]
CREATE TABLE new_table LIKE old_table;
DROP TABLE old_table;
ALTER TABLE new_table RENAME TO old_table;
>Thank you
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe: http://lists.mysql.com/mysql?unsub=jschwartz@the-
>infoshop.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org