Details
Description
When using a JDBC persitence adapter with a lot of pending messages in a queue, AMQ is almost stuck waiting the execution of the following SQL query:
SELECT ID, MSG FROM ACTIVEMQ_MSGS WHERE CONTAINER=$1 AND ID < $2 AND ID > $3 AND XID IS NULL ORDER BY ID
This query is not a problem when the number of pending messages stays "low". However, this query almost never ends when the number of pending messages is high.
In order to improve this query, the following index is required (I'm using PostgreSQL here):
CREATE INDEX activemq_msgs_pcx_asc_idx ON activemq_msgs (id ASC, xid NULLS FIRST, container); vacuum verbose analyze;
I don't think it would be so easy to add such index in the JDBC adapter directly (I will investigate), but we need at least to document this.
Attachments
Issue Links
- links to