Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 9471A1337B92 for ; Sat, 5 Feb 2011 05:13:11 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 94821-02 for ; Sat, 5 Feb 2011 09:13:04 +0000 (UTC) X-Greylist: delayed 00:06:38.063337 by SQLgrey-1.7.6 Received: from 31.mail-out.ovh.net (31.mail-out.ovh.net [213.186.62.10]) by mail.postgresql.org (Postfix) with SMTP id 927B91337B8B for ; Sat, 5 Feb 2011 05:13:03 -0400 (AST) Received: (qmail 29453 invoked by uid 503); 5 Feb 2011 09:44:52 -0000 Received: from b7.ovh.net (HELO mail97.ha.ovh.net) (213.186.33.57) by 31.mail-out.ovh.net with SMTP; 5 Feb 2011 09:44:52 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 5 Feb 2011 11:06:21 +0200 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO apollo13) (lists%peufeu.com@88.161.102.87) by ns0.ovh.net with SMTP; 5 Feb 2011 11:06:20 +0200 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: felix , "Shaun Thomas" Cc: "Scott Marlowe" , "pgsql-performance@postgresql.org" Subject: Re: Really really slow select count(*) References: <4D4C138C.7010304@2ndquadrant.com> <4D4C1555.40209@peak6.com> <4D4C2AC3.5020804@peak6.com> <4D4C3BCA.5010808@peak6.com> <4D4C46C2.1080108@peak6.com> <4D4C5AE6.4030101@peak6.com> <4D4C63A4.6090109@peak6.com> Date: Sat, 05 Feb 2011 10:06:19 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Pierre C" Message-ID: In-Reply-To: <4D4C63A4.6090109@peak6.com> User-Agent: Opera Mail/10.63 (Linux) X-Ovh-Tracer-Id: 1372471987763742323 X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201102/245 X-Sequence-Number: 42383 On Fri, 04 Feb 2011 21:37:56 +0100, Shaun Thomas wrote: > On 02/04/2011 02:14 PM, felix wrote: > >> oh and there in the footnotes to django they say "dont' forget to run >> the delete expired sessions management every once in a while". >> thanks guys. > > Oh Django... :) > >> it won't run now because its too big, I can delete them from psql though > > You might be better off deleting the inverse. You know, start a > transaction, select all the sessions that *aren't* expired, truncate the > table, insert them back into the session table, and commit. Note that for a session table, that is updated very often, you can use the postgres' HOT feature which will create a lot less dead rows. Look it up in the docs.