Using Oracle Index Hints in SQL statements
Using Oracle Index Hints in SQL statements
Hints are used to give specific information that we know about our data and application, to Oracle. This further improves the performance of our system. There can be instances where the default optimizer may not be efficient for a certain SQL statements. We can specify HINTS with the SQL statements, to improve the efficiency of those SQL statements.
In this article, we shall see how to specify INDEX hints and what the advantages of the same are.
1 How to specify Hints
The Hints are enclosed in comment, /* comment */, in an SQL statement, and can only be specified with SELECT, DELETE and UPDATE keyword.
SELECT /* comment */ ........ ;
All hints should start with a + sign. This tells the SQL Parser that the SQL has a hint specified with it.
SELECT /*+{hint} */ ........ ;
2 Using INDEX Hints
When you specify an INDEX Hint, the optimizer knows that it has to use the INDEX specified in the hint. In this case, the optimizer does not go for a Full Table Scan nor does it use any other index. In addition, it does not calculate the cost of the Index to be used.
If no INDEX hint is specified the optimizer determines the cost of the each index that could be used to access the table and uses the one with the lower cost.
If there are multiple indexes specified with the Hint then the optimizer has to determine the cost of each index to be used with the specified table. Once that is determined, it uses the Index with the lower cost to access the table. In this case, the optimizer does not do a FULL Table Scan. Also note that, the optimizer may choose to use multiple indexes and then merge the result sets to access the table. This method is used if the cost is low.
Syntax:
/*+ INDEX ( table [index [index]...] ) */
Where:
table specifies the name or alias of the table associated with the index to be scanned.
index specifies an index on which an index scan is to be
相关文档:
数学函数
在oracle 中distinct关键字可以显示相同记录只显示一条
1.绝对值
S:select abs(-1) value
O:select abs(-1) value from dual
2.取整(大)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.取整(小)
S:select floor(-1.001) value
......
我在把oracle数据导入sqlserver中时,发现在oracle中字段定义为唯一索引时,不同记录的此字段如果为空不被认为是重复的,但在sqlserver中如果此字段为唯一索引字段,不允许有2个以上的空值。郁闷。所以只好将sqlserver中的唯一索引字段手工修改为几个非空的值,但这样程序肯定要进行修改了。需要在程序中为此字段设置不重复 ......
当前任何版本的ORACLE客户端在任何版本的WINDOWS7上都不能正常完成安装。
主要是因为ORACLE安装的先决条件里操作系统版本不符合,但是这个疑问可以修改refhost.xml处理, 具体是在refhost.xml中添加
<!--Microsoft Windows 7-->
<OPERATING_SYSTEM>
& ......
1 操作系统备份
操作系统备份和恢复实施起来比较简单,当然也比较费时,要求系统停止使用,此过程包括关闭数据库并从系统上注销所有用户。所有访问被解除之后,系统关闭并以单用户方式重新启动,控制权交给系统管理员,这一步确保没有用户应用程序软件运行,避免修改硬盘上的数据。如果这个备份用于恢复数据库系统,那么系 ......