473,767 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

An out of memory error when doing a vacuum full

To all,

The facts:

PostgreSQL 7.4.0 running on BSD 5.1 on Dell 2650 with 4GB RAM, 5 SCSI
drives in hardware RAID 0 configuration. Database size with indexes is
currently 122GB. DB size before we completed the vacuum full was 150GB.

We have recently done a major update to a table, f_pageviews, in our
data warehouse. The f_pageviews table contains about 118 million rows.
Schema is at the end of this message. We probably touched 80% of those
rows with the update. We then commenced to drop all indexes on said
table, except the primary key, and attempted to do a vacuum full on the
entire DB. You can see the output below it failed. We then tried to do
the vacuum full on the f_pageviews table alone and the same error
occurred. I did vacuum full on other tables in the schema, one of them
about 8 times larger but with very few dead tuples, and all complete
successfully. We ended up dumping the table and reloading it to
eliminate the dead tuples. After the reload we did the vacuum full with
no problems.

Does anyone have an explanation as to why this might occur?

Thanks.

--sean
nohup /usr/local/pgsql/bin/vacuumdb -d tripmaster -U tripmaster -f -z -v
-t f_pageviews > & /tmp/vacuum2.log &

tail -f /tmp/vacuum2.log
INFO: vacuuming "public.f_pagev iews"
INFO: "f_pageview s": found 17736235 removable, 111796026 nonremovable
row versions in 1552349 pages
DETAIL: 0 dead row versions cannot be removed yet.
Nonremovable row versions range from 156 to 244 bytes long.
There were 134565418 unused item pointers.
Total free space (including removable row versions) is 27898448080 bytes.
583420 pages are or will become empty, including 0 at the end of the table.
1088195 pages containing 27860101432 free bytes are potential move
destinations.
CPU 238.91s/27.44u sec elapsed 1261.80 sec.
INFO: index "f_pageviews_pk ey" now contains 111796026 row versions in
210003 pages
DETAIL: 15618120 index row versions were removed.
734 index pages have been deleted, 734 are currently reusable.
CPU 96.09s/139.03u sec elapsed 1569.93 sec.
vacuumdb: vacuuming of table "f_pageview s" in database "tripmaster "
failed: ERROR: out of memory
DETAIL: Failed on request of size 350.
\d f_pageviews
Table "public.f_pagev iews"
Column | Type | Modifiers
------------------------+---------+-------------------------------------------------------------
id | integer | not null default
nextval('public .f_pageviews_id _seq'::text)
date_key | integer | not null
time_key | integer | not null
content_key | integer | not null
location_key | integer | not null
session_key | integer | not null
subscriber_key | text | not null
persistent_cook ie_key | integer | not null
ip_key | integer | not null
referral_key | integer | not null
servlet_key | integer | not null
tracking_key | integer | not null
provider_key | text | not null
marketing_campa ign_key | integer | not null
orig_airport | text | not null
dest_airport | text | not null
commerce_page | boolean | not null default false
job_control_num ber | integer | not null
sequenceid | integer | not null default 0
url_key | integer | not null
useragent_key | integer | not null
web_server_name | text | not null default 'Not Available'::tex t
cpc | integer | not null default 0
referring_servl et_key | integer | default 1
first_page_key | integer | default 1
newsletterid_ke y | text | not null default 'Not Available'::tex t
Indexes:
"f_pageviews_pk ey" primary key, btree (id)
"idx_page_views _content" btree (content_key)
"idx_pageviews_ date_dec_2003" btree (date_key) WHERE ((date_key >=
335) AND (date_key <= 365))
"idx_pageviews_ date_nov_2003" btree (date_key) WHERE ((date_key >=
304) AND (date_key <= 334))
"idx_pageviews_ referring_servl et" btree (referring_serv let_key)
"idx_pageviews_ servlet" btree (servlet_key)
"idx_pageviews_ session" btree (session_key)

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #1
8 4600
Is your system using full RAM? Ie, what does limits -a show?
Regards.

Fernando.

En un mensaje anterior, Sean Shanny escribió:
To all,

The facts:

PostgreSQL 7.4.0 running on BSD 5.1 on Dell 2650 with 4GB RAM, 5 SCSI
drives in hardware RAID 0 configuration. Database size with indexes is
currently 122GB. DB size before we completed the vacuum full was 150GB.


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #2
Take a look at datasize: your processes are allowed a maximum of 512 Mb RAM.
Read the handbook to find out how to reconfigure your kernel and the limits
(and/or ulimit) man page to tweak the values for individual processes.

Good luck!

Fernando.

En un mensaje anterior, Sean Shanny escribió:
limits -a
Resource limits (current):
cputime infinity secs
filesize infinity kb
datasize 524288 kb
stacksize 65536 kb
coredumpsize infinity kb
memoryuse infinity kb
memorylocked infinity kb
maxprocesses 5547
openfiles 11095
sbsize infinity bytes
vmemoryuse infinity kb


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 12 '05 #3
Sean Shanny <sh************ **@earthlink.ne t> writes:
Does anyone have an explanation as to why this might occur?


What have you got vacuum_mem set to? Also, what ulimit settings is the
postmaster running under? (I'm wondering exactly how large the backend
process has grown when it gets the failure.)

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Nov 12 '05 #4
Fernando Schapachnik <fe******@mecon .gov.ar> writes:
Take a look at datasize: your processes are allowed a maximum of 512 Mb RAM.
Read the handbook to find out how to reconfigure your kernel and the limits
(and/or ulimit) man page to tweak the values for individual processes.


512Mb does not seem like an unreasonable per-process limit (indeed, it
may be too high considering he's got just 4G RAM to go around among all
the processes). So I'd not recommend Sean try to solve the problem by
raising it. The real question is why is the backend getting that big.
I'm suspicious that sort_mem and/or vacuum_mem are set to
unrealistically large values, but we don't have that info yet.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #5
From postgresql.conf :

# - Memory -

shared_buffers = 10000 # min 16, at least max_connections *2,
8KB each
sort_mem = 64000 # min 64, size in KB
vacuum_mem = 32767 # min 1024, size in KB

The ulimit is set to unlimited as far as I can tell.

--sean

Tom Lane wrote:
Sean Shanny <sh************ **@earthlink.ne t> writes:

Does anyone have an explanation as to why this might occur?


What have you got vacuum_mem set to? Also, what ulimit settings is the
postmaster running under? (I'm wondering exactly how large the backend
process has grown when it gets the failure.)

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #6
Sean Shanny <sh************ **@earthlink.ne t> writes:
sort_mem = 64000 # min 64, size in KB
You might want to lower that; a complex query could easily use several
times sort_mem. Whether this is the immediate source of your problem
with the other query is hard to tell.
vacuum_mem = 32767 # min 1024, size in KB


That seems all right, but I recollect now that it only applies to plain
VACUUM not VACUUM FULL. VACUUM FULL needs to keep track of *all* the
free space in a table, and so it's certainly possible that vacuuming a
huge table with many dead tuples could require lots of memory. I can't
recall anyone else ever complaining about VACUUM FULL running out of
memory, though, so there may be some other contributing factor in your
situation. Too bad you reloaded the table --- it would be interesting
to see if increasing your 512Mb datasize ulimit would have allowed the
VACUUM FULL to complete. (Not but what it would've taken forever :-()

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #7
Tom,

I will lower the sort_mem and see what happens. :-)

I agree that we probably pushed the limits of a vacuum full with the
size table we had and the large percentage of change in the table. We
did NOT run any vacuum jobs during the update process, that my have
helped to allow the updates to use the reclaimed space in place.

We are going to continue to run into this issue as the table is only
going to get larger and we are still making tweaks. An example would be
adding a new column to the f_pageviews table, we have done this several
times as we discover new data that needs to be captured. This of course
entails an ALTER TABLE ADD COLUMN, then an ALTER TABLE ALTER COLUMN to
set the default, then an update to set the 'historical' rows to the
default value, and finally a SET NOT NULL on the column as none of our
data is allowed to have a value of null. This pretty much entails
updating all the rows in the table.

We are thinking instead of doing an UPDATE it would be better to make a
new temp table, run the code that contains the update logic but instead
of updating the real table write the updated and non updated rows to the
temp table , and then do a drop, rename?

Thanks again for your time.

--sean

p.s.

By the way I am unable to send mail to you directly. I get these
errors: (I assume you just don't want email from earthlink?)

tg*@sss.pgh.pa. us
SMTP error from remote mailer after MAIL FROM:<sh******* *******@earthli nk.net>:
host sss.pgh.pa.us [192.204.191.242]: 550 5.0.0 If you would like to talk to me, find a more responsible ISP than earthlink


Tom Lane wrote:
Sean Shanny <sh************ **@earthlink.ne t> writes:

sort_mem = 64000 # min 64, size in KB


You might want to lower that; a complex query could easily use several
times sort_mem. Whether this is the immediate source of your problem
with the other query is hard to tell.
vacuum_mem = 32767 # min 1024, size in KB


That seems all right, but I recollect now that it only applies to plain
VACUUM not VACUUM FULL. VACUUM FULL needs to keep track of *all* the
free space in a table, and so it's certainly possible that vacuuming a
huge table with many dead tuples could require lots of memory. I can't
recall anyone else ever complaining about VACUUM FULL running out of
memory, though, so there may be some other contributing factor in your
situation. Too bad you reloaded the table --- it would be interesting
to see if increasing your 512Mb datasize ulimit would have allowed the
VACUUM FULL to complete. (Not but what it would've taken forever :-()

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #8
Sean Shanny <sh************ **@earthlink.ne t> writes:
By the way I am unable to send mail to you directly. I get these
errors: (I assume you just don't want email from earthlink?)
tg*@sss.pgh.pa. us
SMTP error from remote mailer after MAIL FROM:<sh******* *******@earthli nk.net>:
host sss.pgh.pa.us [192.204.191.242]: 550 5.0.0 If you would like to talk to me, find a more responsible ISP than earthlink


Sorry about that --- I blocked earthlink in disgust about six months
ago, when I noticed that my virus-rejection script had been faithfully
bouncing virus mails from the *same* earthlink account to abuse at
abuse.earthlink .net every few days for the preceding nine months, and
their abuse people quite obviously had taken zero action to get their
customer disinfected. Assuming they have any abuse people, that is, and
abuse@ isn't just an alias for /dev/null. I'm not planning to unblock
until I see some evidence that they have a functioning abuse desk.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3778
by: Sean Shanny | last post by:
To all, The facts: PostgreSQL 7.4.0 running on BSD 5.1 on Dell 2650 with 4GB RAM, 5 SCSI drives in hardware RAID 0 configuration. Database size with indexes is currently 122GB. Schema for the table in question is at the end of this email. The DB has been vacuumed full and analyzed. Between 8 and 12 million records are added to the table in question each night. An analyze on the entire DB is done after the data has been loaded...
8
3512
by: Dave Smith | last post by:
I am running 7.2 and when doing a vacuum I am getting the following error.... ERROR: Cannot insert a duplicate key into unique index pg_statistic_relid_att_index Where do I start to fix this? --
25
2386
by: Zeng | last post by:
I finally narrowed down my code to this situation, quite a few (not all) of my CMyClass objects got hold up after each run of this function via the simple webpage that shows NumberEd editbox. My memory profile shows that those instances survive 3 rounds of GC collections - it's not what I expected. In my real code, CMyClass occupies big amount of memory and they all share one stance of another class that I don't have enough memory hold...
6
2653
by: Alex | last post by:
Hi, just a few questions on the Vaccum I run a vacuum analyze on the database every night as part of a maintenance job. During the day I have a job that loads 30-70,000 records into two tables (each 30-70k). This job runs 2-3 times a day; the first time mainly inserts, the 2nd, 3rd time mostly updates.
0
1720
by: Jim Seymour | last post by:
Hi, Environment: PostgreSQL 7.4.2 Locally built with GCC 3.3.1 Solaris 8 (Sparc) I have a relatively simple database created with...
15
2384
by: Ed L. | last post by:
If I see VACUUM ANALYZE VERBOSE output like this... INFO: --Relation public.foo-- INFO: Index idx_foo_bar: Pages 219213; Tuples 28007: Deleted 9434. CPU 17.05s/4.58u sec elapsed 3227.62 sec. ....am I correct in reading this to say that it took more than 53 minutes (3227 secs) to get 17 seconds of CPU time? Is this an indicator of possible I/O contention? What else would account for this if my CPUs are clearly not very busy?
6
1822
by: spied | last post by:
look please http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=253295 ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend
0
2473
by: Kevin Bartz | last post by:
-----Original Message----- From: Kevin Bartz Sent: Monday, August 09, 2004 10:37 AM To: 'mike@thegodshalls.com' Subject: RE: Out of swap space & memory Thanks for your reply, Mike! Theoretically, I should need only six of the columns, but as a means of verifying integrity, I would like to de-dup using all the columns. For instance, if there are two rows identical everywhere but some column outside the six, I would like to know about...
5
5624
by: Janning Vygen | last post by:
Hi, tonight my database got corruppted. before it worked fine. since two days i do the following tasks every night psql -c 'CLUSTER;' $DBNAME psql -c 'VACUUM FULL ANALYZE;' $DBNAME before these opertaions i stop all web access. The last months i only did a
0
9575
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9407
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10014
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9841
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6656
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5425
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3534
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.