Per a recent bug in which the planner can behave very differently at <
100, and accounting for the fact that analyze is still plenty fast on
today's systems even at a tenfold increase, attached is a patch to
change default_statistics_target from 10 to 100.

Index: doc/src/sgml/config.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/config.sgml,v
retrieving revision 1.152
diff -c -r1.152 config.sgml
*** doc/src/sgml/config.sgml	1 Nov 2007 17:06:30 -0000	1.152
--- doc/src/sgml/config.sgml	14 Nov 2007 04:32:15 -0000
***************
*** 2150,2156 ****
          not had a column-specific target set via <command>ALTER TABLE
          SET STATISTICS</>.  Larger values increase the time needed to
          do <command>ANALYZE</>, but might improve the quality of the
!         planner's estimates. The default is 10. For more information
          on the use of statistics by the <productname>PostgreSQL</>
          query planner, refer to <xref linkend="planner-stats">.
         </para>
--- 2150,2156 ----
          not had a column-specific target set via <command>ALTER TABLE
          SET STATISTICS</>.  Larger values increase the time needed to
          do <command>ANALYZE</>, but might improve the quality of the
!         planner's estimates. The default is 100. For more information
          on the use of statistics by the <productname>PostgreSQL</>
          query planner, refer to <xref linkend="planner-stats">.
         </para>
Index: src/backend/commands/analyze.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/analyze.c,v
retrieving revision 1.110
diff -c -r1.110 analyze.c
*** src/backend/commands/analyze.c	24 Oct 2007 20:55:36 -0000	1.110
--- src/backend/commands/analyze.c	14 Nov 2007 04:32:16 -0000
***************
*** 62,68 ****
  
  
  /* Default statistics target (GUC parameter) */
! int			default_statistics_target = 10;
  
  /* A few variables that don't seem worth passing around as parameters */
  static int	elevel = -1;
--- 62,68 ----
  
  
  /* Default statistics target (GUC parameter) */
! int			default_statistics_target = 100;
  
  /* A few variables that don't seem worth passing around as parameters */
  static int	elevel = -1;
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.425
diff -c -r1.425 guc.c
*** src/backend/utils/misc/guc.c	11 Nov 2007 19:22:49 -0000	1.425
--- src/backend/utils/misc/guc.c	14 Nov 2007 04:32:17 -0000
***************
*** 1117,1123 ****
  				"column-specific target set via ALTER TABLE SET STATISTICS.")
  		},
  		&default_statistics_target,
! 		10, 1, 1000, NULL, NULL
  	},
  	{
  		{"from_collapse_limit", PGC_USERSET, QUERY_TUNING_OTHER,
--- 1117,1123 ----
  				"column-specific target set via ALTER TABLE SET STATISTICS.")
  		},
  		&default_statistics_target,
! 		100, 1, 1000, NULL, NULL
  	},
  	{
  		{"from_collapse_limit", PGC_USERSET, QUERY_TUNING_OTHER,
Index: src/backend/utils/misc/postgresql.conf.sample
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/misc/postgresql.conf.sample,v
retrieving revision 1.232
diff -c -r1.232 postgresql.conf.sample
*** src/backend/utils/misc/postgresql.conf.sample	9 Nov 2007 17:31:07 -0000	1.232
--- src/backend/utils/misc/postgresql.conf.sample	14 Nov 2007 04:32:17 -0000
***************
*** 218,224 ****
  
  # - Other Planner Options -
  
! #default_statistics_target = 10		# range 1-1000
  #constraint_exclusion = off
  #from_collapse_limit = 8
  #join_collapse_limit = 8		# 1 disables collapsing of explicit 
--- 218,224 ----
  
  # - Other Planner Options -
  
! #default_statistics_target = 100	# range 1-1000
  #constraint_exclusion = off
  #from_collapse_limit = 8
  #join_collapse_limit = 8		# 1 disables collapsing of explicit 
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to