pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <kgrittn@ymail.com>
To: James R Skaggs <james.r.skaggs@seagate.com>
Cc: jimbob@seagate.com <jimbob@seagate.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #7853: Incorrect statistics in table with many dead rows.
Date: Tue, 5 Feb 2013 15:12:15 -0800 (PST)
Message-ID: <1360105935.25882.YahooMailNeo@web162904.mail.bf1.yahoo.com> (raw)
In-Reply-To: <CAHqB0wQhGzjzbtK1t0t+xixcdJ8L3FxX+XouJw4-LCaG+B8Sjw@mail.gmail.com>
References: <E1U2nS6-0003ky-CY@wrigleys.postgresql.org>
	<1360101646.24672.YahooMailNeo@web162901.mail.bf1.yahoo.com>
	<CAHqB0wQhGzjzbtK1t0t+xixcdJ8L3FxX+XouJw4-LCaG+B8Sjw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

James R Skaggs <james.r.skaggs@seagate.com> wrote:

> Agreed, we shouldn't have so many dead rows.  Our autovacuum is
> set on but has default parameters.   We are clustering today. 
> This, of course, means downtime and inconvenience to the users.

Right, which is why it's important to figure out why the bloat
happened.  Sometimes it is unavoidable, like when you delete 90% of
the rows in your table or a long-lived "idle in transaction"
connection prevents autovacuum from being able to do its work
normally.  To prevent further downtime it is important to figure
out what happened and make appropriate changes to your monitoring
or vacuuming.

> Here is the troublesome query:
>
>> select 
>>    sum(case when t1.cdlc < 0 then 0 else t1.cdlc end) as code_line_cnt, 
>>    sum(case when t1.cmlc < 0 then 0 else t1.cmlc end) as comment_line_cnt, 
>>    sum(case when t1.bllc < 0 then 0 else t1.bllc end) as blank_line_cnt 
>>  from 
>>    ( select 
>>        max(sf.current_code_line_count) as cdlc, 
>>        max(sf.current_comment_line_count) as cmlc,
>>        max(sf.current_blank_line_count) as bllc 
>>      from 
>>        stream_file sf 
>>      group by sf.file_path_id, sf.current_source_md5 
>>    ) as t1;

Well, I don't see that the planner has a lot of choice there
besides whether to use a sort or a hash to do the inner
aggregation.  Are you saying that prior to the bloat it used a hash
aggregation, and that was faster?  And that you feel that it should
be using that even with the bloat?  That the dead rows seem to be
getting included in the statistics, driving to the slower plan, and
you feel they should be omitted?

Note that I'm not aruing one way or another on these points at the
moment; I'm just trying to understand your point clearly.

-Kevin


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (11+ messages)  latest in thread

Message-ID: <1360105935.25882.YahooMailNeo@web162904.mail.bf1.yahoo.com>
Permalink:  ../1360105935.25882.YahooMailNeo@web162904.mail.bf1.yahoo.com/
Also on:    postgresql.org/message-id/1360105935.25882.YahooMailNeo@web162904.mail.bf1.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: kgrittn@ymail.com, james.r.skaggs@seagate.com, jimbob@seagate.com
  Subject: Re: BUG #7853: Incorrect statistics in table with many dead rows.
  In-Reply-To: <1360105935.25882.YahooMailNeo@web162904.mail.bf1.yahoo.com>
  References: <E1U2nS6-0003ky-CY@wrigleys.postgresql.org> <1360101646.24672.YahooMailNeo@web162901.mail.bf1.yahoo.com> <CAHqB0wQhGzjzbtK1t0t+xixcdJ8L3FxX+XouJw4-LCaG+B8Sjw@mail.gmail.com> <1360105935.25882.YahooMailNeo@web162904.mail.bf1.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox