Re: Top -N Query performance issue and high CPU usage - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Top -N Query performance issue and high CPU usage
Date
Msg-id fde67103-e00e-460e-b2ec-eb539809e998@aklaver.com
Whole thread Raw
In response to Top -N Query performance issue and high CPU usage  (yudhi s <learnerdatabase99@gmail.com>)
Responses Re: Top -N Query performance issue and high CPU usage
List 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.klaver@aklaver.com



pgsql-general by date:

Previous
From: David Mullineux
Date:
Subject: Re: Top -N Query performance issue and high CPU usage
Next
From: yudhi s
Date:
Subject: Re: Top -N Query performance issue and high CPU usage