Unix Technical Forum

Re: How to delete all rows....

This is a discussion on Re: How to delete all rows.... within the MySQL General forum forums, part of the MySQL category; --> Hi, Its delete * from table will only do if you go for a truncate it will recreate the ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 10:19 PM
Dilipkumar
 
Posts: n/a
Default Re: How to delete all rows....

Hi,

Its delete * from table will only do if you go for a truncate it will
recreate the table structure ?....
It's better to use delete.

Thanks & Regards
Dilipkumar
----- Original Message -----
From: "Peter Lauri" <lists@dwsasia.com>
To: <ravi.karatagi@wipro.com>; <mysql@lists.mysql.com>
Sent: Wednesday, September 20, 2006 1:25 PM
Subject: RE: How to delete all rows....


> DELETE FROM table
>
> -----Original Message-----
> From: ravi.karatagi@wipro.com [mailto:ravi.karatagi@wipro.com]
> Sent: Wednesday, September 20, 2006 10:35 AM
> To: mysql@lists.mysql.com
> Subject: How to delete all rows....
>
>
> Hi All,
>
> How do I delete all the rows of all the tables(but not
> table) in the database at one shot.
>
>
>
>
> Regards,
>
> Ravi K
>
>
>
>
>
>
>
> The information contained in this electronic message and any attachments
> to
> this message are intended for the exclusive use of the addressee(s) and
> may
> contain proprietary, confidential or privileged information. If you are
> not
> the intended recipient, you should not disseminate, distribute or copy
> this
> e-mail. Please notify the sender immediately and destroy all copies of
> this
> message and any attachments.
>
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should
> check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus
> transmitted
> by this email.
>
>
> www.wipro.com
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=d...h@sifycorp.com
>


********** DISCLAIMER **********
Information contained and transmitted by this E-MAIL is proprietary to
Sify Limited and is intended for use only by the individual or entity to
which it is addressed, and may contain information that is privileged,
confidential or exempt from disclosure under applicable law. If this is a
forwarded message, the content of this E-MAIL may not have been sent with
the authority of the Company. If you are not the intended recipient, an
agent of the intended recipient or a person responsible for delivering the
information to the named recipient, you are notified that any use,
distribution, transmission, printing, copying or dissemination of this
information in any way or in any manner is strictly prohibited. If you have
received this communication in error, please delete this mail & notify us
immediately at admin@sifycorp.com


Watch the latest updates on Mumbai, with video coverage of news, events,
Bollywood, live darshan from Siddhivinayak temple and more, only on
www.mumbailive.in

Watch the hottest videos from Bollywood, Fashion, News and more only on
www.sifymax.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 10:21 PM
Chris
 
Posts: n/a
Default Re: How to delete all rows....

Dilipkumar wrote:
> Hi,
>
> Its delete * from table will only do if you go for a truncate it will
> recreate the table structure ?....
> It's better to use delete.


Can you explain why? I'd go for instant truncate rather than waiting
around for delete to finish.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 10:21 PM
Chris
 
Posts: n/a
Default Re: How to delete all rows....

mos wrote:
> At 08:41 PM 9/25/2006, you wrote:
>> Dilipkumar wrote:
>>> Hi,
>>> Its delete * from table will only do if you go for a truncate it will
>>> recreate the table structure ?....
>>> It's better to use delete.

>>
>> Can you explain why? I'd go for instant truncate rather than waiting
>> around for delete to finish.

>
> The drawback of truncate is it requires a table lock and if people are
> updating the table, the truncate will have to wait for the locks to
> complete.


So will a delete from table when it's myisam.

> There is also RI to worry about.


Good point.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 10:21 PM
mos
 
Posts: n/a
Default Re: How to delete all rows....

At 08:41 PM 9/25/2006, you wrote:
>Dilipkumar wrote:
>>Hi,
>>Its delete * from table will only do if you go for a truncate it will
>>recreate the table structure ?....
>>It's better to use delete.

>
>Can you explain why? I'd go for instant truncate rather than waiting
>around for delete to finish.


The drawback of truncate is it requires a table lock and if people are
updating the table, the truncate will have to wait for the locks to
complete. There is also RI to worry about.

Mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:29 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com