Thread: idle transactions vs memory
Hi, I have a basic query that do idle transactions (idle more than 5 minutes) occupy system memory (RAM) or CPU usage ? Please help me. Regards, Atul
On Sunday, December 6, 2020, Atul Kumar <akumar14871@gmail.com> wrote:
Hi,
I have a basic query that do idle transactions (idle more than 5
minutes) occupy system memory (RAM) or CPU usage ?
Please help me.
Help you what? Queries don’t idle so I don’t even know what you are looking at. But, generally, long-lived idle in transaction session are bad for many reasons and you should fix your application code to avoid them.
David J.
On 12/6/20 8:29 PM, Atul Kumar wrote: > Hi, > > I have a basic query that do idle transactions (idle more than 5 > minutes) occupy system memory (RAM) or CPU usage ? > > > Please help me. Whether or not they occupy RAM or use CPU, idle transactions violate one of the fundamental rules of database programming: keep transactions short! -- Angular momentum makes the world go 'round.
> On Dec 6, 2020, at 7:29 PM, Atul Kumar <akumar14871@gmail.com> wrote: > > I have a basic query that do idle transactions (idle more than 5 > minutes) occupy system memory (RAM) or CPU usage ? Actual idle transaction? Or just idle connections not currently in transactions?
Hi, The transactions state is 'idle' from more than 15 minutes, so my question is that are they occupying any amount of RAM? are these 'idle' transactions are using CPU ? Please help me. Regards, Atul On 12/7/20, Scott Ribe <scott_ribe@elevated-dev.com> wrote: >> On Dec 6, 2020, at 7:29 PM, Atul Kumar <akumar14871@gmail.com> wrote: >> >> I have a basic query that do idle transactions (idle more than 5 >> minutes) occupy system memory (RAM) or CPU usage ? > > Actual idle transaction? Or just idle connections not currently in > transactions? > >
On Sunday, December 6, 2020, Atul Kumar <akumar14871@gmail.com> wrote:
Hi,
The transactions state is 'idle' from more than 15 minutes, so my
question is that are they occupying any amount of RAM?
are these 'idle' transactions are using CPU ?
Sessions and transactions are two different things.
Yes, idle sessions consume a non-zero amount of resources.
David J.
On Mon, 2020-12-07 at 11:04 +0530, Atul Kumar wrote: > The transactions state is 'idle' from more than 15 minutes, so my > question is that are they occupying any amount of RAM? > > are these 'idle' transactions are using CPU ? They are not using any CPU, and they are using very little RAM. They make starting a query (taking a snapshot) a little slower, but you probably won't notice that. Their biggest danger is that there is no guarantee that they remain idle, and if you have too many active sessions, your database might have more work than it can handle. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com