JNDI 缓存中存储了什么?
我们在 Windows 上使用 WebSphere 6.1 连接到另一台 Windows 机器上的 DB2 数据库。 我们在应用程序中使用准备好的语句。 在调整数据库索引(在索引末尾添加一列)时,我们没有看到在具有相同查询的测试数据库上看到的性能提升,在更改索引后,数据库服务器上的处理器实际上被固定了。
准备好的语句查询计划实际上存储在 JNDI 中吗? 如果是这样,如何清除它们? 如果没有,我们如何清除DB2服务器上的缓存呢?
We are using WebSphere 6.1 on Windows connecting to a DB2 database on a different Windows machine. We are using prepared statements in our application. While tuning a database index (adding a column to the end of an index) we do not see the performance boost we saw on a test database with the same query, after changing the index the processor on database server actually was pegged.
Are the prepared statements query plans actually stored in JNDI? If so, how can they be cleared? If not, how can we clear the cache on the DB2 server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
准备好的语句的执行计划存储在 DB2 包缓存中。 添加索引后,包缓存可能仍保留现在次优的旧访问计划。
添加索引后,您将需要至少在该索引上发出 RUNSTATS 语句,以便为 DB2 优化器提供选择合理访问计划所需的信息。
一旦新索引存在 RUNSTATS 统计信息,请发出 FLUSH PACKAGE CACHE 语句以释放涉及受影响表的所有访问计划。 这样做的缺点是,其他动态 SQL 语句的访问计划也将被弹出,导致优化器使用量暂时上升,因为每个不同的 SQL 语句都会被优化和缓存。
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0007117.html
The execution plans for prepared statements are stored in the DB2 package cache. It's possible that after an index is added, the package cache is still holding on to old access plans that are now sub-optimal.
After adding an index, you will want to issue a RUNSTATS statement on at least that index in order to provide the DB2 optimizer with the information it needs to choose a reasonable access plan.
Once the RUNSTATS statistics exist for the new index, issue a FLUSH PACKAGE CACHE statement to release any access plans that involved the affected table. The downside of this is that access plans for other dynamic SQL statements will also be ejected, leading to a temporary uptick in optimizer usage as each distinct SQL statement is optimized and cached.
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0007117.html
查询计划“通常”由 RDBMS 本身保存在数据库中,我猜确切的生命周期是特定于供应商的。 它们绝对不保存在 JNDI 注册表中。
我假设两个数据库中的数据量相似?
如果是,您是否查看了两个数据库的解释计划并确认它们匹配?
如果这两个问题的答案都是肯定的,我就没有主意了,是时候重新启动数据库服务器了。
Query plans are 'normally' held in the database by the RDBMS itself, with the exact life cycle being vendor specific I'd guess. They are definitely not held in a JNDI registry.
I assume there is a similar volume of data in both databases?
If so have you looked at the explain plan for both databases and confirmed they match?
If the answer to both these questions is yes I'm out of ideas and it's time to reboot the database server.