Re: Oracle's use of Indexes
Craig, Just out of interest, what type of application is running on the database? I was just wondering why you were not using the plan stability features in 8i on your production database. Regards, Craig Munday. At 05:45 AM 2/06/2003 -0800, Craig Healey wrote: OK, I'm confused. Maybe it's Monday morning and my brain's not working. We have a production schema and a test schema on the same Oracle 8.1.7 instance, running on Windows. They both have a customer table, with 3 million and 2 million records respectively. They both have the same indexes, and both have been analyzed today. Production used an index and took 40ms. Test didn't and took 20s. I played around, analyzing, dropping and creating indexes etc. Now neither of them use the index, both taking around 20s. I can add a hint, which works, but I want to know what changed. TIA Craig Healey ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. Statements and opinions expressed in this e-mail may not represent those of the company. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses (www.mimesweeper.com) *** -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Craig Healey INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Craig Munday INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: Oracle's use of Indexes
Does the query hit any other tables? If so, a different statistic somewhere else might be influencing the optimisor. Otherwise certain session / init parameters can influence the optimisor (multiblock read count, block size even) - Sometimes it can be difficult to track down the culprit but you should be able to find differences somewhere. Craig Munday [EMAIL PROTECTED]To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] net.au cc: Sent by: Subject: Re: Oracle's use of Indexes [EMAIL PROTECTED] .com 19/09/2003 00:54 Please respond to ORACLE-L Craig, Just out of interest, what type of application is running on the database? I was just wondering why you were not using the plan stability features in 8i on your production database. Regards, Craig Munday. At 05:45 AM 2/06/2003 -0800, Craig Healey wrote: OK, I'm confused. Maybe it's Monday morning and my brain's not working. We have a production schema and a test schema on the same Oracle 8.1.7 instance, running on Windows. They both have a customer table, with 3 million and 2 million records respectively. They both have the same indexes, and both have been analyzed today. Production used an index and took 40ms. Test didn't and took 20s. I played around, analyzing, dropping and creating indexes etc. Now neither of them use the index, both taking around 20s. I can add a hint, which works, but I want to know what changed. TIA Craig Healey ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. Statements and opinions expressed in this e-mail may not represent those of the company. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses (www.mimesweeper.com) *** -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Craig Healey INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Craig Munday INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from
Re: Oracle's use of Indexes
Oops, I meant an 'instead of' trigger on a view. Jared Jared Still [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 06/07/2003 07:14 AM Please respond to ORACLE-L To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] cc: Subject:Re: Oracle's use of Indexes Yes, I have such a tool also. Unfortunately for me, when I try to use it on my most problem child database, it barfs and dies with and ORA-3113. Seems 'explain plan' chokes and dies on complex plans, such as when evaluating the execution path for an insert that goes through an 'on insert' trigger. This is 8.1.7.4, the bug was supposedly fixed by then. Guess what the fix is now? You guessed it, 'just upgrade your database'. Simon Travaglia must work for Oracle. Jared On Friday 06 June 2003 18:09, Mogens Nørgaard wrote: Yes. I'm not even trying to be more than just moderately funny about this, but yes, you should worry about stats going wroing and yes it happens. But not very often. The way forward is to monitor the execution plans of your important SQL's, I think. Well, it's one of many ways forward. Peter Gram built a free and very simple tool for use against 7.3.4 recently, which will send the DBA and/or Development chief an email when an execution plan changes. It might be for the better, it might be for the worse. But it changed. Then you can investigate why the plan changed, and here there could be many, many reasons. Mogens Mogens Craig Healey wrote: Thanks for all the suggestions. After playing about, it was apparent that the stats were wrong for the table and screwing up the CBO. I had done analyze ... calculate, but they were still wrong. I dropped the stats, estimated at 5% and things are now back to normal. I had thought that analyze ... calculate would clear out the old stats, but it doesn't seem to have done. BTW, should I be worried about the stats going wrong, or does this normally occur every so often? Craig Healey ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. Statements and opinions expressed in this e-mail may not represent those of the company. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses (www.mimesweeper.com) ** * -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jared Still INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: Oracle's use of Indexes
Yes, I have such a tool also. Unfortunately for me, when I try to use it on my most problem child database, it barfs and dies with and ORA-3113. Seems 'explain plan' chokes and dies on complex plans, such as when evaluating the execution path for an insert that goes through an 'on insert' trigger. This is 8.1.7.4, the bug was supposedly fixed by then. Guess what the fix is now? You guessed it, 'just upgrade your database'. Simon Travaglia must work for Oracle. Jared On Friday 06 June 2003 18:09, Mogens Nørgaard wrote: Yes. I'm not even trying to be more than just moderately funny about this, but yes, you should worry about stats going wroing and yes it happens. But not very often. The way forward is to monitor the execution plans of your important SQL's, I think. Well, it's one of many ways forward. Peter Gram built a free and very simple tool for use against 7.3.4 recently, which will send the DBA and/or Development chief an email when an execution plan changes. It might be for the better, it might be for the worse. But it changed. Then you can investigate why the plan changed, and here there could be many, many reasons. Mogens Mogens Craig Healey wrote: Thanks for all the suggestions. After playing about, it was apparent that the stats were wrong for the table and screwing up the CBO. I had done analyze ... calculate, but they were still wrong. I dropped the stats, estimated at 5% and things are now back to normal. I had thought that analyze ... calculate would clear out the old stats, but it doesn't seem to have done. BTW, should I be worried about the stats going wrong, or does this normally occur every so often? Craig Healey ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. Statements and opinions expressed in this e-mail may not represent those of the company. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses (www.mimesweeper.com) ** * -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jared Still INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: Oracle's use of Indexes
Thanks for all the suggestions. After playing about, it was apparent that the stats were wrong for the table and screwing up the CBO. I had done analyze ... calculate, but they were still wrong. I dropped the stats, estimated at 5% and things are now back to normal. I had thought that analyze ... calculate would clear out the old stats, but it doesn't seem to have done. BTW, should I be worried about the stats going wrong, or does this normally occur every so often? Craig Healey ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. Statements and opinions expressed in this e-mail may not represent those of the company. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses (www.mimesweeper.com) *** -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Craig Healey INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: Oracle's use of Indexes
Yes. I'm not even trying to be more than just moderately funny about this, but yes, you should worry about stats going wroing and yes it happens. But not very often. The way forward is to monitor the execution plans of your important SQL's, I think. Well, it's one of many ways forward. Peter Gram built a free and very simple tool for use against 7.3.4 recently, which will send the DBA and/or Development chief an email when an execution plan changes. It might be for the better, it might be for the worse. But it changed. Then you can investigate why the plan changed, and here there could be many, many reasons. Mogens Mogens Craig Healey wrote: Thanks for all the suggestions. After playing about, it was apparent that the stats were wrong for the table and screwing up the CBO. I had done analyze ... calculate, but they were still wrong. I dropped the stats, estimated at 5% and things are now back to normal. I had thought that analyze ... calculate would clear out the old stats, but it doesn't seem to have done. BTW, should I be worried about the stats going wrong, or does this normally occur every so often? Craig Healey ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. Statements and opinions expressed in this e-mail may not represent those of the company. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses (www.mimesweeper.com) *** -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: =?UTF-8?B?TW9nZW5zIE7DuHJnYWFyZA==?= INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: Oracle's use of Indexes
From: DENNIS WILLIAMS I believe that all the statistics that CBO uses to make a decision are in USER_TABLES and USER_INDEXES. You might compare the values for both tables to see if there is a difference that might cause the CBO to make a different decision. I'll look into that, thanks. Are you using different usernames? Any chance one session is doing an ALTER SESSION? Yes, different usernames, but neither are doing an ALTER SESSION. Wolfgang, yes, it's doing a FTS instead of using the index. I'll look at doing a trace on it tomorrow. Daniel: Execution Plan -- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=7060 Card=338 Bytes=52728) 10 SORT (ORDER BY) (Cost=7060 Card=338 Bytes=52728) 21 TABLE ACCESS (FULL) OF 'TBL_CUST_MAST' (Cost=7050 Card=338 Bytes=52728) Execution Plan -- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=12711 Card=338 Bytes=52728) 10 SORT (ORDER BY) (Cost=12711 Card=338 Bytes=52728) 21 TABLE ACCESS (BY INDEX ROWID) OF 'TBL_CUST_MAST' (Cost=12701 Card=338 Bytes=52728) 32 INDEX (RANGE SCAN) OF 'IDX_CUST_MAST_EMAIL1' (NON-UNIQUE) (Cost=887 Card=338) Top plan takes about 20 seconds, the lower one less than 1 second. * DBA_TABLES.NUM_ROWS = 3,161,764 * DBA_TABLES.BLOCKS = 73,294 * DBA_INDEXES.CLUSTERING_FACTOR = 118,131 * DBA_INDEXES.AVG_LEAF_BLOCKS_PER_KEY = 1 * DBA_INDEXES.AVG_DATA_BLOCKS_PER_KEY = 6 * DBA_INDEXES.DISTINCT_KEYS = 18,767 * DBA_INDEXEX.BLEVEL = 2 * DBA_INDEXES.LEAF_BLOCKS = 8850 index is on CLI_CD, CUST_EMAIL1, CUST_STATUS, densities are CLI_CD = 0.1 CUST_EMAIL1 = 0.6 CUST_STATUS = 0.5 db_file_multiblock_read_count = 16 Craig Healey ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. Statements and opinions expressed in this e-mail may not represent those of the company. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses (www.mimesweeper.com) *** -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Craig Healey INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: Oracle's use of Indexes
The cardinalities are the same, but the costs are different. It looks as if production has somehow optimizer_index_cost_adj set to 50 or lower or has db_file_multiblock_read_count set to 8. It's the same instance so that is not possible unless they are changed at a session level. To check that, or any other init.ora differences that may be of importance select the name-value pairs from v$parameter in both schemas and do a diff. Of course the easiest is to diff 10053 event traces and see where they deviate, which will hopefully provide a clue as to why. At 09:44 AM 6/3/2003 -0800, you wrote: From: DENNIS WILLIAMS I believe that all the statistics that CBO uses to make a decision are in USER_TABLES and USER_INDEXES. You might compare the values for both tables to see if there is a difference that might cause the CBO to make a different decision. I'll look into that, thanks. Are you using different usernames? Any chance one session is doing an ALTER SESSION? Yes, different usernames, but neither are doing an ALTER SESSION. Wolfgang, yes, it's doing a FTS instead of using the index. I'll look at doing a trace on it tomorrow. Daniel: Execution Plan -- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=7060 Card=338 Bytes=52728) 10 SORT (ORDER BY) (Cost=7060 Card=338 Bytes=52728) 21 TABLE ACCESS (FULL) OF 'TBL_CUST_MAST' (Cost=7050 Card=338 Bytes=52728) Execution Plan -- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=12711 Card=338 Bytes=52728) 10 SORT (ORDER BY) (Cost=12711 Card=338 Bytes=52728) 21 TABLE ACCESS (BY INDEX ROWID) OF 'TBL_CUST_MAST' (Cost=12701 Card=338 Bytes=52728) 32 INDEX (RANGE SCAN) OF 'IDX_CUST_MAST_EMAIL1' (NON-UNIQUE) (Cost=887 Card=338) Top plan takes about 20 seconds, the lower one less than 1 second. * DBA_TABLES.NUM_ROWS = 3,161,764 * DBA_TABLES.BLOCKS = 73,294 * DBA_INDEXES.CLUSTERING_FACTOR = 118,131 * DBA_INDEXES.AVG_LEAF_BLOCKS_PER_KEY = 1 * DBA_INDEXES.AVG_DATA_BLOCKS_PER_KEY = 6 * DBA_INDEXES.DISTINCT_KEYS = 18,767 * DBA_INDEXEX.BLEVEL = 2 * DBA_INDEXES.LEAF_BLOCKS = 8850 index is on CLI_CD, CUST_EMAIL1, CUST_STATUS, densities are CLI_CD = 0.1 CUST_EMAIL1 = 0.6 CUST_STATUS = 0.5 db_file_multiblock_read_count = 16 Craig Healey Wolfgang Breitling Oracle7, 8, 8i, 9i OCP DBA Centrex Consulting Corporation http://www.centrexcc.com -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Wolfgang Breitling INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: Oracle's use of Indexes
Title: RE: Oracle's use of Indexes Wolfgang, I have a similar problem that I am still trying to work on. Except for * nls_sort ('binary' = performance is better, null it is bad) and * sort_area_size (8388608 = bad performance, 8688000 = good performance) all other parameter are same (from 10053 trace). With good performance, query returns in 3-4 seconds, for bad performance it is more than 1 minute. We must have the output in less than 5 seconds (worst case). I am still playing with it though ... this is all 9202 ... one thing i have noticed is that explain plan is different. Let's see if I find anything ... Raj Rajendra dot Jamadagni at nospamespn dot com All Views expressed in this email are strictly personal. QOTD: Any clod can have facts, having an opinion is an art ! -Original Message- From: Wolfgang Breitling [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 03, 2003 4:55 PM To: Multiple recipients of list ORACLE-L Subject: RE: Oracle's use of Indexes The cardinalities are the same, but the costs are different. It looks as if production has somehow optimizer_index_cost_adj set to 50 or lower or has db_file_multiblock_read_count set to 8. It's the same instance so that is not possible unless they are changed at a session level. To check that, or any other init.ora differences that may be of importance select the name-value pairs from v$parameter in both schemas and do a diff. Of course the easiest is to diff 10053 event traces and see where they deviate, which will hopefully provide a clue as to why. *This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you.*1
RE: Oracle's use of Indexes
Craig - Compare the init.ora file for these instances. Dennis Williams DBA, 80%OCP, 100% DBA Lifetouch, Inc. [EMAIL PROTECTED] -Original Message- Sent: Monday, June 02, 2003 8:45 AM To: Multiple recipients of list ORACLE-L OK, I'm confused. Maybe it's Monday morning and my brain's not working. We have a production schema and a test schema on the same Oracle 8.1.7 instance, running on Windows. They both have a customer table, with 3 million and 2 million records respectively. They both have the same indexes, and both have been analyzed today. Production used an index and took 40ms. Test didn't and took 20s. I played around, analyzing, dropping and creating indexes etc. Now neither of them use the index, both taking around 20s. I can add a hint, which works, but I want to know what changed. TIA Craig Healey ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. Statements and opinions expressed in this e-mail may not represent those of the company. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses (www.mimesweeper.com) *** -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Craig Healey INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: DENNIS WILLIAMS INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: Oracle's use of Indexes
OK, I'm confused. Maybe it's Monday morning and my brain's not working. We have a production schema and a test schema on the same Oracle 8.1.7 instance, running on Windows. They both have a customer table, with 3 million and 2 million records respectively. They both have the same indexes, and both have been analyzed today. Production used an index and took 40ms. Test didn't and took 20s. I played around, analyzing, dropping and creating indexes etc. Now neither of them use the index, both taking around 20s. I can add a hint, which works, but I want to know what changed. TIA Craig Healey Craig, Does 'etc' include doing something to tables as well? I would, from your posting, being tempted to say 'no'. Could it have anything to do with histograms ? The only thing I can currently think of is differences in the way statistics were gathered. Regards, Stephane Faroult Oriole -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Stephane Faroult INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: Oracle's use of Indexes
-Original Message- From: Stephane Faroult [mailto:[EMAIL PROTECTED] Does 'etc' include doing something to tables as well? I would, from your posting, being tempted to say 'no'. Could it have anything to do with histograms ? The only thing I can currently think of is differences in the way statistics were gathered. No, I didn't do anything to the tables. I did drop and recreate the index that was being used, to no effect. I use analyze from within TOAD, and tried estimating and computing statistics, and calculated statistics on the index when I recreated it. I haven't tried deleting statistics. Never used histograms before. Dennis - Same instance, we're using separate schemas for test and production. Craig Healey ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. Statements and opinions expressed in this e-mail may not represent those of the company. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses (www.mimesweeper.com) *** -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Craig Healey INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: Oracle's use of Indexes
Craig I'm sorry, you said they were on the same instance, I just didn't read carefully enough. I believe that all the statistics that CBO uses to make a decision are in USER_TABLES and USER_INDEXES. You might compare the values for both tables to see if there is a difference that might cause the CBO to make a different decision. Are you using different usernames? Any chance one session is doing an ALTER SESSION? Dennis Williams DBA, 80%OCP, 100% DBA Lifetouch, Inc. [EMAIL PROTECTED] -Original Message- Sent: Monday, June 02, 2003 10:30 AM To: Multiple recipients of list ORACLE-L -Original Message- From: Stephane Faroult [mailto:[EMAIL PROTECTED] Does 'etc' include doing something to tables as well? I would, from your posting, being tempted to say 'no'. Could it have anything to do with histograms ? The only thing I can currently think of is differences in the way statistics were gathered. No, I didn't do anything to the tables. I did drop and recreate the index that was being used, to no effect. I use analyze from within TOAD, and tried estimating and computing statistics, and calculated statistics on the index when I recreated it. I haven't tried deleting statistics. Never used histograms before. Dennis - Same instance, we're using separate schemas for test and production. Craig Healey ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. Statements and opinions expressed in this e-mail may not represent those of the company. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses (www.mimesweeper.com) *** -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Craig Healey INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: DENNIS WILLIAMS INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: Oracle's use of Indexes
It will be hard to find what changed since you don't have the information on exactly what production looked like when it was using the index. Whenever you do somthing which may affect the statistics, make a backup of the current statistics with dbms_stats.export_table_stats(..., cascade = true). Then you can always restore the statistics if what you try doesn't work out. You can even import the saved statistics into you test schema and see if you then get the same execution plan there as well. If yes, then it's the statistics, if no then it's some other parameter(s) that cause the difference. When you are saying test - and now production - is not using the index, what is it using instead? an FTS or a different index. If per chance two indexes were tied in the cost, the order in which they were created may be used as a tiebreaker. I am not 100% certain, but I have the impression that the one with the lower object_id is then used, i.e. the one created first. By dropping and re-creating indexes you change the object_id and thus may change the index choice in a tie. Ultimately, an 10053 event trace is the best way to pinpoint the cause for the different plans. At 05:45 AM 6/2/2003 -0800, you wrote: OK, I'm confused. Maybe it's Monday morning and my brain's not working. We have a production schema and a test schema on the same Oracle 8.1.7 instance, running on Windows. They both have a customer table, with 3 million and 2 million records respectively. They both have the same indexes, and both have been analyzed today. Production used an index and took 40ms. Test didn't and took 20s. I played around, analyzing, dropping and creating indexes etc. Now neither of them use the index, both taking around 20s. I can add a hint, which works, but I want to know what changed. Wolfgang Breitling Oracle7, 8, 8i, 9i OCP DBA Centrex Consulting Corporation http://www.centrexcc.com -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Wolfgang Breitling INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: Oracle's use of Indexes
Craig, Could you please send the explain plans for each statement, the value of db_file_multiblock_read_count and the following columns related to tables, columns and indexes (user_tables.blocks, user_tables.num_rows, user_indexes.blevel, user_indexes.leaf_blocks, user_indexes.distinct_keys, user_indexes.clustering_factor, user_tab_columns.density for each column in the index). -- Daniel W. Fink http://www.optimaldba.com Craig Healey wrote: OK, I'm confused. Maybe it's Monday morning and my brain's not working. We have a production schema and a test schema on the same Oracle 8.1.7 instance, running on Windows. They both have a customer table, with 3 million and 2 million records respectively. They both have the same indexes, and both have been analyzed today. Production used an index and took 40ms. Test didn't and took 20s. I played around, analyzing, dropping and creating indexes etc. Now neither of them use the index, both taking around 20s. I can add a hint, which works, but I want to know what changed. TIA Craig Healey -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Daniel W. Fink INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).