huge shared_blocks_hit one select but manually run very fast

From: James Pang <jamespang886(at)gmail(dot)com>
To: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: huge shared_blocks_hit one select but manually run very fast
Date: 2024-12-21 11:50:40
Message-ID: CAHgTRff_1mTsU-QSaDBY5k9+D-i9sV0aQeRY9ShffV=6b7jOWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message David Mullineux 2024-12-21 16:40:54 Re: huge shared_blocks_hit one select but manually run very fast
Previous Message Pavel Stehule 2024-12-20 22:00:12 Re: Re: proposal: schema variables