pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: bakkiya <bakkiya@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Postgres problem with partition queries
Date: Wed, 01 Dec 2010 09:35:06 -0500
Message-ID: <15222.1291214106@sss.pgh.pa.us> (raw)
In-Reply-To: <1291182677403-3287234.post@n5.nabble.com>
References: <1291182677403-3287234.post@n5.nabble.com>

bakkiya <bakkiya@gmail.com> writes:
> We are having a partition table and we are querying some rows in the
> partition.
> select * from events where 
> 	 events.evt_time >= '2010-11-29 00:00:00'
> 	AND events.evt_time <= '2010-11-30 23:59:59' 
> While this query is in running state, I am issuing a drop statement on a
> partition of this table.
> [ and it blocks ]

This is hardly surprising.  A query on the inheritance tree has to
take AccessShare lock on every member table, because it has to inspect
each table to determine whether it should scan it.  So it's going to
conflict with the exclusive lock needed to drop one of the tables.
That means first that the DROP gets blocked by a pre-existing query,
and second that the waiting DROP also blocks other queries of the same
kind.

			regards, tom lane



view thread (2+ messages)

Message-ID: <15222.1291214106@sss.pgh.pa.us>
Permalink:  ../15222.1291214106@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15222.1291214106@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bakkiya@gmail.com
  Subject: Re: Postgres problem with partition queries
  In-Reply-To: <15222.1291214106@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox