Hi, I have a customer running AMQ 5.10.0, JDBC persistence and no journalling like the OP. We saw the same query as the OP last week......also during a restart of the JBoss app server running AMQ embedded. Oracle AWR reports showed this SQL was executed 14,000 times in 1 hour, effectively grinding the DB to a stall....unfortunately also impacting other apps on the same instance. The broker ultimately then failed to the first instance owing to the time to start exceeding the JBoss deployment timeout limit (which we had to subsequently increase).
Has anyone offered any good suggestions to your dilema? Our customer's ACTIVEMQ_MSGS table cardinality matching the "WHERE CONTAINER =" predicate was at 300,000 records so its little wonder the query performs like a dog on each execution. jstacks captured during one of the lengthy startup attempts looked like this: "Broker Starting Thread" prio=10 tid=0x00007fdd38a1b000 nid=0x3bd6 runnable [0x00007fdd70e65000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:152) at java.net.SocketInputStream.read(SocketInputStream.java:122) at oracle.net.ns.Packet.receive(Packet.java:300) at oracle.net.ns.DataPacket.receive(DataPacket.java:106) at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315) at oracle.net.ns.NetInputStream.read(NetInputStream.java:260) at oracle.net.ns.NetInputStream.read(NetInputStream.java:185) at oracle.net.ns.NetInputStream.read(NetInputStream.java:102) at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:124) at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:80) at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1137) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:290) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207) at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:884) at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1167) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1289) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3628) - locked <0x0000000666a73b80> (a oracle.jdbc.driver.T4CConnection) at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1493) at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462) at org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.doGetDurableSubscriberMessageCount(DefaultJDBCAdapter.java:681) at org.apache.activemq.store.jdbc.JDBCTopicMessageStore.getMessageCount(JDBCTopicMessageStore.java:392) at org.apache.activemq.store.ProxyTopicMessageStore.getMessageCount(ProxyTopicMessageStore.java:140) at org.apache.activemq.broker.region.cursors.TopicStorePrefetch.getStoreSize(TopicStorePrefetch.java:88) - locked <0x0000000652a9bc60> (a org.apache.activemq.broker.region.cursors.TopicStorePrefetch) at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.resetSize(AbstractStoreCursor.java:68) at org.apache.activemq.broker.region.cursors.TopicStorePrefetch.<init>(TopicStorePrefetch.java:56) at org.apache.activemq.broker.region.cursors.StoreDurableSubscriberCursor.add(StoreDurableSubscriberCursor.java:119) - locked <0x0000000652a66f38> (a org.apache.activemq.broker.region.cursors.StoreDurableSubscriberCursor) at org.apache.activemq.broker.region.PrefetchSubscription.add(PrefetchSubscription.java:589) - locked <0x0000000652a5ef98> (a java.lang.Object) at org.apache.activemq.broker.region.DurableTopicSubscription.add(DurableTopicSubscription.java:111) at org.apache.activemq.broker.region.Topic.addSubscription(Topic.java:160) at org.apache.activemq.broker.region.TopicRegion.addSubscriptionsForDestination(TopicRegion.java:256) at org.apache.activemq.broker.region.AbstractRegion.addDestination(AbstractRegion.java:144) at org.apache.activemq.broker.region.RegionBroker.addDestination(RegionBroker.java:325) at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:167) at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:167) at org.apache.activemq.advisory.AdvisoryBroker.addDestination(AdvisoryBroker.java:184) at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:167) at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:167) The process seems to be simply fill buffers , possibly for in-memory stores, but why so so inefficient? -- Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html