Re: PrepareStatement.execute() blocked because of long time 'create index' operation, connection leak

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: "jingzhi(dot)zhang(at)outlook(dot)com" <jingzhi(dot)zhang(at)outlook(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: PrepareStatement.execute() blocked because of long time 'create index' operation, connection leak
Date: 2016-06-07 11:21:10
Message-ID: CADK3HHJL0G=FMMeXG_eqEpmTTdOiXkVQJnpqvST7FiD3sAOECA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

There is a cancel statement, but I presume you want the create index to
succeed. You may have to execute the execute() in a background thread to
not block the main thread

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

On 6 June 2016 at 12:25, jingzhi(dot)zhang(at)outlook(dot)com <
jingzhi(dot)zhang(at)outlook(dot)com> wrote:

> Hi,
>
>
> I use jdbc to create index on a table, the sql of 'create index' cost
> about 30 minutes.
> Finally I found, the jdbc client thread blocked at
> PrepareStatement.execute(), not finished.
> At server side, query pg_stat_activity, the connection state already
> be ‘idle’ (index creation finished).
>
> Is there any suggestion? How to deal with the client thread blocking (read
> for a response message?) and connection leak.
>
>
> Thanks a lot.
>
>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message jingzhi.zhang@outlook.com 2016-06-07 11:36:04 Re: PrepareStatement.execute() blocked because of long time 'create index' operation, connection leak
Previous Message jingzhi.zhang@outlook.com 2016-06-06 16:25:07 PrepareStatement.execute() blocked because of long time 'create index' operation, connection leak