Query Environment
DB: taxext (sp2-taoextdb) Table: TAO.DIM_TAO_ADVERTISER, list partitioned by column IS_CURRENT. Totally two partitions. Table stats (as of 2012/03/25, old, but very close): rows: 2,118,910, blocks: 311,297. More than 90% of data is from partition P1 (IS_CURRENT=1) Parameters: db_block_size=8192,
db_file_multiblock_count=32
The Query
select buyer_line_crt_id, to_char(surrogate_key) surrogate_key, null as dummy from TAO.DIM_TAO_ADVERTISER where is_current= 1
The Plan
----------------------------------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | ----------------------------------------------------------------------------------------------------------| 0 | SELECT STATEMENT | | | | 58381 (100)| | | | | 1 | PARTITION LIST SINGLE| | 2062K| 45M| 58381 (1)| 00:11:41 | KEY | KEY | | 2 | TABLE ACCESS FULL | DIM_TAO_ADVERTISER | 2062K| 45M| 58381 (1)| 00:11:41 | 1 | 1 |
-----------------------------------------------------------------------------------------------------------
Questions
Why the elapse times and disk_reads are so different when the query plan stays the same, when compared to one run on 08/14? Why did the query read more than 10 times of data as the table has? Note the query has only a single table scan.
Why are there so many db file sequential read? Shouldnt FTS uses direct path reads or db file scattered read?
4,643,835
Records
3,605,637 281,237
Blocks blocks
Control Section
Record Directory
Row Directory
Free Spaces
Free Spaces
Rrecord Heap
Row Heap
Xid
Uba Flag Lck
The transaction id of a recent transaction that has modified this block. (undo segment).(undo slot).(undo seq number)
Undo record address. (Absolute block address).(block sequence number).(record within block) Transaction state. Number of rows locked by this transaction in this block.
Scn/Fsc
Committed SCN or the number of bytes of free space that would be available if this transaction committed.
Here is the snap by snap summary from AWR dba_hist_sqlstat for one execution. Except for one snap (08/14 00:00:00), to read one row from the table, the number of UNDO blocks to read from disk grows almost linear with one additional block every hour.
Work Around
Since the concerned query can complete within 4 minutes, here is the work around Aggressive one: lock the table with wait before run the query, and release it after done Conservative one: lock the table with wait, and release it and run the query immediately. The table refresh query will take a while for join operation, the first row update will be far after 4 minutes.