如何应用 优化Derby数据库
matrix 上的翻译文章
原文地址
Tun Derby
优化 Derby 数据库
bi Dejan Bosanac
作者 Dejan Bosanac
01/31/2007
Ther is a big differ in the behavior of a databas when it is popul with a small amount of test input and when it hold a larg amount of data. Usually, you would not address these databas perform issu earli in the develop process, but when the time comes, you should take some action to ensur that the applic is work correctli with larg amount of data.
数据库在操作少量测试数据和大量数据的时候,表示行为上有很大的差别。通常,开发过程前期,人们不会关注数据库性能的问题,但是随着时间的发展,人们必需采取一些措施来保证数据库在大量数据的情况下正常工作。
Th all-Java open-sourc databas Derbi is no exception, so you'll have to make sure it will not be a bottleneck to your application. Although you can find comprehens materi on thi topic among Derby' manuals, I would like to focu on certain issu in more detail and give some exampl from my own experience. I will focu on applic perform relat to select data from larg tables.
Derby 这个完全 Java 开发的开源的数据库也不例外,因此你必需保证它不会成为你顺序的一个瓶颈。尽管人们可以在 Derby 手册中找到关于这个话题全面的资料,还是想更详尽的关注一下这些问题,基于我经验提供一些具体的例子。本文将着重于那些由在大的数据表中选择查询数据而产生的顺序性能问题。
First of all, there ar variou tip on how you should tune Derby properti such as page size and the size of the cache. Plai with these paramet can help you improv perform to some degree, but usual the bigger problem li in your applic and databas design, so you should focu on these issu first and leav Derby properti for the end.
首先,有很多关于调整 Derby 属性(诸如页面大小和缓存大小等)技巧。修改这些参数可以在一定水平上调整数据库的性能,但是通常情况下,更主要的问题来自与你顺序和数据库的设计,因此,必需首先关注这些问题,最后再来考虑 Derby 属性。
In the follow sections, I will cover some techniqu that can help you optim problemat part of your application. But as with all other performance-tun activities, measur and posit identifi problem befor optimizing.
接下来的段落里,将介绍一些能够优化顺序中有问题部分的技术。但是和其他性能优化操作一样,需要在优化前先丈量并确认问题所在
A Simpl Example
一个简单的例子
Let' start with a simpl example: We have a "search"/"list" page in our web applic that ha to deal with a tabl of nearli 100,000 rows, and let' sai that the tabl is not trivial i.e., that it ha at least 10 column . I will write an exampl in plain JDBC so we can focu on databas and JDBC issues. The principl explain in thi articl should be applic to all Object-Rel map tool as well.
让我从一个简单的例子开始:假设我 Web 顺序中拥有一个 “ search/list 页面,要处置一个有接近 100 000 行的表,并且那个表不是很小的至少有 10 栏)用简单的 JDBC 来写一个例子,这样我可以专注在数据库和 JDBC 问题上来。这篇文章中介绍的所有准则对所有的面向对象的映射工具都适用。