NLS_SORT和NLS_COMP的设置影响性能

author:skate
time:2010/03/04



NLS_SORT和NLS_COMP的设置影响性能

 

 

通过设置这两个参数可以实现自定义的排序和比较的方式,虽然对写程序有优点,但他也会带来负面的影响
就是导致sql不走索引,而走全表扫描,当表的数据量很大是,非常影响性能

 

NLS_SORT和NLS_COMP是10g的新特性,大家在使用新特性的不要只考虑其优点,也要注意它带来的负面影响

 

NLS_SORT:
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.

 
Modifiable:  ALTER SESSION SET NLS_SORT =''
Range of values:  BINARY or any valid linguistic definition name
 

 

NLS_COMP :
specifies the collation behavior of the database session.

 

Values: { BINARY | LINGUISTIC | ANSI }

 

 

 

不同值说明


BINARY
Normally, comparisons in the WHERE clause and in PL/SQL blocks is binary unless you specify the NLSSORT function.

 

LINGUISTIC
Comparisons for all SQL operations in the WHERE clause and in PL/SQL blocks should use the linguistic sort specified
in the NLS_SORT parameter. To improve the performance, you can also define a linguistic index on the column for whichyou want linguistic comparisons.

 

ANSI
A setting of ANSI is for backwards compatibility; in general, you should set NLS_COMP to LINGUISTIC

 

 

 

参考文档:

 

http://www.hellodba.com/Cases/Improper_NLS_Parameter_case.htm

 

 

 

---end---

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值