Re: Query runs on 9.2, but not on 9.4

From: John Scalia <jayknowsunix(at)gmail(dot)com>
To: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Query runs on 9.2, but not on 9.4
Date: 2015-08-05 14:18:33
Message-ID: CABzCKRByBmFVnz8rHcLVJ4HsMSjc4yp_=72hOf1VJKLeyfykTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks guys!! That definitely solved the issue!

On Wed, Aug 5, 2015 at 9:16 AM, Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
wrote:

> On Aug 5, 2015, at 7:56 AM, John Scalia <jayknowsunix(at)gmail(dot)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(at)elevated-dev(dot)com
> http://www.elevated-dev.com/
> https://www.linkedin.com/in/scottribe/
> (303) 722-0567 voice
>
>
>
>
>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message John Scalia 2015-08-05 22:00:22 pg_basebackup problem...
Previous Message Tom Lane 2015-08-05 14:17:55 Re: Query runs on 9.2, but not on 9.4