Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> full-scan vs index for "small" tables
On a slightly modified topic, for a long time I've had a problem with this section 13.5.1.2.3 of the Oracle documentation. It's one of those sections that was written 25 years ago and apparently never subjected to scientific scrutiny.
The part about "...which can be read in a single I/O call..." is one of those myths that makes sense when you hear it, but it's just not true. An index scan of a 1-row, 1-block table is more efficient than a full table scan of that table. Try it.
Performance of an Oracle database is NOT uniquely determined by how many OS read calls your application causes it to make.
Cary Millsap
Hotsos Enterprises, Ltd.
http://www.hotsos.com
Nullius in verba
Hotsos Symposium 2007 / March 4-8 / Dallas Visit www.hotsos.com for curriculum and schedule details...
-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Ogun.Heper_at_turkcell.com.tr
Sent: Tuesday, June 27, 2006 4:07 AM
To: sjaffarhussain_at_gmail.com; oracle-l_at_freelists.org
Subject: RE: db file scattered reads
Hi,
First of all, the p3 parameter doesn't have to be equal to DB_FILE_MULTIBLOCK_READ_COUNT. The only explanation about this value in the documentation is;
P3 - The number of blocks (should be greater than 1)
Furthermore, documentation states that;
13.5.1.2.3 Small Table
If a table contains less than DB_FILE_MULTIBLOCK_READ_COUNT blocks under the high water mark, which can be read in a single I/O call, then a full table scan might be cheaper than an index range scan, regardless of the fraction of tables being accessed or indexes present.
So this can be your situation, if these are small lookup tables, then Oracle can decide to do a full table scan and wait on the db file scattered read event consequently, with a p3 value less than DB_FILE_MULTIBLOCK_READ_COUNT. For example in my test case this occurs for a small table which has got only two blocks.
PARSING IN CURSOR #2 len=25 dep=0 uid=46 oct=3 lid=46 tim=32288060382808 hv=468215388 ad='3382740c'
select count(*) from t
END OF STMT
PARSE #2:c=0,e=132,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=32288060382801
BINDS #2:
EXEC #2:c=0,e=78,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=32288060383009 WAIT #2: nam='SQL*Net message to client' ela= 2 p1=1413697536 p2=1 p3=0 WAIT #2: nam='SQL*Net message from client' ela= 1479 p1=1413697536 p2=1 p3=0 WAIT #2: nam='db file sequential read' ela= 34 p1=25 p2=16009 p3=1 WAIT #2: nam='db file scattered read' ela= 60 p1=25 p2=16010 p3=2 WAIT #2: nam='SQL*Net message to client' ela= 2 p1=1413697536 p2=1 p3=0FETCH #2:c=0,e=511,p=3,cr=4,cu=0,mis=0,r=1,dep=0,og=4,tim=32288060385189 WAIT #2: nam='SQL*Net message from client' ela= 13590 p1=1413697536 p2=1 p3=0
Actually, you need to investigate this further in order to fully understand the issue.
Best regards.
Ogün Heper
-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Syed Jaffar Hussain
Sent: Monday, June 26, 2006 6:21 PM
To: _oracle_L_list
Subject: db file scattered reads
Hi,
On one of our very busy OLTP Oracle 9i Rel. (9205) database on AIX 5.3
OS, 'db file scattered reads' wait event, most of the time, it shows
2, 1, 3 as p3 value.
What surprised me is that the value for db_file_multiblock_read_coutn
is set to 8, but, db file scattered reads never oftenly shows 8 as p3
values while looking in v$session_wait view.
There is another doubt about, 'buffer busy waits, reason code 130.
On dizwell site,from the below link, the author explains about buffer
busy waits explanation for reason code 130. When I look into metalink
note for buffer busy waits reference note, the explanation is totally
confused me and look totally different.
In metalink note, it says that the reason code 130 is like 'Block is
being read by another session and no other suitable block image was
found.. Whereas on dizwell has little bit, differenet explanation.
Can anyone explain about this?
http://dizwell.com/main/index.php?option=com_jd-wiki&Itemid=112&id=bufferbusywaits
--
Best Regards,
Syed Jaffar Hussain
8i,9i & 10g OCP DBA
Banque Saudi Fransi,
Saudi Arabia
I blog at :http://jaffardba.blogspot.com/ http://www.oracle.com/technology/community/oracle_ace/ace1.html#hussain
--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Jun 27 2006 - 08:03:33 CDT