在第8行中,当最终执行查询以获得结果列表时,携带的类型信息展示了其优势。
In line 8, the type information that is carried throughout shows its advantage when the query is finally executed to get a list of results.
索引可以减少DBMS在执行查询时检查的行(或元组)数量,从而获得性能增益。
Performance benefits are realized when an index reduces the number of rows (or tuples) examined by the DBMS during query execution.
清单1包括一行复杂的代码,该行执行查询并对结果执行PortableRemoteObject . narrow 。
Listing 1 includes a complicated line performing the lookup and a PortableRemoteObject.narrow on the result.
接下来,创建一个查询以生成要被索引的行。
查看上面的应用程序代码,我们注意到PHP代码减少为两行,而数据库查询包含大部分逻辑。
Looking at the above application code, we note that the PHP code is reduced to two lines, while the database query contains most of the logic.
或者,如果只希望复制表的某些行,那么只需要在查询中使用where子句。
Or, if you'd like only certain rows to be replicated, you just use a WHERE clause in your query.
该查询将只返回200行。
SPARQL代码的下一行描述了查询请求。
The next line of the SPARQL code describes the query request.
例如,当某个特定查询返回几千行给最终用户时,要慎重处理。
For example, proceed cautiously when a particular query returns thousands of rows to the end user.
当选择一个建议时,突出显示sql行,显示对如何重写查询的说明以及对建议的解释(见图1)。
When you select a recommendation, the line of SQL is highlighted, and you are presented with a description of how to rewrite the query, as well as an explanation of the recommendation (see Figure 1).
第一个查询(第2行)返回给定客户的custxml列中的XML数据。
The first query (line 2) returns XML data in the custXML column for the given customer.
实际上,在这里只修改了index方法中的第一行:finder查询。
Actually, all that was changed here is the first line in the index method: the finder query.
这里,我们对数据库进行一次查询,以获得所有的行。
Here, we make one query to the database to get all the rows.
如果查询中的表极其小(通常少于1,000行)或者是群集表,而且查询根本没有选择性的话,那么使用表扫描会更好一些。
If the table in your query are pretty small (usually fewer than 1,000 rows) or clustered tables, and your query is not selective at all, it would be beneficial to use a table scan.
对于只涉及少量到中等数量的行的查询,两个测试数据库之间的性能差异可以忽略不计。
For queries that touch only a small to medium number of rows, the performance difference between the two test databases was negligible.
结果显示该查询返回一行数据。
例如,您可以通过把可以仅从索引就确定需要的行的谓词放到查询中来将行读取降到最低。
For example, you can minimize the rows read by having predicates in the query that can determine the needed rows from just the index alone.
按照空间属性聚集这些行的效果取决于在查询时对一个数据子集的访问。
The effects of clustering the rows by their spatial properties rely on accessing just a subset of the data during query time.
影响个别行和表的简单查询和事务,以及修改基本的字段类型可能不会产生错误。
Simple searches and transactions affecting single rows and single tables, and modification of basic field types should not cause any errors.
远程查询返回相当少的行。
在这种情况下,行必须对用户查询可见,但是需要将这些很少被访问的行转移到更便宜的、性能更低的存储上。
In this case, the rows must still be visible to user queries but there is a desire to move these seldom accessed rows to cheaper, lower performance storage.
因此,在利用本地索引进行访问时,那些行与查询处理无关的分区仍被锁定。
Therefore, some partitions that do not contribute any rows for query processing are still locked when accessed via local index.
当您单击格式化查询中任意一行时,其他包含来自同一张表的列或表引用的查询的行也会高亮显示。
When you click any line in the formatted query, other lines of the query that contain column or table references from the same table are also highlighted.
这包括需要根据几个列中的值的组合选择行的查询。
This includes queries that involve selecting rows based on combinations of values in several columns.
还有一个验证方法,就是发出以下查询,计算符合条件的行的实际值。
Another way to validate this is to issue a query as below to count the real value of the qualified rows.
统计信息还可帮助优化器确定表中有多少行正被查询,以及预测有多少行符合给定的条件。
Statistics also help the optimizer ascertain how many rows exist in tables being queried and predict how many rows will qualify for given conditions.
以下是DB2BATCH运行样例摘要,说明启动行压缩之前和之后的查询执行时间。
Following are DB2BATCH run sample summaries illustrating query execution times before and after row compression has been enabled.
我们发现涉及大量行的查询的性能差异比较大,比如对所有20,000个XML文档进行全表扫描并对每个文档比较字符串。
We found a bigger difference for queries that touch a large number of rows, such as a table scan over all 20,000 XML documents with string comparison on every document.
表的物理行次序将影响该表上几乎所有查询的性能。
The physical order of rows affects performance of almost all queries running against a table.
测试时,我们的每个查询对整个848行数据进行了10次遍历。
The test was run for 10 iterations over a total of 848 rows for each query.
应用推荐