Re: Really really slow select count(*)

From: "Pierre C" <lists(at)peufeu(dot)com>
To: felix <crucialfelix(at)gmail(dot)com>, "Shaun Thomas" <sthomas(at)peak6(dot)com>
Cc: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Really really slow select count(*)
Date: 2011-02-05 09:06:19
Message-ID: op.vqe98ttzeorkce@apollo13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, 04 Feb 2011 21:37:56 +0100, Shaun Thomas <sthomas(at)peak6(dot)com> 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.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Cédric Villemain 2011-02-05 22:15:15 Re: Write-heavy pg_stats_collector on mostly idle server
Previous Message Віталій Тимчишин 2011-02-05 09:01:05 Re: How to best use 32 15k.7 300GB drives?