给db2一个提示使用哪个索引? [英] give the db2 a hint which index to use?

查看:265
本文介绍了给db2一个提示使用哪个索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

moin-moin,



我加入了一些表,我想给db2-database一个提示,我希望她使用哪个索引。我知道这可能会导致缓慢的查询,但是我有一个生产和一个测试数据库,并且我想在两个数据库中都有相同的行为(即使在一个数据库中,数据量显着不同或者什么状态(index- )缓存有。



这是可能的(和怎么样)?在线手册中没有找到任何东西,这可能意味着我有了wron搜索条件。 p>

感谢一百万。

解决方案

这不是一般的做法与DB2。但是,您可以使用选择性,应该仍然在目前的版本中。为查询添加选择性子句将影响查询优化器的决策。



还有吉尔伯特上面提到的Le Blanc将会奏效可以更新 syscat.tables colums ,并愚弄DB2,以优化行中不存在的数据量的查询。此外,您的DB / DBM CFG的其余部分应该匹配(即,计算的磁盘和CPU速度,内存使用相关设置等),因为在某些情况下,它们在一定程度上也可能很重要。


moin-moin,

I have a join over some tables, and I want to give the db2-database a hint, which index i want her to use. I know, this may result in a slow query, but I have a production and a test database, and I want the same behaviour in both databases (even if in one db the amount of data is significantly different or what state the (index-)cache has.

Is this possible (and how)? I did not find anything in the online manual, which could mean, I had the wron searching criteria.

Thanks a million.

解决方案

This is not something that is commonly done with DB2. However, you can use selectivity. It should still be around in present versions. Adding selectivity clauses to queries will affect the decisions made by the query optimizer.

Also what Gilbert Le Blanc noted above will work. You can UPDATE the syscat.tables colums and fool the DB2 to optimize the queries for non-existent amounts of data in the rows. Also the rest of your DB / DBM CFG should match (ie. the calculated disk and cpu speeds, memory usage related settings etc) because in some situations they might also matter to some degree.

这篇关于给db2一个提示使用哪个索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆