Received: from xyzzy.lan.internal (d226-80-178.home.cgocable.net [24.226.80.178]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fBI12km08324 for ; Mon, 17 Dec 2001 20:02:50 -0500 (EST) (envelope-from drew@xyzzy.dhs.org) Received: from localhost ([127.0.0.1] ident=drew) by xyzzy.lan.internal with esmtp (Exim 3.33 #1 (Debian)) id 16G8eZ-0001In-00; Mon, 17 Dec 2001 20:02:43 -0500 Subject: Re: How do I vacuum safely? And how often should I reindex From: "Andrew G. Hammond" To: Marc Spitzer Cc: pgsql-admin@postgresql.org In-Reply-To: References: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-3c01hZHt0gvZPc3xBGaQ" X-Mailer: Evolution/1.0 (Preview Release) Date: 17 Dec 2001 20:02:42 -0500 Message-Id: <1008637363.4653.2.camel@xyzzy> Mime-Version: 1.0 X-Archive-Number: 200112/107 X-Sequence-Number: 2830 --=-3c01hZHt0gvZPc3xBGaQ Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2001-12-17 at 12:25, Marc Spitzer wrote: > I have some questions about vaccum analize, and here they are: >=20 > 1: to vaccume analize a db I just vaccume analize the tables > one at a time Or you could run it on the entire database by not specifying a table. > 2: no reads or writes happen durring the vacuum=20 The vacuum it'self does quite a bit of re-organizing. > 3: does vacuum wait to aquire the lock or just fail, is=20 > it nessarsary to get the lock programaticly and then > turn it loos oe will it take care of it self. According to the docs, VACUUM aquires an ACCESS EXCLUSIVE LOCK. You can see this out yourself by firing up two psql sessions and in the first: BEGIN; LOCK foo; In the second, VACUUM foo; it'll block waiting for a lock on table foo. Go back to the first and COMMIT, and the second will immediately start vacuuming. However this is slated to change in 7.2 > 1: how do I figure out how much space is wasted in my indexs > and primary keys? Now I just keep an eye on disk usage, > is there a better way? Indices are wasted only if you never use them. Otherwise they make a pretty huge difference. Given the price of GB's recently, the better way is to throw hardware at it. > 2: how often should I reindex my db, are there any standards > or accepted practices out there I recreate my indices every week, or after any extensive updates or deletes. Again, I believe that 7.2 has some new stuff to deal with this issue. > and how will 7.2 be different, I remember a background vacuum > being discused, what other great things are there waiting in > the wings Er... RTFM: http://developer.postgresql.org/todo.php stuff that's slated for 7.2 has a - in front of it. --=20 Andrew G. Hammond mailto:drew@xyzzy.dhs.org=20=20 http://xyzzy.dhs.org/~drew/ 56 2A 54 EF 19 C0 3B 43 72 69 5B E3 69 5B A1 1F=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 613-389-5481 5CD3 62B0 254B DEB1 86E0 8959 093E F70A B457 84B1 "To blow recursion you must first blow recur" -- me --=-3c01hZHt0gvZPc3xBGaQ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iQCVAwUAPB6VscaBTSA3ULb1AQL2mAP9HfmA3JSjSWB26siTjHrPgJtaY2zTv+99 6mIg3mhsHVcGUzJK65Y1CWotUSfL+yMau98hIWBGN2loP1N2W1aMH1pz6Uhjgj7E WHvzBkV1IrQ7QSK8Gprx9SBcAPJQ4xhQV4HV3Hc6ifsddFSB8bp4ZcbT8Hu5876U N3kYKNkiWiY= =5Slb -----END PGP SIGNATURE----- --=-3c01hZHt0gvZPc3xBGaQ--