473,804 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3119
do*****@amcad.c om (Dan) wrote in message news:<bd******* *************** ****@posting.go ogle.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.go ogle.com>...
do*****@amcad.c om (Dan) wrote in message news:<bd******* *************** ****@posting.go ogle.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
10583
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 23402
3
3597
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 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...
5
1889
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? Increasing index mem size? Query 2 hash 9105 entries matching the given conditions Query 2 hash 9248 entries matching the given conditions
3
3642
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 can bind a specific port number but I'd rather let the system pick up an available one from the specific range. Can someone tell me how to do that? Thanks in advance,
0
1126
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 ** 0.5)+1): if n % i == 0: divisors.add(i) divisors.add(n/i)
5
4595
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 suppliers for the same part at different cost Part No - KN-12345 Product ID....SUPPLIER......Qty......Cost price A0123.........AAA CO.......1000..... 0.90 A0123.........AAA CO...... 5000..... 0.70 A0123.........AAA CO.......9000..... 0.55
7
3228
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 production database. We had to do a full restore over this database for a problem with a tablespace. The problem cames after 5 days after full restore. The problem is the following, we are having erratic, fluctuating size on our backups, and this is...
0
378
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 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...
4
3887
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 variables declared in SP. select * from table where pred1 and pred2 and pred3 and variable1 ='number1 and variable2 =number2;
0
9594
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10600
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10350
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10351
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10096
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9174
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5534
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3834
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.