ABAP-索引
转载:http://blog.sina.com.cn/s/blog_498610450101kbxl.html
     tables: csks.
     start-of-selection.
       select * up to  rows from csks
                              where kokrs <> space and
                                    kostl <> space
                              %_hints oracle 'index(csks"J")'.
       write: / csks.
     endselect.  
ABAP中SQL语句,指定索引(oracle)
①常用的两种方法:
1、指定使用全表扫描:%_HINTS ORACLE 'FULL(table_name)'
表示扫描整个表
2、指定索引:%_HINTS ORACLE 'INDEX("table_name" " index_name") '
表示扫描索引表
在SQL语句优化过程中,经常会用到hint。
②Using secondary indexes
Consider the following example:
SELECT * FROM SPFLI %_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")' ....... ENDSELECT.
In the above example, 001 is the secondary index of the table SPFLI. It's a well-known fact that the efficient way of retrieving data from the database tables is by using secondary indexes. Many database vendors provide the optimizer hints for the same. From SAP v4.5, optimizer hints can be provided by the %_HINTS parameter. This is dependent on the database systems that support optimizer hints. The point to be noted here is these optimizer hints are not standardized by the SQL standards. Each database vendor is free to provide the optimizer hints.
Now to know which index to use for our table:
1. Go to SE11 and there specify the table name
2. Now from the menu, goto --> indexes
3. select the required index.
Now suppose that the identifier 001 represents a non-unique secondary index comprising of the columns CITYFROM and CITYTO. The index name should be defined as:
~ like SPFLI~001 in the above example.
The sequence of fields in the WHERE condition is of no relevance in using this optimizers index. If you specify hints incorrectly, ABAP ignores them but doesn't return a syntax error or runtime error.
The code was written in R/3 4.6C.
Code
Consider the following example:
REPORT Suresh_test. TABLES: spfli. DATA : t_spfli LIKE spfli OCCURS 0 WITH HEADER LINE. SELECT * FROM spfli INTO TABLE t_spfli %_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")'. LOOP AT t_spfli. WRITE :/ t_spfli. ENDLOOP.
③ABAP--如何在SELECT语句中指定索引(example)
report z_generic_test_program .
tables: csks.
start-of-selection.
select * up to 10 rows from csks
where kokrs <> space and
kostl <> space
%_hints oracle 'index(csks"J")'.
write: / csks.
endselect.
④Control over FOR ALL ENTRIES Hints
Under the heading Database Interface Hints, Note 129385 describes the options you have for influencing the database interface by entering hints. The hints are evaluated in the database interface itself and are not passed on to the database.
Starting with kernel Release 4.6B all the above mentioned FOR ALL ENTRIES parameters can be set via such a hint for a single statement. In the example:
SELECT * FROM [..] FOR ALL ENTRIES IN [..] WHERE [..]
%_HINTS ORACLE '&prefer_in_itab_opt 1&&prefer_fix_blocking -1&'.
This way, the boolean parameter 'prefer_in_itab_opt' is explictly set and the boolean parameter 'prefer_fix_blocking' is set to its default value.
FOR ALL ENTRIES hints, like hints are generally only used as
ABAP-索引的更多相关文章
- ABAP-Keyword Documentation
		转载:https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenabap.htm ABAP - 关键字文档 本文档描述了ABAP语言 ... 
- ABAP中SQL语句,指定索引(oracle)
		①常用的两种方法: 1.指定使用全表扫描:%_HINTS ORACLE 'FULL(table_name)' 表示扫描整个表 2.指定索引:%_HINTS ORACLE 'INDEX("ta ... 
- ABAP开发顾问必备:SAP ABAP开发技术总结
		声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ... 
- 优化ABAP性能(摘录)
		1.使用where语句不推荐Select * from zflight.Check : zflight-airln = ‘LF’ and zflight-fligh = ‘BW222’.Endsele ... 
- ABAP 表格控制(Table Control)和步循环
		表格控制(Table Control)和步循环 1.两个标准Demo: SAPMTZ60,SAPMTZ61 2.简介 3.建立Table Control程序的基本流程 4.使用步循环 5.表格 ... 
- ABAP程序系统字段中英文详解
		SY-SUBRC: 系统执行某指令后,表示执行成功与否的变量,’0’ 表示成功SY-DBLNT: 被处理过的记录的笔数 SY-UNAME: 当前使用者登入SAP的USERNAME;SY-DATUM: ... 
- ABAP:SAP报表性能的优化
		大部分ABAPer都是从SAP报表及打印开始学起的,大家也都认为写个SAP报表程序是最简单不过的事了. 但是实际情况真的如此吗?写报表时除了保证数据的准确性,您可曾考虑过报表的性能问题吗? 由于报表程 ... 
- ABAP 内表 详解
		声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ... 
- 字符串处理:ABAP中的正则表达式
		声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ... 
- ABAP基本数据类型、通用类型
		声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ... 
随机推荐
- php 备份和恢复数据库
			<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ... 
- Linux性能测试工具安装全集
			stress 下载地址:http://people.seas.harvard.edu/~apw/stress/ 一.stress工具安装:1.获取stress源码安装包(stress-1.0.4.ta ... 
- spring 核心思想:AOP 理解
			什么是AOP? AOP概念介绍 所谓AOP,即Aspect orientied program,就是面向方面(切面)的编程. 面向切面编程Aspect-Orlented-Programming,即AO ... 
- DOMContentLoaded 和 Load 事件 区别(待补充)
			javascript会阻塞dom的解析.当解析过程中遇到<script>标签的时候,便会停止解析过程,转而去处理脚本,如果脚本是内联的,浏览器会先去执行这段内联的脚本,如果是外链的,那么先 ... 
- iPhone激活策略说明
			本帖最后由 苏州汇东 于 2014-7-2 19:13 编辑 奉告各位封釉 千万不要泄露机器序列号IMEI号 远程ID真的可以上 只要机器上没有ID 就可以远程上任何ID 我这可以远程上ID 也帮忙 ... 
- js实现动态球形标签云
			HTML 原文演示地址:http://www.17sucai.com/pins/demoshow/8108 <!DOCTYPE html PUBLIC "-//W3C//DTD XHT ... 
- Hibernate对substring和cast的支持问题
			http://blog.sina.com.cn/s/blog_8acd9e4b0102uwev.html Hibernate对substring和cast的支持问题 问题:要比较日期的范围...这是只 ... 
- linux 脚本 逻辑关系的写法及区别
			今天总结一下linux shell中逻辑关机表达方式. 逻辑与的表达:1).if [ $xxx=a -a $xx=b ] 2).if [ $xxx=a ] && [ $xx=b ]逻 ... 
- IIS6与IIS7在编程实现HTTPS绑定时的细微差别
			本文章其实最主要信息是: 问题出在那个小小的*号上——IIS6中不支持通配符,第一部分为空时表示(All Unsigned),而IIS7中同时支持空或通配符的写法,如果为空则自动转为*:443:,我们 ... 
- android 关于 webview 控制其它view的显示 以及更改view数据失败的问题总结
			总结: 1.webview 无法直接更改view的属性,可以通过 handler实现,因为跨线程 2.webview可以通过js api读取 view的属性值 代码: private Handler ... 
