Re: Really really slow select count(*)

From: felix <crucialfelix(at)gmail(dot)com>
To: 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-04 20:14:22
Message-ID: AANLkTimw2izMi4QfizQm72ABePackWXhhUU9EHdNf3zk@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

it probably has good reason to hate me.

ns=> SELECT n.nspname AS schema_name, c.relname AS table_name,
ns-> c.reltuples AS row_count,
ns-> c.relpages*8/1024 AS mb_used,
ns-> pg_total_relation_size(c.oid)/1024/1024 AS total_mb_used
ns-> FROM pg_class c
ns-> JOIN pg_namespace n ON (n.oid=c.relnamespace)
ns-> WHERE c.relkind = 'r'
ns-> ORDER BY total_mb_used DESC
ns-> LIMIT 20;
schema_name | table_name | row_count | mb_used |
total_mb_used
-------------+----------------------------------+-------------+---------+---------------
public | django_session | 1.47843e+07 | 4122 |
18832
public | traffic_tracking2010 | 9.81985e+06 | 811 |
1653
public | mailer_mailingmessagelog | 7.20214e+06 | 441 |
1082
public | auth_user | 3.20077e+06 | 572 |
791
public | fastadder_fastadderstatus | 302479 | 458 |
693
public | registration_registrationprofile | 3.01345e+06 | 248 |
404
public | reporting_dp_6c93734c | 1.1741e+06 | 82 |
224
public | peoplez_contact | 79759 | 18 |
221
public | traffic_tracking201101 | 1.49972e+06 | 163 |
204
public | reporting_dp_a3439e2a | 1.32739e+06 | 82 |
187
public | nsproperties_apthistory | 44906 | 69 |
126
public | nsproperties_apt | 30780 | 71 |
125
public | clients_showingrequest | 85175 | 77 |
103
public | reporting_dp_4ffe04ad | 330252 | 26 |
63
public | fastadder_fastadderstatuslog | 377402 | 28 |
60
public | nsmailings_officememotoagent | 268345 | 15 |
52
public | celery_taskmeta | 5041 | 12 |
32
public | mailer_messagelog | 168298 | 24 |
32
public | datapoints_job | 9167 | 12 |
23
public | fastadder_fastadderstatus_errors | 146314 | 7 |
21

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.

it won't run now because its too big, I can delete them from psql though

well just think how sprightly my website will run tomorrow once I fix these.

On Fri, Feb 4, 2011 at 9:00 PM, Shaun Thomas <sthomas(at)peak6(dot)com> wrote:

> On 02/04/2011 01:59 PM, felix wrote:
>
>
> still no advice on the pages
>>
>
> I think it just hates you.
>
>
> --
> Shaun Thomas
> OptionsHouse | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, 60604
> 312-676-8870
> sthomas(at)peak6(dot)com
>
> ______________________________________________
>
> See http://www.peak6.com/email_disclaimer.php
> for terms and conditions related to this email
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Shaun Thomas 2011-02-04 20:37:56 Re: Really really slow select count(*)
Previous Message Shaun Thomas 2011-02-04 20:00:38 Re: Really really slow select count(*)