I have a database which I cannot delete (the same for rename):
# psql -d template1 =# drop database xxx; ERROR: database "xxx" is being accessed by other users
But it is NOT accessed by anybody, because: 1. ps ax|grep post shows that there is NO active connections to database xxx; 2. I restarter postmaster and immediately try to delete the database - the same error message 3. I stopped web-server, and now it is GUARANTEED that there is no connections :-)
What other diagnostics could I do?
P. S. This database has other stranges, like: 1. VALUUM FULL VERBOSE ANALYZE hands at the middle of this database and never stops its execution; 2. there are some problems when I create a foreign key to particular table: it also hangs (postmaster restart does not correct this) 3. database is 2-3 times slow than it could be (if I restore it from the backup to the new place, it works 2-3 times faster)
Practically I have already dump+restore this database to a new location (xxx_new) and work with it only, but I want to remove the old (broken?) database xxx and I cannot...