pgAdmin restoring previous environment - postgresql

How long does it takes before pgAdmin III wake up after "Restoring previous environment..."? I was able to connect within 5-10 seconds but today it takes more than 15 minutes, after I double click on previously stored connection in object inspector. I did nothing with server, but my associate says he added new test database today, and tried to restore there one of previously stored databases. I have a Java application and it able to connect. I find some old info about similar issue but not find any helpful solution. What can I do to connect through pgAdmin? Just wait?

Related

Why are there always at least 10 sessions for a postgreSQL database? Why can't they be terminated?

Original aim: rename a database using ALTER DATABASE via psql.
Problem: rename fails due to other sessions accessing target database. ・All terminals/applications I am aware of have been closed.
・querying pg_stat_activity shows that there are 10 processes(=sessions?) accessing the db.・The username for each session is the same user I have been using for psql and for some local phoenix and django apps. The client_addr is also local host for all of them.
・When I use pg_terminate_backend, on any of the pids, another process gets immediately spawned.
・After restarting my pc, 10 processes are again spawned.
Concern: As I can't account for these 10 processes that I can't get rid of, I think I'm misunderstanding how postgres works somewhere.
Question: Why do 10 session/processes connected to a particular one of my databases, and why can't I terminate them using pg_terminate_backend?
Note: In the phoenix project I set up recently, I set the and set the pool_size of the Repo config to 10 - which makes me think it's related...but I'm pretty sure that project isn't running in any way.
Update - Solved
As a_horse_with_no_name suggested, the by doing the following I was able to put a stop to the 10 mystery sessions.
(1) prevent login of user responsible for the sessions (identifiable by querying `pg_stat_activity`), by doing `alter user .... with nologin`
(2)-running pg_terminate_backend on each of the session's pids.
After those steps I was able to change the table name.
The remaining puzzle is, how did those sessions get in that status in the first place... from the contents of pg_stat_activity, the wait_event value for each was clientRead.
From this post, it seems that the application may have been forcibly stopped halfway through a transaction or something, leaving postgres hanging.

Stymied by idle_in_transaction_session_timeout

Immediate problem: When I do a pgAdmin 4 restore I get "Stymied by idle_in_transaction_session_timeout" error.
I am on a MacBook Pro running macOS Mojave version 10.14.5, using Java and PostgreSQL. I use the pgAdmin 4 GUI, as I am not proficient in psql, bash, etc. I have a test database named pg2. As you can see from the attachment, PostgreSQL servers 9.4 and 10 have the identical databases. If I make a change in a database on one server, it will show also in the other server’s database. There is a third server, 11, in which there is only the postgres database.
I have tried psql and get errors (including timeout errors).
I have tried to Delete/Drop server 11, it will disappear but when I sign out of pgAdmin 4 and then go into pgAdmin 4 again the server 11 will be there again.
See the attachments for screen shots.
I expect the backup/restore to work: backup, then make a change to the database, then correctly restore to previous state.
I would like to have just one server, preferably 11 with only pg1 and the test db tempdb running in it. I thought that I could live with the three, for I am aware of my current capabilities and thus did not want to screw things up further. However, I suspect that the two servers 9.4 and 10 are the source of my current problem: receiving the idle_in_transaction_session_timeout error while doing a restore. Note: I did the backup using the server 10’s pg1 backup. Did it create 2 backups, one for 9.4 and one for 10?
I tried to attach these before. They will help make sense of my problem.
The 2 servers have the same database; is this causing the idle in transaction session timeout?

PostgreSQL connection issue

I am new to PostgreSQL and I am trying to create a connection but I don't know for some reason my connection is not being established.
At first it said that cant hear the server so whenever I go in to task manager and try to run Postgres servers it says "THE SYSTEM CAN NOT FIND THE FILE SPECIFIED" so I tried to remove Postgres completely from the system but it not completely uninstalling it from my laptop. I think its just remaining some instances in to my laptop which is not letting it to uninstall completely.
please find the IMAGE here -> click here
I have attached the image above. Please see that. I have deleted every Postgress thing from my laptop but I think there is still some left in the laptop that is why it is showing this in the services.

Downloading a Google Cloud SQL Backup

I'm running an instance of Google Cloud SQL. A CMS connects to this and updates it. Then there are several replications that run websites. Someone using the CMS deleted a page by accident. There's a backup from 12 hours ago, but I don't want to restore to that backup because the replications will be off with all the other changes that have been made. I just want to grab the SQL dump of that backup so I can scrounge out one page and restore that content. But, I don't see any way to do this, the only options in the Google Cloud SQL Console are to Delete or Restore a backup. Is there any way to download a backup?
You can restore the backup to a different instance. Create a new instance with the same database version, then click restore on the old instance backup and pick the new instance as the target. Once the restore is complete, you can connect to the new instance and retrieve the content you are interested in.

How to change PostgreSQL Studio's inactivity timeout?

I want to increase PostgreSQL's Studio login/session time out time. When I leave PostgreSQL Studio to idle just for some time, I get the following message:
You have been logged out due to inactivity. Please relogin or exit.
I am using PostgreSQL from BigSQL 5.0.3 package bundle. Actually, I am researching about compability of MS SQL Server and PostgreSQL queries.
As I am using Postgres now for learning purpose rather than security, I feel it annoying to login frequently.
How can I increase the login/session timeout inside PostgreSQL Studio?
Postgres itself doesn't have an idle connection timeout. This is coming from something else.
Unfortunately, the timeout value is hard-coded to 30 minutes in PostgreSQL Studio. You should only see that if you are not using Studio at all for 30 minutes. Its a pretty simple matter to move that property to the config file so it can be changed. We just need to write a patch.
The timeout is to prevent Studio from holding open idle connections to PostgreSQL. PostgreSQL Studio uses connection pooling to manage connections back to the database so if the browser connection goes away without logging out, we need a way to remove those connections.