Re: How to Use Cascade Delete Properly

2009-01-02 Thread Ian Simpson
If you want deletes to be blocked, then you shouldn't be using ON DELETE CASCADE; the default behaviour is ON DELETE CONSTRAIN, which seems to be what you want; it will refuse to delete any rows that are depended on by rows in other tables. On Thu, 2009-01-01 at 17:07 -0500, Lola J. Lee Beno

Re: How to Use Cascade Delete Properly

2009-01-02 Thread Lola J. Lee Beno
Ian Simpson wrote: If you want deletes to be blocked, then you shouldn't be using ON DELETE CASCADE; the default behaviour is ON DELETE CONSTRAIN, which seems to be what you want; it will refuse to delete any rows that are depended on by rows in other tables. Wouldn't that be: ALTER TABLE

Re: How to Use Cascade Delete Properly

2009-01-02 Thread Ian Simpson
That looks ok to me; I seem to have misremembered the RESTRICT keyword as CONSTRAIN, since it's been a while since I've had to use it. Bear in mind that I don't think MySQL has a check to make sure that the same foreign key does not already exist; I have seen a table that had the same foreign key

Re: slow query log

2009-01-02 Thread Baron Schwartz
It executes in 0 sec when you run it. It might be in the query cache. Try it with SQL_NO_CACHE. But even then it might run faster than it did when it got logged in the slow log, because the table's data might be in memory and therefore faster to access. The point is that the slow query log

Re: slow query log

2009-01-02 Thread Ananda Kumar
# Query_time: 0 Lock_time: 0 Rows_sent: 1 Rows_examined: 150 SELECT SUM(COUNTER_VALUE) FROM STO_LIS sl, SCAT_LIS sfl WHERE l.STO_LIS_ID =sfl.LIS_ID AND sfl.CAT_ID = '-1'; This is what is there in the slow-query log On 1/2/09, Baron Schwartz ba...@xaprb.com wrote: It executes in 0 sec when

RE: How to Use Cascade Delete Properly

2009-01-02 Thread Jerry Schwartz
-Original Message- From: Lola J. Lee Beno [mailto:l...@his.com] Sent: Thursday, January 01, 2009 5:08 PM To: 'MySQL' Subject: How to Use Cascade Delete Properly I'm trying to understand how to use cascade delete properly but not sure if I have this backwards or not. Here's an example:

RE: How to Use Cascade Delete Properly

2009-01-02 Thread Martin Gainty
If you're not going to Cascade Delete you'll need to change ON DELETE CASCADE clause to ON DELETE SET NULL e.g. change FOREIGN KEY(id_b) REFERENCES b(id) ON DELETE CASCADE TO FOREIGN KEY(id_b) REFERENCES b(id) ON DELETE SET NULLhttp://dev.mysql.com/doc/refman/5.0/en/delete.html Martin

Re: Binlog error

2009-01-02 Thread Baron Schwartz
I suspect a bug, honestly. Have you searched bugs.mysql.com? Have you submitted a bug report? On Wed, Dec 31, 2008 at 9:01 AM, Olaf Stein olaf.st...@nationwidechildrens.org wrote: Hi all, As my query yesterday did not generate any responses (possibly it was too long and maybe not well