小编Bog*_*ciu的帖子

为什么Oracle使用ORDER BY忽略索引?

我的目的是获得客户的分页结果集.我正在使用Tom的这个算法:

select * from (
  select /*+ FIRST_ROWS(20) */ FIRST_NAME, ROW_NUMBER() over (order by FIRST_NAME) RN
  from CUSTOMER C
)
where RN between 1 and 20
order by RN;
Run Code Online (Sandbox Code Playgroud)

我还在"CUSTOMER"列上定义了一个索引."FIRST_NAME":

CREATE INDEX CUSTOMER_FIRST_NAME_TEST ON CUSTOMER (FIRST_NAME ASC);
Run Code Online (Sandbox Code Playgroud)

查询返回预期的结果集,但是从解释计划中我注意到没有使用索引:

--------------------------------------------------------------------------------------
| Id  | Operation                 | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT          |          | 15467 |   679K|   157   (3)| 00:00:02 |
|   1 |  SORT ORDER BY            |          | 15467 …
Run Code Online (Sandbox Code Playgroud)

sql oracle performance database-performance sql-execution-plan

13
推荐指数
1
解决办法
2万
查看次数

如何设置net.sf.ehcache.CacheManager的名称以进行JMX监控?

我在使用JRE 1.6在Tomcat 6上部署的Web应用程序中使用EhCache 1.4.0,Spring 3.0.5.我通过JMX公开L2缓存管理,如下所示:

<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
    <property name="locateExistingServerIfPossible" value="true" />
</bean>

<util:property-path id="hibernateCacheProvider" path="sessionFactory.settings.cacheProvider" />

<bean id="hibernateEhCacheManager" class="com.mycompany.spring.beans.factory.config.UnaccessibleFieldRetrievingFactoryBean">
    <property name="targetObject" ref="hibernateCacheProvider" />
    <property name="targetField" value="manager" />
    <property name="makeInstanceFieldVisible" value="true" />
</bean>

<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <description>The cacheManager configuration.</description>
    <property name="targetClass" value="net.sf.ehcache.management.ManagementService" />
    <property name="staticMethod" value="net.sf.ehcache.management.ManagementService.registerMBeans" />
    <property name="arguments">
        <list>
            <ref bean="hibernateEhCacheManager" />
            <ref bean="mbeanServer" />
            <value type="boolean">true</value>
            <value type="boolean">true</value>
            <value type="boolean">true</value>
            <value type="boolean">true</value>
        </list>
    </property>
</bean>

<bean class="org.springframework.jmx.export.annotation.AnnotationMBeanExporter">
    <property name="server" ref="mbeanServer" />
    <property name="beans">
        <map>
            <entry key="Hibernate:type=statistics,application=applicationOne">
                <bean class="org.hibernate.jmx.StatisticsService">
                    <property …
Run Code Online (Sandbox Code Playgroud)

java spring jmx mbeans ehcache

6
推荐指数
2
解决办法
8641
查看次数