Re: Huge shared hit for small table - Mailing list pgsql-performance

From Scott Rankin
Subject Re: Huge shared hit for small table
Date
Msg-id 3A0A0D45-BD04-4A61-96DE-22034A029CC6@motus.com
Whole thread Raw
In response to Re: Huge shared hit for small table  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: Huge shared hit for small table  (Peter Geoghegan <pg@bowt.ie>)
Re: Huge shared hit for small table  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-performance

Definitely no long-running transactions on this table; in fact, this table is pretty infrequently updated – on the order of a few tens of rows updated per day. 

 

From: Jeff Janes <jeff.janes@gmail.com>
Date: Monday, November 4, 2019 at 3:32 PM
To: Scott Rankin <srankin@motus.com>
Cc: "pgsql-performance@lists.postgresql.org" <pgsql-performance@lists.postgresql.org>
Subject: Re: Huge shared hit for small table

 

On Mon, Nov 4, 2019 at 2:38 PM Scott Rankin <srankin@motus.com> wrote:

Hello all,

 

We are trying to debug some slow performance in our production environment (Amazon RDS, Postgresql 9.6.11), and we’re looking at a particular EXPLAIN node that seems… weird.  This is a very large query involving a number of joins, but it performs pretty well in our staging environment (which has roughly the same data set as production, with a few tweaks).  However, there is one node in the EXPLAIN plan that is wildly different:

 

Could there be a long-open transaction, which is preventing hint-bits from getting on set on the table rows, as well on the index rows?

 

...

 

The tables in both environments are about the same size (18MB) and the indexes are about the same size (360kb/410kb) – and the shared hits are pretty much the same on the other nodes of the query between the two environments.

 

If this table has more turn-over than those other tables (as measured in rows, not in percentage of the table), this would not be inconsistent with my theory.

 

This has happened one time before, and we did a “REINDEX” on the program table – and that made the problem mostly go away.  Now it seems to be back, and I’m not sure what to make of it.

 

 

A reindex would not by itself fix the problem if it were the long open transaction.  But  if the long open transaction held a sufficient lock on the table, then the reindex would block until the transaction went away on its own, at which point the problem would go away on its own, so it might **appear** to have fixed the problem. 

 

Cheers,

 

Jeff

This email message contains information that Motus, LLC considers confidential and/or proprietary, or may later designate as confidential and proprietary. It is intended only for use of the individual or entity named above and should not be forwarded to any other persons or entities without the express consent of Motus, LLC, nor should it be used for any purpose other than in the course of any potential or actual business relationship with Motus, LLC. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify sender immediately and destroy the original message.

Internal Revenue Service regulations require that certain types of written advice include a disclaimer. To the extent the preceding message contains advice relating to a Federal tax issue, unless expressly stated otherwise the advice is not intended or written to be used, and it cannot be used by the recipient or any other taxpayer, for the purpose of avoiding Federal tax penalties, and was not written to support the promotion or marketing of any transaction or matter discussed herein.

pgsql-performance by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Huge shared hit for small table
Next
From: Peter Geoghegan
Date:
Subject: Re: Huge shared hit for small table