pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Ribe <scott_ribe@elevated-dev.com>
To: John Scalia <jayknowsunix@gmail.com>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: Query runs on 9.2, but not on 9.4
Date: Wed, 5 Aug 2015 08:16:40 -0600
Message-ID: <26BEAB1A-1F90-4850-AE95-99E9CA1CDD37@elevated-dev.com> (raw)
In-Reply-To: <CABzCKRByML4pr5cW373d0vNm-rN-hrt+eda97i2fnEA75qi5HQ@mail.gmail.com>
References: <CABzCKRByML4pr5cW373d0vNm-rN-hrt+eda97i2fnEA75qi5HQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

On Aug 5, 2015, at 7:56 AM, John Scalia <jayknowsunix@gmail.com> wrote:
> 
> SELECT
> c.relname,
> pg_size_pretty(count(*) * 8192) as buffered,
> round(100.0 * count(*) /
> (SELECT setting FROM pg_settings
> WHERE name='shared_buffers')::integer,1)
> AS buffers_percent,
> round(100.0 * count(*) * 8192 /
> pg_relation_size(c.oid),1)
> AS percent_of_relation
> FROM pg_class c
> INNER JOIN pg_buffercache b
> ON b.relfilenode = c.relfilenode
> INNER JOIN pg_database d
> ON (b.reldatabase = d.oid AND d.datname = current_database())
> GROUP BY c.oid,c.relname
> ORDER BY 3 DESC
> LIMIT 25;

So, the first thing I would do is change:

> round(100.0 * count(*) /
> (SELECT setting FROM pg_settings
> WHERE name='shared_buffers')::integer,1)

to:

> (SELECT setting FROM pg_settings
> WHERE name='shared_buffers')::integer,1)

and change:

> round(100.0 * count(*) * 8192 /
> pg_relation_size(c.oid),1)

to:

> pg_relation_size(c.oid),1)

Then look for 0s in those output columns. I'll bet that the 9.4 vs 9.2 difference is simply a value of 0 for one of those, not some exotic thing about the query plan. If I'm right about that, then you can start hunting down a specific explanation.

-- 
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice







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



view thread (5+ messages)  latest in thread

Message-ID: <26BEAB1A-1F90-4850-AE95-99E9CA1CDD37@elevated-dev.com>
Permalink:  ../26BEAB1A-1F90-4850-AE95-99E9CA1CDD37@elevated-dev.com/
Also on:    postgresql.org/message-id/26BEAB1A-1F90-4850-AE95-99E9CA1CDD37@elevated-dev.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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scott_ribe@elevated-dev.com, jayknowsunix@gmail.com
  Subject: Re: Query runs on 9.2, but not on 9.4
  In-Reply-To: <26BEAB1A-1F90-4850-AE95-99E9CA1CDD37@elevated-dev.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