Re: truncate table getting blocked

From: Jayadevan M <maymala(dot)jayadevan(at)gmail(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: truncate table getting blocked
Date: 2016-04-26 14:16:19
Message-ID: CAFS1N4gh4CGCJKunk2WZu2V2w6i0pACXTJwFXYc2GbxptnoG0Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Apr 26, 2016 at 7:25 PM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
wrote:

>
>
> It is not the "SET search_path" statement that is blocking the truncate,
> but probably some earlier statement issued in the same transaction.
>

You are right. I had a select against that table.
Adding this line fixed it ...
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)

Reference -
http://initd.org/psycopg/docs/faq.html

Thanks,
Jayadevan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-04-26 14:22:58 Re: Does frequent update of a row affects performance
Previous Message Albe Laurenz 2016-04-26 13:55:53 Re: truncate table getting blocked