Litao Wu <litaowu@yahoo.com> writes:
> We often experience with the problem that reindex
> cannot be finished in our production database.
> It's typically done with 30 minutes. However,
> sometimes, when there is another "COPY" process,
> reindex will not finish. By monitoring the CPU
> time reindex takes, it does not increase at all.
> That seems a deadlock.
There is no deadlock visible in your report: the reindex process is not
waiting for a lock, according to either ps or pg_locks. You sure it's
not just slow? I'd expect reindex to be largely I/O bound, so the lack
of CPU activity doesn't prove much.
If you think it's actually stuck waiting for something, try attaching to
the REINDEX backend process with gdb to get a stack trace. That would
at least give some idea what it's waiting for.
regards, tom lane