3 deleted 18 characters in body
source | link

If you want to see how many idle connections you have that have an open transaction, you could use:

select * 
from pg_stat_activity
where (state = 'idle' or state = 'idle in transaction')
    and xact_start is not null;

This will provide a list of open connections that are in the idle state, that also have an open transaction.

Having said that, I cannot recreate an open connection in the idle state that has an open transaction. Perhaps someone else can provide details on how to do that.

If you want to see how many idle connections you have that have an open transaction, you could use:

select * 
from pg_stat_activity
where (state = 'idle' or state = 'idle in transaction')
    and xact_start is not null;

This will provide a list of open connections that are in the idle state, that also have an open transaction.

Having said that, I cannot recreate an open connection in the idle state that has an open transaction. Perhaps someone else can provide details on how to do that.

If you want to see how many idle connections you have that have an open transaction, you could use:

select * 
from pg_stat_activity
where (state = 'idle in transaction')
    and xact_start is not null;

This will provide a list of open connections that are in the idle state, that also have an open transaction.

Having said that, I cannot recreate an open connection in the idle state that has an open transaction. Perhaps someone else can provide details on how to do that.

2 added 35 characters in body
source | link

If you want to see how many idle connections you have that have an open transaction, you could use:

select * 
from pg_stat_activity
where (state = 'idle' or state = 'idle in transaction')
    and xact_start is not null;

This will provide a list of open connections that are in the idle state, that also have an open transaction.

Having said that, I cannot recreate an open connection in the idle state that has an open transaction. Perhaps someone else can provide details on how to do that.

If you want to see how many idle connections you have that have an open transaction, you could use:

select * 
from pg_stat_activity
where state = 'idle'
    and xact_start is not null;

This will provide a list of open connections that are in the idle state, that also have an open transaction.

Having said that, I cannot recreate an open connection in the idle state that has an open transaction. Perhaps someone else can provide details on how to do that.

If you want to see how many idle connections you have that have an open transaction, you could use:

select * 
from pg_stat_activity
where (state = 'idle' or state = 'idle in transaction')
    and xact_start is not null;

This will provide a list of open connections that are in the idle state, that also have an open transaction.

Having said that, I cannot recreate an open connection in the idle state that has an open transaction. Perhaps someone else can provide details on how to do that.

1
source | link

If you want to see how many idle connections you have that have an open transaction, you could use:

select * 
from pg_stat_activity
where state = 'idle'
    and xact_start is not null;

This will provide a list of open connections that are in the idle state, that also have an open transaction.

Having said that, I cannot recreate an open connection in the idle state that has an open transaction. Perhaps someone else can provide details on how to do that.