X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7CB9852822 for ; Mon, 20 Jun 2005 12:20:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67681-07 for ; Mon, 20 Jun 2005 15:20:45 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 68D8652814 for ; Mon, 20 Jun 2005 12:20:43 -0300 (ADT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id j5KFKeRm007341; (envelope-from ) Mon, 20 Jun 2005 10:20:40 -0500 (CDT) Received: from [192.168.1.100] ([12.214.18.81]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j5KFKZI1011642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Mon, 20 Jun 2005 10:20:40 -0500 (CDT) Message-ID: <42B6DEC5.3080008@arbash-meinel.com> Date: Mon, 20 Jun 2005 10:20:37 -0500 From: John Arbash Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alex Stapleton , Postgresql Performance Subject: Re: autovacuum suggestions for 500,000,000+ row tables? References: <6.2.0.14.0.20050620165134.03b61140@pop.interactivemediafactory.net> In-Reply-To: X-Enigmail-Version: 0.91.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigA84180580675F413A1EE46C6" X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/368 X-Sequence-Number: 13005 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA84180580675F413A1EE46C6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Alex Stapleton wrote: > > On 20 Jun 2005, at 15:59, Jacques Caron wrote: > ... >> ANALYZE is not a very expensive operation, however VACUUM can >> definitely be a big strain and take a looooong time on big tables, >> depending on your setup. I've found that partitioning tables (at the >> application level) can be quite helpful if you manage to keep each >> partition to a reasonable size (under or close to available memory), >> especially if the partitioning scheme is somehow time- related. YMMV. >> >> Jacques. > > > That's not currently an option as it would require a pretty large > amount of work to implement. I think we will have to keep that in > mind though. Remember, you can fake it with a low-level set of tables, and then wrap them into a UNION ALL view. So you get something like: CREATE VIEW orig_table AS SELECT * FROM table_2005_04 UNION ALL SELECT * FROM table_2005_05 UNION ALL SELECT * FROM table_2005_06 ... ; Then at least your individual operations are fast. As you insert, you can create a rule that on insert into orig_table do instead ... insert into table_2005_07 (or whatever the current table is). It takes a little bit of maintenance on the DB admin's part, since every month they have to create a new table, and then update all of the views and triggers. But it is pretty straightforward. If you are doing append-only inserting, then you have the nice feature that only the last table is ever modified, which means that the older tables don't really need to be vacuumed or analyzed. And even if you have to have each table modified as you go, you still can break up a VACUUM into only doing one of the sub tables at a time. I don't know you db schema, but I thought I would mention that true partitioning isn't implemented yet, you can still get something very similar with views, triggers and rules. John =:-> --------------enigA84180580675F413A1EE46C6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCtt7FJdeBCYSNAAMRArhQAJ9pCuosGdZek7n6zeCThnmbRMBfegCgsDuH DC8XMOqzWW3aPGUTm35yKI0= =feW3 -----END PGP SIGNATURE----- --------------enigA84180580675F413A1EE46C6--