首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Oracle中针对汉语言进行排序

2013-04-26 
Oracle中针对中文进行排序这里要额外注意一下性能问题,按oracle官方文档的解释,oracle在对中文列建立索引

Oracle中针对中文进行排序
这里要额外注意一下性能问题,按oracle官方文档的解释,oracle在对中文列建立索引时,是按照2进制编码进行排序的,所以如果NLS_SORT被设置为BINARY时,排序则可以利用索引.如果不是2进制排序,而是使用上面介绍的3种针对中文的特殊排序,则oracle无法使用索引,会进行全表扫描.这点一定要注意,多用plsql工具比较一下执行效率.解决方法是,在此列上建立linguistic index.例如:CREATE INDEX nls_index ON my_table (NLSSORT(name, 'NLS_SORT = SCHINESE_PINYIN_M'));

以下是oracle文档中的原文:

Note:
Setting NLS_SORT to anything other than BINARY causes a sort to use a full table scan, regardless of the path chosen by the optimizer. BINARY is the exception because indexes are built according to a binary order of keys. Thus the optimizer can use an index to satisfy the ORDER BY clause when NLS_SORT is set to BINARY. If NLS_SORT is set to any linguistic sort, the optimizer must include a full table scan and a full sort in the execution plan.

热点排行