This is a multi-part message in MIME format.
------_=_NextPart_001_01CA0E8C.86D1E1FF
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi All,
I have recently moved postgres from one server to another (a newer
server) and have encounter a problem I cant figure out. I have a table
(roughly 7.5GB) that gets re-created every night with fresh data, to
insert the data I run the following procedure.
Drop all indexes
Truncate Table
Insert Data
Create Indexes
The problem I have is that it takes around 15 mins to insert the data
into the table which is a massive improvement from the old server but it
then takes 40 mins to create two indexes one 1GB index and another that
is a 2GB index this is considerably slower than on the older server.
I have had a play around with some of the settings but with no real
success, in particular the maintenance_work_mem setting. Any help on
this would be greatly appreciated. The new server is a Virtual Server
running RedHat Linux, Postgres 8.3 , 8GB of RAM with 4 x 2.66ghz. The
current settings in postgresql.conf I have are
shared_buffers =3D 768MB
temp_buffers =3D 100MB =
#max_prepared_transactions =3D 5
work_mem =3D 64MB =2 0=
maintenance_work_mem =3D 800MB
#max_stack_depth =3D 2MB =
# - Free Space Map -
max_fsm_pages =3D 2097152
#max_fsm_relations =3D 1000
# - Kernel Resource Usage -
#max_files_per_process =3D 1000
#shared_preload_libraries =3D ''
# - Cost-Based Vacuum Delay -
#vacuum_cost_delay =3D 0 =
#vacuum_cost_page_hit =3D 1
#vacuum_cost_page_miss =3D 10
#vacuum_cost_page_dirty =3D 20
#vacuum_cost_limit =3D 200
# - Background Writer -
#bgwriter_delay =3D 200ms
#bgwriter_lru_maxpages =3D 100
#bgwriter_lru_multiplier =3D 2.0
/etc/sysctl.conf
kernel.shmmax =3D 4294967295
kernel.shmall =3D 268435456
Any help would be greatly appreciated, thanks in advance
Fran
___________________________________________________
This email is intended for the named recipient. The information contained=
in it is confidential. You should not copy it for any purposes, nor
disclose its contents to any other party. If you received this email
in error, please notify the sender immediately via email, and delete it from
your computer.
Any views or opinions presented are solely those of the author and do not=
necessarily represent those of the company.
Cromwell Tools Limited, PO Box 14, 65 Chartwell Drive
Wigston, Leicester LE18 1AT. Tel 0116 2888000
Registered in England and Wales, Reg No 00986161
VAT GB 115 5713 87 900
__________________________________________________
------_=_NextPart_001_01CA0E8C.86D1E1FF
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version 6.5.7638.1">
<TITLE>Slow adding Large Indexes</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=3D2 FACE=3D"Arial">Hi All,</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">I have recently moved postgres from one se=
rver to another (a newer server) and have encounter a problem I cant figure=
out. I have a table (roughly 7.5GB) that gets re-created every night=
with fresh data, to insert the data I run the following procedure.</=
FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Drop all indexes</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Truncate Table</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Insert Data</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Create Indexes</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">The problem I have is that it takes around=
15 mins to insert the data into the table which is a massive improvement f=
rom the old server but it then takes 40 mins to create two indexes one 1GB =
index and another that is a 2GB index this is considerably slower than on t=
he older server.</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Arial">I have had a play around with some of the =
settings but with no real success, in particular the maintenance_work_mem s=
etting. Any help on this would be greatly appreciated. The new =
server is a Virtual Server running RedHat Linux, Postgres 8.3 , 8GB o=
f RAM with 4 x 2.66ghz. The current settings in postgresql.conf I hav=
e are</FONT></P>
<BR>
<P><FONT SIZE=3D2 FACE=3D"Arial">shared_buffers =3D 768MB =
&nb=
sp; =
&nb=
sp; =
&nb=
sp; </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">temp_buffers =3D 100MB &=
nbsp; &nbs=
p; </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">#max_prepared_transactions =3D 5 &nb=
sp; </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">work_mem =3D 64MB =
&nb=
sp; </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">maintenance_work_mem =3D 800MB  =
; </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">#max_stack_depth =3D 2MB  =
; &n=
bsp; </FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial"># - Free Space Map -</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">max_fsm_pages =3D 2097152  =
; <=
/FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">#max_fsm_relations =3D 1000 &n=
bsp; </FO=
NT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial"># - Kernel Resource Usage -</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">#max_files_per_process =3D 1000  =
; </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">#shared_preload_libraries =3D '' &nb=
sp; </FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial"># - Cost-Based Vacuum Delay -</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">#vacuum_cost_delay =3D 0 =
&nb=
sp; </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">#vacuum_cost_page_hit =3D 1 &n=
bsp; </FO=
NT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">#vacuum_cost_page_miss =3D 10 =
</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">#vacuum_cost_page_dirty =3D 20  =
; </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">#vacuum_cost_limit =3D 200 &nb=
sp; =
</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial"># - Background Writer -</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">#bgwriter_delay =3D 200ms  =
; <=
/FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">#bgwriter_lru_maxpages =3D 100  =
; </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">#bgwriter_lru_multiplier =3D 2.0 &nb=
sp; </FONT>
</P>
<P><B><FONT SIZE=3D2 FACE=3D"Arial">/etc/sysctl.conf</FONT></B>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">kernel.shmmax =3D 4294967295</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">kernel.shmall =3D 268435456</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Any help would be greatly appreciated, tha=
nks in advance</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Fran</FONT>
</P>
<BR>
<BR>
<BR>
<BR>
</BODY>
___________________________________________________
This email is intended for the named recipient. The information conta=
ined
in it is confidential. You should not copy it for any purposes, nor=
disclose its contents to any other party. If you received this email=
in error, please notify the sender immediately via email, and delete
it from your computer.
Any views or opinions presented are solely those of the author and do=
not
necessarily represent those of the company.
Cromwell Tools Limited, PO Box 14, 65 Chartwell Drive
Wigston, Leicester LE18 1AT. Tel 0116 2888000
Registered in England and Wales, Reg No 00986161
VAT GB 115 5713 87 900
__________________________________________________
</HTML>
------_=_NextPart_001_01CA0E8C.86D1E1FF--
