Home » RDBMS Server » Performance Tuning » long scans and short scans
long scans and short scans [message #152296] Thu, 22 December 2005 05:59 Go to next message
alanm
Messages: 284
Registered: March 2005
Senior Member

Hi All,
I have run a perfstat on my system and in an hour slot it reported many 1,000s of long and short table scans. Does anyone have a script which will let me know which tables are being hit.


regards


Alan.
Re: long scans and short scans [message #154038 is a reply to message #152296] Thu, 05 January 2006 08:02 Go to previous messageGo to next message
Frank Naude
Messages: 4581
Registered: April 1998
Senior Member
Hi,

You should be able to see it from V_$SEGMENT_STATISTICS.

A long table scan is a scan on a table whose total data blocks are greater than 2% of the number of blocks defined by DB_CACHE_SIZE (the algorithm is more complex, but this will do for now).

Long table scans are mostly bad for OLTP-type systems.

Best regards.

Frank
Re: long scans and short scans [message #154040 is a reply to message #154038] Thu, 05 January 2006 08:09 Go to previous messageGo to next message
alanm
Messages: 284
Registered: March 2005
Senior Member

Hi Frank,
thanks for the response. I am using oracle 8i and the parameter you gave isn't in this version nor is v_$segment_statistics.

best regards

Alan.
Re: long scans and short scans [message #154056 is a reply to message #154040] Thu, 05 January 2006 09:26 Go to previous messageGo to next message
Frank Naude
Messages: 4581
Registered: April 1998
Senior Member
Hi Alan,

The only other method I can think of right now is to enable SQL Tracing and look for "full table scans" in the tkprof/ expain plan output. You can then classify them as either long or short scans.

This might also help - http://www.orafaq.com/node/39

Best regards.

Frank
Re: long scans and short scans [message #154118 is a reply to message #152296] Thu, 05 January 2006 15:07 Go to previous messageGo to next message
SQLAREA
Messages: 21
Registered: January 2006
Location: Belgium
Junior Member
Dear,

Since you are still on 8.1x you haven' t yet the v$segment_statistics view (a shame) neither the init parameter db_cache_size.

May I assume you watched the top 5 wait events of the statspack report and may I assume the IO waits like db file sequential read, db file scattered read, maybe direct path read appear in your top 5 ? If no why you bother about tablescans long or short, it' s normal you have table block reads , isn' t it ?
May I also assume you compared the IO waits by the statistic "CPU used by this session" ( which you find back further in the statspack report, otherwise v$sesstat ) From 9i onwards the cpu waits appeared in the wait list of your statspack reports, but not yet in 8.1.x. It is very important to track down whether your system is IO bound whether it is CPU bound. If your system is CPU bound you may not be served at all by increasing your db_block_buffers.

What should I do right now if I face IO waits (even after comparison with cpu waits) and if I still face a 8.1.x release.

Well in your statspack report there is the top sql ordered by buffer gets, there is the top sql ordered by executions, which is the IO expensive sql (either logical either physical).
Take a look at this sql, who has executed what when, how many times. Can you better the execution plans by sql trace ? , or by better, improved stats ? ( which you collect by dbms_stats )
Let me think, 8.1.7 ... I used to alter the default values for optimizer_index_cost_adj and optimizer_index_caching in order to become improved execution plans.

Also take a look a v$sql, you even can map v$sql with v$session (join columns are sql_address and hash_value) all that in order to track down who is execution what when, how many buffers visited.

Regards
Guy Lambregts
Re: long scans and short scans [message #154189 is a reply to message #152296] Fri, 06 January 2006 03:11 Go to previous messageGo to next message
alanm
Messages: 284
Registered: March 2005
Senior Member

Hi,
From the statspack reports the system is massively skewed to db scattered and sequential reads. The instance is running RULE based. There appear to be maybe a dozen or so sql scripts which are consumming all I/O.

regards


Alan.
Re: long scans and short scans [message #154190 is a reply to message #154189] Fri, 06 January 2006 03:15 Go to previous messageGo to next message
SQLAREA
Messages: 21
Registered: January 2006
Location: Belgium
Junior Member
Hi

Why still RBO ?
What is your release, 8.1.7.4 ?
You should tune your IO sql which you found back.

Regards
Guy
Re: long scans and short scans [message #154196 is a reply to message #154190] Fri, 06 January 2006 03:46 Go to previous messageGo to next message
alanm
Messages: 284
Registered: March 2005
Senior Member

Hi,

Why still RBO?

legacy, Oracle apps 11.0.3 is used and I believe this runs on RBO.

yes DB is 8.1.7.4

tuning - this has never been carried out on the system. The DB has been allowed to grow without any thought to performance. The previous DBA gave no thought to this side of being a DBA.

regards


Alan.
Re: long scans and short scans [message #154428 is a reply to message #154196] Sun, 08 January 2006 06:15 Go to previous messageGo to next message
SQLAREA
Messages: 21
Registered: January 2006
Location: Belgium
Junior Member
Hi

8.1.7.4 and still RBO ?
I should try to move from RBO to CBO in order to have parsed te best execution plan. Let me give you an excellent white paper written by Mr Tim Gorman
http://www.evdbt.com/SearchIntelligenceCBO.doc

If your system is IO bound, please read my previous post, you should look to the sql ordered by buffer gets and sql ordered by executions and you should try to have parsed a better executions plan for those statements either you should try to rewrite the sql going on in your db. (which is in a lot of cases not possible with thirth party software)

What is your SGA ? shared pool, db_block_buffers, db_block_size
What is your buffer hit ratio, (statspack reports)

If you cannot tune/improve the sql going on in the db
and
If you can not move from RBO to CBO
there is the option left to increase the db_block_buffers parameter , it will only give you the results you are looking for if the hit ratio was very low. (Increasing and increasing the buffer cache is rather low level dba)

Regards
Guy
Re: long scans and short scans [message #154780 is a reply to message #152296] Tue, 10 January 2006 09:20 Go to previous messageGo to next message
alanm
Messages: 284
Registered: March 2005
Senior Member

Hi
follows is some information regarding my instance

SGA

Total System Global Area 2055425940 bytes
Fixed Size 73620 bytes
Variable Size 446435328 bytes
Database Buffers 1556480000 bytes
Redo Buffers 52436992 bytes

we work on an 8k block size with 190000 buffers

hit ratio is 90.59

redo log space requests 435,606

HARD TOTAL SOFT
parse count (hard) 4736275 509959640 505223365

regards

Alan.
Re: long scans and short scans [message #154800 is a reply to message #154780] Tue, 10 January 2006 12:47 Go to previous message
SQLAREA
Messages: 21
Registered: January 2006
Location: Belgium
Junior Member
Hi

Seems your SGA is properly configured.

Options left for you are
1. moving from RBO to CBO
2. tuning top sql statements (ordered by buffer gets/ executions/disk reads)

Today I suddenly had to face a tuning issue priority 1
the query below was taking to much time

select * from (select * from t1 order by col1 desc,col2 desc) where rownum < 21

The execution plan showed me a full table scan of t1

I suggested our custumer to create a composite index in this way

create index t1_idx1 on t1 (col1 desc,col2 desc);

On a big table in a test instance the number of consistent gets/physical reads decreased with factor 15.000 !

You should try to do the same for your top sql (can be time consuming)

I suppose you are familiar with sql trace, tkprof and autotrace.
Please let me know if the latter is not the case

Regards
Guy Lambregts

[Updated on: Tue, 10 January 2006 12:49]

Report message to a moderator

Previous Topic: ORACLE TUNING PROBLEM ON LAPTOP
Next Topic: Getting a list of commonly used views for finding tuning statistics
Goto Forum:
  


Current Time: Wed Nov 27 07:52:03 CST 2024