If we add a lot of messages to a queue (i.e. 500.000), and later when the messages has expired the database uses amost all of the CPU.
In MySql administrator we can see that the database is busy with a sql like this:
DELETE FROM JBM_MSG WHERE TIMESTAMP < 1194882127401 AND NOT EXISTS (SELECT * FROM JBM_MSG_REF WHERE JBM_MSG_REF.MESSAGE_ID = JBM_MSG.MESSAGE_ID).
You should try out 1.4.0.SP1