Does MySQL have a memory ceiling you can set?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Does MySQL have a memory ceiling you can set?

    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.

    Thank you,

  • #2
    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.


    • #3
      You can try setting max_join_size.

      http://dev.mysql.com/doc/refman/5.0/en/server-system-variabl es.html#sysvar_max_join_size