| 
		
			| gather stats how? [message #355345] | Thu, 23 October 2008 15:35  |  
			| 
				
				
					| ArvindBhope Messages: 55
 Registered: June 2008
 | Member |  |  |  
	| Hi there!! 
 I would like to gather stats on a table. Iam aware that I have to consider the following
 Number of rows
 Number of blocks
 Average row length
 
 BUt how do you come to conclusion what is the percentage  and are there any specific rule or formulas for coming to conclusion on this item ?
 
 thanks!
 Arvind
 |  
	|  |  | 
	|  | 
	|  | 
	|  | 
	| 
		
			| Re: gather stats how? [message #355504 is a reply to message #355349] | Fri, 24 October 2008 09:19   |  
			| 
				
				
					| JRowbottom Messages: 5933
 Registered: June 2006
 Location: Sunny North Yorkshire, ho...
 | Senior Member |  |  |  
	| DBMS_STATS calculates/estimates the number of rows, number of blocks and avg row length - you don't pass them in to it. |  
	|  |  | 
	| 
		
			| Re: gather stats how? [message #355831 is a reply to message #355345] | Mon, 27 October 2008 16:28   |  
			| 
				
				|  | Kevin Meade Messages: 2103
 Registered: December 1999
 Location: Connecticut USA
 | Senior Member |  |  |  
	| Consider the following: 
 
 DBMS_STATS.GATHER_TABLE_STATS (
   ownname          VARCHAR2, 
   tabname          VARCHAR2, 
   partname         VARCHAR2 DEFAULT NULL,
   estimate_percent NUMBER   DEFAULT NULL, 
   block_sample     BOOLEAN  DEFAULT FALSE,
   method_opt       VARCHAR2 DEFAULT 'FOR ALL COLUMNS SIZE 1',
   degree           NUMBER   DEFAULT NULL,
   granularity      VARCHAR2 DEFAULT 'DEFAULT', 
   cascade          BOOLEAN  DEFAULT FALSE,
   stattab          VARCHAR2 DEFAULT NULL, 
   statid           VARCHAR2 DEFAULT NULL,
   statown          VARCHAR2 DEFAULT NULL,
   no_invalidate    BOOLEAN  DEFAULT FALSE);
 
 .| Quote: |  | estimate_percent 
 This parameter is similar to the old “estimate statistics sample x percent” parameter of the ANALYZE command. The value for estimate_percent is the percentage of rows to estimate, with NULL meaning compute. You can use the constant DBMS_STATS.AUTO_SAMPLE_SIZE to have Oracle determine the best sample size for good statistics
 
 | 
 
 
 exec dbms_stats.gather_table_stats(user,'a',cascade=>true)
exec dbms_stats.gather_table_stats(user,'a',estimate_percent=>DBMS_STATS.AUTO_SAMPLE_SIZE,cascade=>true)
 Good luck, Kevin
 |  
	|  |  | 
	|  | 
	|  | 
	|  | 
	|  | 
	| 
		
			| Re: gather stats how? [message #356108 is a reply to message #355345] | Wed, 29 October 2008 10:14   |  
			| 
				
				
					| efachim Messages: 42
 Registered: July 2008
 | Member |  |  |  
	| Hi, 
 I vaguely remember Oracle recommending certain percentages to use for the estimate, depending on how large the table was. Is that what you are looking for, or what those figures were arrived at?
 
 rgds, E
 |  
	|  |  | 
	| 
		
			| Re: gather stats how? [message #356109 is a reply to message #355345] | Wed, 29 October 2008 10:20   |  
			| 
				
				
					| ArvindBhope Messages: 55
 Registered: June 2008
 | Member |  |  |  
	| hi efachim, 
 yeah ,iam looking at that info only.And along with that how those figures were arrived at ? ...like for a X table of xyz parameters abc should be the estimate percent.
 
 let me know if you are looking at any other info.
 
 thanks,
 Arvind
 |  
	|  |  | 
	| 
		
			| Re: gather stats how? [message #357237 is a reply to message #356102] | Tue, 04 November 2008 06:51   |  
			| 
				
				
					| JRowbottom Messages: 5933
 Registered: June 2006
 Location: Sunny North Yorkshire, ho...
 | Senior Member |  |  |  
	| Let me rephrase what Kevin said. 
 What evidence do you have that the Auto setting for estimate_percentage is gathering an inaccurate set of statistics.
 
 Additionally, what level of performance gain do you expect to see by setting the value manually?
 
 You can empirically check the percentage of rows analyzed by looking at the Sample_Size column in DBA_TABLES and DBA_INDEXES, but to the best of my knowledge, Oracel have not made the algorithm they use public.
 
 
 |  
	|  |  | 
	|  |