3

I am implementing some retweet type of concept. Now, there can be millions of retweet ( 1-2, 2-3, 3-4, 4-5 ...).

If I delete retweet from 2 then it should also remove from 3, 4, 5, ... To delete this, I have to make that many query as join won't help me. How can I do this deletion for such large number of queries quickly?

vikky
  • 258
  • 3
  • 10
  • 3
    Here's the answer to your question: http://stackoverflow.com/questions/8333302/mysql-foreign-key-on-delete – Niklas Modess Sep 19 '12 at 13:34
  • hey thank you for the link. I am new to mysql so dint knew about cascade. Well, this will solve my problem. Thanks again. – vikky Sep 19 '12 at 14:45

1 Answers1

0

Take a look to "DELETE/UPATE on CASCADE with FOREIGN KEYs for MYSQL" post. HOpe this helps.

G21
  • 1,297
  • 2
  • 18
  • 39