Does MySQL have a memory ceiling you can set?

01-21-2010, 01:24 PM

If you accidentally do a cartesian join which returns billions of rows, is there a MySQL feature that can (for example) tell that the memory allocation/consumption is going through the roof and subsequently terminate that query in order to protect the overall health of MySQL?

We mistakenly ran a cartesian join the other day and it ate up all of the memory on the box. Ideally, we would be able to set a param which would help to ensure that a query process would never consume more than X bytes before its automatically killed.

I don't know such a feature, but you could use maatkit: mk-kill for queries that run for too long or mk-loadavg to take action upon high load. You could also combine the two and only kill long running queries when the load gets high.