public inbox for [email protected]  
help / color / mirror / Atom feed
From: David Mullineux <[email protected]>
To: James Pang <[email protected]>
Cc: [email protected]
Subject: Re: huge shared_blocks_hit one select but manually run very fast
Date: Sat, 21 Dec 2024 16:40:54 +0000
Message-ID: <CAGsyd8U0cgD=2wTG5HAsbs=e=9ynz3r55tH56xzQeUQYju94Yw@mail.gmail.com> (raw)
In-Reply-To: <CAHgTRff_1mTsU-QSaDBY5k9+D-i9sV0aQeRY9ShffV=6b7jOWQ@mail.gmail.com>
References: <CAHgTRff_1mTsU-QSaDBY5k9+D-i9sV0aQeRY9ShffV=6b7jOWQ@mail.gmail.com>

Depends on a lot of thongs...Visibility map sounds like it's impacted here.
Are your inserts towards the index (like a monotonically increasing serial
id)  or scattered around the index values ?   How big is the table  index
and shared buffers ?   An example would really help

On Sat, 21 Dec 2024, 11:51 James Pang, <[email protected]> wrote:

> Hi,
>    we have a simple select .... from table where ... (that mache the
> index) , table has 80million rows.  when many application sessions run the
> query and at the same time some other sessions doing insert into ... this
> table. from pg_stat_statements, shared_blks_hit show 31652 / per call.   we
> see very high cpu almost 100% cpu during application workload test, and
> high LWLock BufferMapping waiting for these querys.  But manually run the
> sql show only 2148 shared_blks_hit/ per call.  this is a simple sql, from
> pg_profile we did see it use same index scan as manually running.  What
> could be possible reason leading so big difference with shared_blks_hit ?
>  PGv14.8
>
> Thanks,
>
> James
>


view thread (4+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: huge shared_blocks_hit one select but manually run very fast
  In-Reply-To: <CAGsyd8U0cgD=2wTG5HAsbs=e=9ynz3r55tH56xzQeUQYju94Yw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox