473,395 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Fluctuating Cost with Range Scan

Dan
I am a relatively new user on Oracle 9.2.0.1 and I am having trouble
performance tuning this production database.

I am running a large query that joins two tables, document(3 mil) and
entity(9 mil). I have reorganized my tablespaces so that the two
tables are on different tablespaces, different disks. They both have
their indexes stored on a third tablespace. Before reconfiguring the
production database, I was getting a range scan on index ix_document_8
that had a cost of 25. Now that I have reconfigured the prod
database, the cost of the range scan has gone through the roof, 5933.

I have tried moving this one particular index to different tablespaces
on all three disks available to me to no avail. I run "analyze index
compute statistics;" on the index after every time I recreate it. It
appears that no matter where I create this index it still has trouble
accessing it. I have computed the statistics for the table before
computing the index statistics. It appears to me that there is an I/O
problem here. Why did it cost so little before and now it costs so
much to access it?

Should the index be on the same disk/different tablespace?
Different disk/different tablespace?

I have run out of my testing capabilities here to try and troubleshoot
why the cost is so high. Could this be a problem with my CBO?

Any help is greatly appreciated,
-Dan
Jul 19 '05 #1
2 3068
do*****@amcad.com (Dan) wrote in message news:<bd**************************@posting.google. com>...
I am a relatively new user on Oracle 9.2.0.1 and I am having trouble
performance tuning this production database.

I am running a large query that joins two tables, document(3 mil) and
entity(9 mil). I have reorganized my tablespaces so that the two
tables are on different tablespaces, different disks. They both have
their indexes stored on a third tablespace. Before reconfiguring the
production database, I was getting a range scan on index ix_document_8
that had a cost of 25. Now that I have reconfigured the prod
database, the cost of the range scan has gone through the roof, 5933.

I have tried moving this one particular index to different tablespaces
on all three disks available to me to no avail. I run "analyze index
compute statistics;" on the index after every time I recreate it. It
appears that no matter where I create this index it still has trouble
accessing it. I have computed the statistics for the table before
computing the index statistics. It appears to me that there is an I/O
problem here. Why did it cost so little before and now it costs so
much to access it?

Should the index be on the same disk/different tablespace?
Different disk/different tablespace?

I have run out of my testing capabilities here to try and troubleshoot
why the cost is so high. Could this be a problem with my CBO?

Any help is greatly appreciated,
-Dan


Cost won't necessarily be influenced by relocating tablespaces.
The foremost factor in cost is
- selectivity
- selectivity
- selectivity

and adequate optimizer_cost_adj and optimizer_index_cache parameters
set.
You probably don't have a histogram on the affected column.
Analyze table compute statistics for all indexed columns is probably
in order.
Did you try to use hints in your statement (forcing the index)? If so,
what was the result?

Please also note : cost is a meaningless number. The only things that
counts is the number of consistent gets.

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #2
Dan
Thanks for the response Mark.

I looked into the problem a little farther and found that the
difference comes down to two parts of the WHERE clause. When these
two values are NOT sent as bind variables, the cost goes way down. I
realize that cost is an arbitrary number. I looked at the number of
consistent gets and there was a large difference (factor of 10x) when
I was sending these two conditions as bind variables. My problem is,
since the database has to run with CURSOR_SHARING=SIMILIAR (I'll be
arm wrestling our developers over their lack of bind variable usage) I
don't see a way to get around this issue.

I have a couple of books that explicitly say that if you are not using
bind variables from the application side, the CBO can't be guarenteed
to produce predictable/consistent executions. Am I up the creek here
because of this? I am forcing index usage using hints, as well as
ORDERED to make sure the join is done in the proper order. Is there
any way that you know of that I could selectively turn the
CURSOR_SHARING off for part of the query? Some sort of escape
characters of some sort that tell Oracle that I don't want it to bind
these particular variables, but bind the rest of the query?

I know that this is all patchwork, but I have an angry customer and
there is no way the entire application can be changed for the
deadline. Any ideas?

Thanks for the help,
-Dan

sy******@yahoo.com wrote in message news:<a1**************************@posting.google. com>...
do*****@amcad.com (Dan) wrote in message news:<bd**************************@posting.google. com>...
I am a relatively new user on Oracle 9.2.0.1 and I am having trouble
performance tuning this production database.

I am running a large query that joins two tables, document(3 mil) and
entity(9 mil). I have reorganized my tablespaces so that the two
tables are on different tablespaces, different disks. They both have
their indexes stored on a third tablespace. Before reconfiguring the
production database, I was getting a range scan on index ix_document_8
that had a cost of 25. Now that I have reconfigured the prod
database, the cost of the range scan has gone through the roof, 5933.

I have tried moving this one particular index to different tablespaces
on all three disks available to me to no avail. I run "analyze index
compute statistics;" on the index after every time I recreate it. It
appears that no matter where I create this index it still has trouble
accessing it. I have computed the statistics for the table before
computing the index statistics. It appears to me that there is an I/O
problem here. Why did it cost so little before and now it costs so
much to access it?

Should the index be on the same disk/different tablespace?
Different disk/different tablespace?

I have run out of my testing capabilities here to try and troubleshoot
why the cost is so high. Could this be a problem with my CBO?

Any help is greatly appreciated,
-Dan


Cost won't necessarily be influenced by relocating tablespaces.
The foremost factor in cost is
- selectivity
- selectivity
- selectivity

and adequate optimizer_cost_adj and optimizer_index_cache parameters
set.
You probably don't have a histogram on the affected column.
Analyze table compute statistics for all indexed columns is probably
in order.
Did you try to use hints in your statement (forcing the index)? If so,
what was the result?

Please also note : cost is a meaningless number. The only things that
counts is the number of consistent gets.

Sybrand Bakker
Senior Oracle DBA

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dbarchitech | last post by:
hi, i'm building a query to find narrow ranges of zip codes within broader ranges in a table (for tax purposes). for example: LOW_ZIP HI_ZIP 23400 23499 need to find 23401 ...
3
by: Dan | last post by:
I am a relatively new user on Oracle 9.2.0.1 and I am having trouble performance tuning this production database. I am running a large query that joins two tables, document(3 mil) and entity(9...
5
by: Pedro Alves | last post by:
Hi. I'm having some trouble on the use of indexes. The querys below are exactly the same but refer to different months. One case uses indexes, the other doesn't. Is there anything I can do?...
3
by: Franky | last post by:
I need to specify a range of outgoing port numbers (i.e., 20000-21000). Is there any way to bind this range so that when system picks up a free port, it will only pick one from this range? I know I...
0
by: thattommyhallll | last post by:
i am doing the problems at http://www.mathschallenge.net/index.php?section=project one problem involved finding factors, i used def divisors(n): divisors = set() for i in range(1, math.ceil(n...
5
by: jamesnkk | last post by:
I want to calculate the average price, I have a cost price table- tblcostPrice as below,Same part no can be purchase from different supplier at different cost. In my tblcostPrice I have 2...
7
by: yellr | last post by:
Hi, i've spent all resources, except this one. Hopefully anyone there out could help me with a idea for this problem. We have a db2 8.2 Enterprise Edition, on AIX 5.3 Platform, this is our...
0
by: Dan | last post by:
I am a relatively new user on Oracle 9.2.0.1 and I am having trouble performance tuning this production database. I am running a large query that joins two tables, document(3 mil) and entity(9...
4
by: Arun Srinivasan | last post by:
Hi I was using a query previously, that was efficient select * from table where pred1 and pred2 and pred3; Later I was asked to introduce new ones, but they were not based on table columns but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.