Conclusion:
Adding the "index" statement to an Axapta select, it does NOT mean that this index will be used by the database. What it DOES mean is that Axapta will send an "order by" to the database.
Adding the "index hint" statement to an Axapta select, it DOES mean that this index will be used by the database (and no other one).
1. select文里加入了index, 并不表示执行的时候会选择你指定的index来查找数据。但是可定会按你指定的Index里面的字段来排序。
2.select文里加入了index hint, 表示执行的时候肯定会选择你指定的index来查找数据。
这下终于明白了为什么经常看到sql文里有index hint而没有index, 它很鸡肋,order by也可以实现它的功能。
文章来源
http://dynamicsuser.net/forums/t/37123.aspx
本文解析了Axapa SELECT语句中使用INDEX与INDEXHINT的区别:INDEX仅指示排序方式,并不强制数据库使用特定索引;INDEXHINT则明确指定数据库必须使用指定索引进行查询。
161

被折叠的 条评论
为什么被折叠?



