Thread: How to check whether table is busy or free before running the ALTERor creating TRIGGER on that table

Hi All,

We have thousands of tables. Out of these tables we have few tables. Which are busy some times. If I execute any ALTER statement or creating trigger on those tables I am unable to do it. How to check whether table is busy or free before running the ALTER/DDL or creating TRIGGER on that table in postgresql database.

--
Regards,
Raghavendra Rao J S V

On 08/21/2018 06:25 AM, Raghavendra Rao J S V wrote:
> *Hi All,*
> 
> We have thousands of tables. Out of these tables we have few tables. 
> Which are busy some times. If I execute any ALTER statement or creating 
> trigger on those tables I am unable to do it. How to check whether table 
> is busy or free before running the *ALTER/DDL *or creating *TRIGGER *on 
> that table in postgresql database.

Take a look at:

https://www.postgresql.org/docs/10/static/view-pg-locks.html

> 
> -- 
> Regards,
> Raghavendra Rao J S V
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com