Re: Many-to-many performance problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rowan Seymour <rowanseymour(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Many-to-many performance problem
Date: 2016-06-10 14:13:45
Message-ID: 22656.1465568025@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Rowan Seymour <rowanseymour(at)gmail(dot)com> writes:
> Most of time, this query performs like https://explain.depesz.com/s/ksOC
> (~15ms). It's no longer using the using the msgs_inbox index, but it's
> plenty fast. However, sometimes it performs like
> https://explain.depesz.com/s/81c (67000ms)
> And if you run it again, it'll be fast again.

It looks like everything is fine as long as all the data the query needs
is already in PG's shared buffers. As soon as it has to go to disk,
you're hurting, because disk reads seem to be taking ~10ms on average.

> Server is an Amazon RDS instance with default settings and Postgres 9.3.10,

And I think you just explained your problem. Did you spring for adequate
guaranteed IOPS on this instance? If not, you need to, or else live with
erratic performance. If you did, you have a beef to raise with AWS that
you're not getting the performance you paid for.

You might be able to ameliorate matters by raising shared_buffers, but
unless your database isn't growing that approach has limited future.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Yves Dorfsman 2016-06-10 14:27:12 Re: Many-to-many performance problem
Previous Message Rowan Seymour 2016-06-10 13:04:01 Many-to-many performance problem