pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedAnother POC initdb patch
3+ messages / 2 participants
[nested] [flat]
* Another POC initdb patch
@ 2003-07-06 14:10 Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
0 siblings, 1 reply; 3+ messages in thread
From: Shridhar Daithankar @ 2003-07-06 14:10 UTC (permalink / raw)
To: pgsql-patches@postgresql.org; pgsql-performance
Hi all,
In addition to Tom's patch, this patch asks tuning parameters right away,
while doing initdb. I have also changed the notice displayed after initdb is
done.
Just an attempt to make defaults user friendly. I would also like to add other
paramters to this approach, like fsync and random_page_cost but first I
thought others should have look at these.
And one more thing, can we get all the parameters in postgresql.conf to follow
similar units? Some settings aer in 8KB pages, some in bytes etc. Can we haev
all of them to follow say MB or KB?
I tried but guc.h and guc.c were bit too much to be gulped at one go. I will
try again.
Shridhar
Attachments: download all (2 files, .tar.gz)
postgresql.conf.sample.patch (text/x-diff, 1.1K) download
*** postgresql.conf.sample.orig Sun Jul 6 15:51:02 2003
--- postgresql.conf.sample Sun Jul 6 17:17:23 2003
***************
*** 57,63 ****
# ---------------------------------
# Memory
! #shared_buffers = 64 # min 16, at least max_connections*2, 8KB each
#sort_mem = 1024 # min 64, size in KB
#vacuum_mem = 8192 # min 1024, size in KB
--- 57,64 ----
# ---------------------------------
# Memory
! # min 16, at least max_connections*2, 8KB each
! #shared_buffers
#sort_mem = 1024 # min 64, size in KB
#vacuum_mem = 8192 # min 1024, size in KB
***************
*** 105,111 ****
# Planner Cost Constants
! #effective_cache_size = 1000 # typically 8KB each
#random_page_cost = 4 # units are one sequential page fetch cost
#cpu_tuple_cost = 0.01 # (same)
#cpu_index_tuple_cost = 0.001 # (same)
--- 106,113 ----
# Planner Cost Constants
! # typically 8KB each
! #effective_cache_size
#random_page_cost = 4 # units are one sequential page fetch cost
#cpu_tuple_cost = 0.01 # (same)
#cpu_index_tuple_cost = 0.001 # (same)
initdb.patch (text/x-diff, 4.4K) download
*** initdb.orig Sun Jul 6 15:51:22 2003
--- initdb Sun Jul 6 19:34:24 2003
***************
*** 71,76 ****
--- 71,133 ----
echo "$ret"
}
+ #Set the values to default
+ new_shared_buffers=" 64"
+ new_effective_cache=" 1000"
+
+ #Get some good enough values for configuration
+ pg_getDefault_Config(){
+ echo
+ echo
+ echo " Now I am going to ask you some question regarding your system. "
+ echo " These will help you in getting decent startup performance. "
+ echo " The answers you provide here would be reflected in generated "
+ echo " postgresql config file."
+ echo
+ read -p " Press any key to continue. " wvar
+
+ echo
+ echo "Setting parameter: shared_buffers"
+ echo " Unit: 8KB"
+ echo " Type: Integer"
+ echo
+ echo " This parameter sets how much shared memory postgresql will use."
+ echo " Value of this parameter depends upon size of dataset handled at"
+ echo " a time and available memory."
+ echo
+ echo " This parameter is limited by maximum shared memory setting of the"
+ echo " system. You might need to tune your kernel for your requirement."
+ echo " Please refer to Administrator's guide for more details."
+ echo
+ echo " WARNING: Setting this parameter too high can cause loss of performance"
+ echo " or postgresql might not start at all. Please adhere to guideline shown "
+ echo " and apply your own judgement."
+ echo
+ echo " Description Memory Value"
+ echo " Workstation or test database 4MB 512 "
+ echo " Medium size database and 256-512 MB RAM 16-32MB 2048-4096"
+ echo " Large database and >1GB memory 64-256MB 8192-32768"
+ echo
+ read -p "Enter value of shared_buffers: " new_shared_buffers
+
+ echo
+ echo "Setting paramter: effective_cache_size"
+ echo " Unit: 8KB"
+ echo " Type: Integer"
+ echo
+
+ echo " Postgresql will perform better if it knows how much file cache OS has."
+ echo " This parameters gives hint to postgresql about the amount of file"
+ echo " system cache."
+ echo
+ echo " There is nothing high or low about this parameter. It should be set to"
+ echo " the correct value. Only change required is to account for memory"
+ echo " requirement of other applications running on same machie. Being bit"
+ echo " conservative on this parameter is recommended."
+ echo
+ read -p "Enter value of effective_cache_size: " new_effective_cache
+
+ }
CMDNAME=`basename $0`
***************
*** 583,597 ****
$ECHO_N "creating configuration files... "$ECHO_C
cp "$PG_HBA_SAMPLE" "$PGDATA"/pg_hba.conf || exit_nicely
cp "$PG_IDENT_SAMPLE" "$PGDATA"/pg_ident.conf || exit_nicely
(
trigger="# These settings are initialized by initdb -- they may be changed"
! sed -n "1,/$trigger/p" "$POSTGRESQL_CONF_SAMPLE"
for cat in MESSAGES MONETARY NUMERIC TIME; do
! echo "LC_$cat = '`pg_getlocale $cat`'"
done
! sed -n "1,/$trigger/!p" "$POSTGRESQL_CONF_SAMPLE"
) > "$PGDATA"/postgresql.conf || exit_nicely
chmod 0600 "$PGDATA"/pg_hba.conf "$PGDATA"/pg_ident.conf \
--- 640,660 ----
$ECHO_N "creating configuration files... "$ECHO_C
+ #Get the database tuning options
+ pg_getDefault_Config
+
cp "$PG_HBA_SAMPLE" "$PGDATA"/pg_hba.conf || exit_nicely
cp "$PG_IDENT_SAMPLE" "$PGDATA"/pg_ident.conf || exit_nicely
(
trigger="# These settings are initialized by initdb -- they may be changed"
! lcvars=""
for cat in MESSAGES MONETARY NUMERIC TIME; do
! lcvars="$lcvars\nLC_$cat = '`pg_getlocale $cat`'";
done
!
! sed "s/#shared_buffers/shared_buffers = $new_shared_buffers/" "$POSTGRESQL_CONF_SAMPLE"| \
! sed "s/#effective_cache_size/effective_cache_size = $new_effective_cache/" | \
! sed "s/$trigger/$trigger$lcvars/"
) > "$PGDATA"/postgresql.conf || exit_nicely
chmod 0600 "$PGDATA"/pg_hba.conf "$PGDATA"/pg_ident.conf \
***************
*** 1096,1102 ****
# FINISHED
echo
! echo "Success. You can now start the database server using:"
echo ""
echo " $PGPATH/postmaster -D $PGDATA"
echo "or"
--- 1159,1170 ----
# FINISHED
echo
! echo "Success."
! echo
! echo "Now you should tune the postgresql configuration file, $PGDATA/postgresql.conf"
! echo "Refer to Administrators guide for any further assistance for tuning options."
! echo
! echo "After you are done with tuning the options, you can start the postgresql server using"
echo ""
echo " $PGPATH/postmaster -D $PGDATA"
echo "or"
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Another POC initdb patch
@ 2003-07-06 15:25 Tom Lane <tgl@sss.pgh.pa.us>
parent: Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2003-07-06 15:25 UTC (permalink / raw)
To: Shridhar Daithankar <shridhar_daithankar@persistent.co.in>; +Cc: pgsql-patches@postgresql.org; pgsql-performance
Shridhar Daithankar <shridhar_daithankar@persistent.co.in> writes:
> In addition to Tom's patch, this patch asks tuning parameters right away,
> while doing initdb.
Sorry, there is zero chance of putting any interactivity into initdb.
Most RPM installations run it from the RPM install script and would be
unable to cope with this.
I disagree with the concept of expecting someone to supply useful values
at install time anyway, since a newbie is the *least* likely to have any
idea what to say at that time. Heck, the experts can hardly agree on
what to use ...
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Another POC initdb patch
@ 2003-07-07 06:45 Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Shridhar Daithankar @ 2003-07-07 06:45 UTC (permalink / raw)
To: pgsql-patches@postgresql.org
On Sunday 06 July 2003 20:55, Tom Lane wrote:
> Shridhar Daithankar <shridhar_daithankar@persistent.co.in> writes:
> > In addition to Tom's patch, this patch asks tuning parameters right away,
> > while doing initdb.
>
> Sorry, there is zero chance of putting any interactivity into initdb.
> Most RPM installations run it from the RPM install script and would be
> unable to cope with this.
Hmm.. If distro. vendors can put a wrapper of service script around it on
their own, how much difficult it is to modify initdb to revert back to
original behaviour?
I think it would be fair on linux distro. vendors part if they decide to put a
reasonable default for shared_buffers. Unlike postgresql community, they
don't haev to worry about OS protability because they know that it is going
to run on only linux.
I mailed mandrake long time back, requesting a config file for service script
where it would allow to specify database location. No reply.
> I disagree with the concept of expecting someone to supply useful values
> at install time anyway, since a newbie is the *least* likely to have any
> idea what to say at that time. Heck, the experts can hardly agree on
> what to use ...
Whatever user says might not be the best or optimum but will be likely to be
much better than 64.
I agree that this is not part of rpm philosophy. Install and configure is only
followed by debian IIRC.
Furthermore this could take care of user complains that postgresql does not
have reasonable defaults. Problems with such approach w.r.t. linux distro.s
aren't exactly impossible to solve. May be we could add it to release notes,
for their convinience.
Another proposal is to take out everything interactive I put it in patch,
write another shell script, that would tune postgresql.conf, like the
configuration wizard you suggested.
No matter where it goes, users would be very happy to have a tool which hand
holds them to a reasonanly working config file and points to right
documentation thereafter.
Shridhar
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-07-07 06:45 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-07-06 14:10 Another POC initdb patch Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
2003-07-06 15:25 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-07-07 06:45 ` Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox