473,473 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

vacuum full for all databases

Dear Sirs

I'm about to write plpgsql function which will "vacuum full" all existing
databases. Below is an example how to get list of databases.

What should I write instead of "raise notice" ?
CREATE OR REPLACE FUNCTION vacuum_all() RETURNS integer
AS '
DECLARE
query text;
list RECORD;
BEGIN

FOR list IN SELECT datname FROM pg_catalog.pg_database WHERE NOT
datistemplate LOOP
raise notice ''datname = %'',list.datname;

END LOOP;

RETURN 0;

END;

'
LANGUAGE plpgsql;
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #1
4 7877
Am Donnerstag, 2. September 2004 09:32 schrieb Ilia Chipitsine:
I'm about to write plpgsql function which will "vacuum full" all existing
databases. Below is an example how to get list of databases.

What should I write instead of "raise notice" ?


You normally cannot access different databases from one database session. But
you could use dblink from contrib to overcome this restriction.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

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

Nov 23 '05 #2
Ilia Chipitsine wrote:
Dear Sirs

I'm about to write plpgsql function which will "vacuum full" all existing
databases. Below is an example how to get list of databases.

What should I write instead of "raise notice" ? raise notice ''datname = %'',list.datname;


Something like:
EXECUTE ''VACUUM FULL '' || list.datname;

--
Richard Huxton
Archonet Ltd

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

Nov 23 '05 #3
> Ilia Chipitsine wrote:
Dear Sirs

I'm about to write plpgsql function which will "vacuum full" all existing
databases. Below is an example how to get list of databases.

What should I write instead of "raise notice" ?
raise notice ''datname = %'',list.datname;


Something like:
EXECUTE ''VACUUM FULL '' || list.datname;


"vacuum full" accepts relation name, not database name

$ psql -U pgsql template1
Welcome to psql 7.4.2, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

template1=# vacuum full site_b170;
ERROR: relation "site_b170" does not exist
template1=#

--
Richard Huxton
Archonet Ltd


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #4
On Thu, 2 Sep 2004, Richard Huxton wrote:
Ilia Chipitsine wrote:
Dear Sirs

I'm about to write plpgsql function which will "vacuum full" all existing
databases. Below is an example how to get list of databases.

What should I write instead of "raise notice" ?

raise notice ''datname = %'',list.datname;


Something like:
EXECUTE ''VACUUM FULL '' || list.datname;


vacuumdb --all

Regards,
Oleg
__________________________________________________ ___________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: ol**@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

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

Nov 23 '05 #5

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

Similar topics

10
by: Stephen | last post by:
Hello, Is it normal for plain VACUUM on large table to degrade performance by over 9 times? My database becomes unusable when VACUUM runs. From reading newsgroups, I thought VACUUM should only...
8
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. DB size...
2
by: lnd | last post by:
Any comments on multi-versioning problem: As far as I understand from PG documentation, *CURRENTLY* VACUUM must be run regulary, otherwise: -Q. database will grow as fast as there are many DML...
6
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...
0
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...
0
by: Rajesh Kumar Mallah | last post by:
Greeting, Will it be an useful feature to be able to vacumm / analyze all tables in a given schema. eg VACUUM schema.* ; at least for me it will be a good feature.
15
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. ...
6
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
9
by: Aleksey Serba | last post by:
Hello! I have 24/7 production server under high load. I need to perform vacuum full on several tables to recover disk space / memory usage frequently ( the server must be online during vacuum...
0
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...
0
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,...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.