3

I am using Cloudera Manager to monitor and configure Hadoop. I choose PostgreSQL as metastore of HUE - a web portal to submit your SQL to Hadoop.

When I submit a SQL, the HUE says the database is locked. I don't have any database management experience.

So, how to find the root cause and diagnose?

I try to connect to the database postgres which I believe this is the meta-database of PostgreSQL itself. I expect I can find the processes, events and lock information in this database.

postgres=> \c postgres
Password for user hue:
You are now connected to database "postgres" as user "hue".
postgres=> \d
No relations found.
postgres=>

I connect to this database - 'postgres' as user - 'HUE'. But I didn't find any tables under it. Am I using the wrong user?

How can I access this database successfully? How can I discover why the database is locked? Where is it locked? On which table and which database?

ypercubeTM
99.7k13 gold badges217 silver badges306 bronze badges
asked May 16, 2016 at 4:55
1
  • Read on the Postgres documentation online: Lock Monitoring Commented May 16, 2016 at 11:06

1 Answer 1

3

Your software is most likely not using the default postgres database (that is a database that is normally reserved only to store the list of databases, users, and other globals).

From psql, run \l to list the available databases. Your database will be something other than postgres, template0, or template1. Try connecting to one that is not one of the above (\c dbname) and then run \d again to list tables.

answered May 16, 2016 at 5:04
4
  • Thanks. I know the user database should not be postgres, template0, template1. What I want to know is how to analysis deadlock problem. I believe that I can get some informations from some system databases and tables about the dead lock. Commented May 16, 2016 at 7:11
  • With PgAdmin3, menu Tools / Server Status, you can see what's going on and what statement is locking which resources and/or other statements, refreshed periodically. Commented May 16, 2016 at 7:33
  • I can see the real time deadlock through the tool/server status, how can I know how many dead locks in the history? Commented May 18, 2016 at 1:50
  • @cdhit you can't, deadlocks are not (normally, or AFAIK not at all possibly) logged. Have a look at this, or see what you find googling "postgresql log deadlock" Commented May 18, 2016 at 2:27

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.