Re: Insert query hangs

From: Greg Stark <stark(at)mit(dot)edu>
To: M Tarkeshwar Rao <m(dot)tarkeshwar(dot)rao(at)ericsson(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Insert query hangs
Date: 2014-07-09 14:07:22
Message-ID: CAM-w4HOa7ABvq=ncTuwP_nxZpYFHrSHOzoPh2ODKiMB-ym1S2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, Jul 9, 2014 at 1:25 PM, M Tarkeshwar Rao
<m(dot)tarkeshwar(dot)rao(at)ericsson(dot)com> wrote:
>
> I am sharing the table structure. When we removed the unique index it is working fine.
> And when created normal index(not unique) it is working fine.
>
> After removing unique index we tried to recreate it but it is giving following infinite logs :
>
> concurrent insert in progress within table "eventlogentry"
>
> caveat when building a unique index concurrently is that the uniqueness constraint

Hum, that is interesting.

So to sum up, your database works fine as long as the index isn't
present but you want to enforce this unique constraint. What version
of Postgres is this precisely (9.1.what?) Has it ever been upgraded
using pg_upgrade? Has it suffered a crash or been restored from
backups? What of Adrian Klaver's question about the database being
copied?

When you run create index you get this error? Please paste the actual
command and actual error messages. It should contain more information
than that. Try doing it with this set first:
\set VERBOSITY 'verbose'

When you're getting these errors please run select * from
pg_stat_activity and paste that information -- remove any confidential
information but leave any INSERT, UPDATE, DELETEs on the table you're
indexing with just the confidential data removed.

Also, I don't think this is right but perhaps it could be a prepared
transaction? Try "select * from pg_prepared_xacts"?

If it's really corruption --which still seems a bit odd to me-- You
might find a simple vacuum or vacuum freeze on the table fixes up the
problem.

--
greg

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-07-09 14:07:51 Re: Download Postgresql 9.4 beta for Windows is not available.
Previous Message Edson F. Lidorio 2014-07-09 13:56:59 Download Postgresql 9.4 beta for Windows is not available.

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-07-09 14:07:45 Re: tweaking NTUP_PER_BUCKET
Previous Message Amit Kapila 2014-07-09 14:05:40 Re: postgresql.auto.conf and reload