1

I am trying to Delete all the contents from a table. So using delete from M_Cast. But it seems to take infinitely long to get executed. The number of rows in the table are just 19. And this is happening only with this particular table M_Cast. What can be the problem..?

Picture of my terminal . I pressed enter and the cursor is still blinking enter image description here

Even I faced this problem MySQL > Table doesn't exist. But it does (or it should) an hour back. I created a new DB as mentioned. But now even when I am trying to delete the DB it doesnt execute.

Why do such weird things happen in MySQL?

Community
  • 1
  • 1
Srinath Mandava
  • 3,384
  • 2
  • 24
  • 37
  • What type of table is this? innodb, MyISAM, etc... and Can you get the table structure? – BK435 Feb 01 '15 at 00:02

1 Answers1

1

If a delete is taking so long on such a small table, then something is presumably locking the table. Alternatively, you could have indexes or cascading deletes that affects a large number of rows in other tables.

One way of doing this is by using show open tables (see the documentation here).

As a note. A faster way to delete all the rows in a table is to use truncate table. This does the deletion without logging or executing delete triggers.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786