pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kadri Raudsepp <kadri.raudsepp@nordicgaming.com>
Cc: pgsql-admin@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: [ADMIN] Column missing from pg_statistics
Date: Fri, 10 Jan 2014 11:15:14 -0500
Message-ID: <12480.1389370514@sss.pgh.pa.us> (raw)
In-Reply-To: <CAJ_Sy+yzsbj6QNCQMyuh+PsnnHYUMJ+1_9La4=U9XXryeZsmbg@mail.gmail.com>
References: <CAJ_Sy+yzsbj6QNCQMyuh+PsnnHYUMJ+1_9La4=U9XXryeZsmbg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Kadri Raudsepp <kadri.raudsepp@nordicgaming.com> writes:
> I have set up a cron-job that sends me daily reports on bloat amount in
> tables and indices, which I calculate using pg_stats, not pgstattuple, for
> performance and I/O reasons. If the bloat amount or percentage are big
> enough, I use pg_repack to get rid of it. At some point I noticed, that
> some tables keep showing up in the reports with the same amount of bloat,
> which pg_repack was seemingly unable to remove. Investigation showed that
> pgstattuple gave very different results than my bloat-finding query.
> Reason - for some tables there are some columns that never show up in
> pg_statistics.

Hmm.  Eyeballing the ANALYZE code, I note that it will decide that it
hasn't got any valid statistics for a column if (1) it finds no NULL
values and (2) every single sampled value in the column is too wide
(more than WIDTH_THRESHOLD = 1024 bytes wide).  Does this describe your
problematic column?

It seems like the code is being too conservative here --- it could at
least generate valid values for stanullfrac and stawidth.  I'm inclined
to think maybe it should also set stadistinct = -1 ("unique") in this
case, since the basic assumption that validates ignoring very wide
values is that they aren't duplicates.

			regards, tom lane


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



view thread (2+ messages)

Message-ID: <12480.1389370514@sss.pgh.pa.us>
Permalink:  ../12480.1389370514@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12480.1389370514@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, kadri.raudsepp@nordicgaming.com, pgsql-hackers@postgresql.org
  Subject: Re: [ADMIN] Column missing from pg_statistics
  In-Reply-To: <12480.1389370514@sss.pgh.pa.us>

* 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