Colleagues,
Consider the following snippets of a snapshot:
Number of executions = 13
Number of compilations = 4294967295
Rows read = 415532
Buffer pool data logical reads = 13741
Buffer pool data physical reads = 0
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Buffer pool index logical reads = 0
Buffer pool index physical reads = 0
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
The query in question goes against three tables, two M:N parents
resolved by an intersection table. Two of the tables (one parent and
the intersection) have 14,000-plus rows, and the third has 1,200-plus,
for a total of a bit more than 31,000 rows total. There are no
predicates in this query other than ON clauses for the joins. In other
words, DB2 does FTS's of all three tables, which is what I'd expect.
Also, the query runs several times per day.
Looking at the total number of "rows read" reported above (415,532)
and dividing it by the "number of executions" reported above (13),
yielding 32,000-plus, I'm led to believe that yes indeed, the query is
doing three FTS's *every time it runs*. Yet, I also see that it's
doing 13,741 logical reads, and 13,741 just happens to be the number
of rows returned by the query.
So, every time the query runs is DB2 re-doing the three FTS's, or, as
expected, is it doing a single logical read of the cached result set?
Thanks,
--Jeff
Ian - 30 May 2007 19:50 GMT
> The query in question goes against three tables, two M:N parents
> resolved by an intersection table. Two of the tables (one parent and
[quoted text clipped - 3 lines]
> words, DB2 does FTS's of all three tables, which is what I'd expect.
> Also, the query runs several times per day.
> Looking at the total number of "rows read" reported above (415,532)
> and dividing it by the "number of executions" reported above (13),
> yielding 32,000-plus, I'm led to believe that yes indeed, the query is
> doing three FTS's *every time it runs*. Yet, I also see that it's
> doing 13,741 logical reads, and 13,741 just happens to be the number
> of rows returned by the query.
A logical or physical read represents DB2 accessing a page in the
bufferpool (logical) or on disk (physical), not a single row.
So, when doing a full table scan, as long as your tables have more
than 1 row per page, you're getting some aggregation in a full
table scan.
> So, every time the query runs is DB2 re-doing the three FTS's, or, as
> expected, is it doing a single logical read of the cached result set?
A table scan is a table scan, regardless of whether the data exists
in the bufferpool or on disk. The only difference is that DB2 will scan
the table in the bufferpool a LOT faster. That's the whole point of
prefetchers. ;-)
FYI, the explain plan would give a much better idea of what is really
going on, since it sounds like you're just making an assumption that
DB2 is doing full table scans. Keep in mind that sorting rows (for
a merge-scan join or grouping/ordering in the result set) also will
increment rows read.