Re: Top -N Query performance issue and high CPU usage

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: yudhi s <learnerdatabase99(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Top -N Query performance issue and high CPU usage
Date: 2026-01-31 16:14:48
Message-ID: fde67103-e00e-460e-b2ec-eb539809e998@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1/31/26 05:30, yudhi s wrote:
> Hello Experts,

> This query is going to be called in the first page of an UI screen and
> is supposed to show the latest 1000 rows based on a certain transaction
> date. This query is supposed to allow thousands of users to hit this
> same query at the first landing page at the same time. Its postgres
> version 17.  The instance has 2-VCPU and 16GB RAM.

1) Without even looking at the plan I'm going to say 2-VCPU and 16GB RAM
and is insufficient resources for what you want to do.

2) You will need to provide the schema definitions for the tables involved.

4)And based on the CPU core and memory , is there any calculation by
using which , we can say that this machine can support a maximum N
number of concurrent queries of such type beyond which we need more cpu
cores machines?

You already have the beginnings of a chart:

1 session 2-3 secs

10-15 sessions 50-60% usage

40-50 sessions 90% usage

>
> Regards
> Yudhi

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message yudhi s 2026-01-31 19:39:47 Re: Top -N Query performance issue and high CPU usage
Previous Message David Mullineux 2026-01-31 14:41:18 Re: Top -N Query performance issue and high CPU usage