Thread: Alter table command is pretty slow

Alter table command is pretty slow

From
Sreenivas K
Date:
Hi,

I have installed the PostgreSQL native Windows (8.0 using the Windows
MSI installer) on a Windows 2K box.  I accepted all of the
installation defaults.  It is running successfully  and my application
that stores data via Hibernate 2.0 is working. But it is taking too
long [>15 mimutes] if I try to execute any DDL commands . I Issued
vacuum command just before running a DDL. My computer has 512 MB of
RAM.  Why is it so slow?

Any help would be great.
Thanks in advance

Re: Alter table command is pretty slow

From
Chris Browne
Date:
sreenivas@gmail.com (Sreenivas K) writes:
> I have installed the PostgreSQL native Windows (8.0 using the Windows
> MSI installer) on a Windows 2K box.  I accepted all of the
> installation defaults.  It is running successfully  and my application
> that stores data via Hibernate 2.0 is working. But it is taking too
> long [>15 mimutes] if I try to execute any DDL commands . I Issued
> vacuum command just before running a DDL. My computer has 512 MB of
> RAM.  Why is it so slow?
>
> Any help would be great.

You might want to look at pg_stat_activity (assuming activity logging
is turned on) as well as pg_locks.

DDL commands require exclusive locks on the tables that they are
modifying, and *anything* else that may be touching the tables will
block the DDL commands.

VACUUM will definitely block DDL...

At any rate, pg_stat_activity can tell you what queries are busy in
the system.  And pg_locks will tell you what relations are in what
states.  (You'll need to join pg_locks against pg_class in order to
get relation names.)
--
(format nil "~S@~S" "cbbrowne" "acm.org")
http://www.ntlug.org/~cbbrowne/sap.html
Rules of the Evil Overlord #78.  "I will not tell my Legions of Terror
"And he must  be taken alive!" The command will be:  ``And try to take
him alive if it is reasonably practical.''"
<http://www.eviloverlord.com/>