X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 26EC7D1C4D5 for ; Sun, 3 Aug 2003 13:04:28 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 33270-08 for ; Sun, 3 Aug 2003 10:03:18 -0300 (ADT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id 3DE03D1C4BD for ; Sun, 3 Aug 2003 10:04:17 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 2BCB31024D; Sun, 3 Aug 2003 08:56:57 -0400 (EDT) Received: from [192.168.1.200] (dyn-133-81.tor.dsl.tht.net [134.22.133.81]) by mailav.tor1.inquent.com (Postfix) with ESMTP id E089310248; Sun, 3 Aug 2003 08:56:54 -0400 (EDT) Subject: Re: join optimization problem From: Rod Taylor To: toby@lyricist.com.au Cc: pgsql-sql@postgresql.org In-Reply-To: <200308032021.45212.toby@lyricist.com.au> References: <200307281412.36981.toby@lyricist.com.au> <1059698003.33557.5.camel@jester> <200308032021.45212.toby@lyricist.com.au> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-iqnQkHOvykGDe6uQ/Axm" Message-Id: <1059915851.43336.208.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 03 Aug 2003 09:04:11 -0400 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/23 X-Sequence-Number: 14639 --=-iqnQkHOvykGDe6uQ/Axm Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > thanks for that - I tried it out, fixed the minor typos and it ran at al= most=20 > the same speed! Any other ideas? Could you post an explain analyze for both queries? There is always an application change. Add a trigger onto msg that will bump the date and count on msg_sum when a msg is added. This will support virtually unlimited msg table growth (any aggregate will eventually be slow on a large table). Just be sure to vacuum the msg_sum table regularly (once per 25% turnover) -- possibly as often as once a minute! --=-iqnQkHOvykGDe6uQ/Axm Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/LQhK6DETLow6vwwRAokkAJwKDkPwi1OklHRyiylkfZ9rvofF1ACfWnvT qXPbE2Zor7nBB/frVpRS5Xg= =gbe0 -----END PGP SIGNATURE----- --=-iqnQkHOvykGDe6uQ/Axm--