49

Is there any danger running /etc/init.d/postgresql restart?? We just had an incident where some relations "disappeared" and I ran the said command. Just got bollocked by the sysadmin, however he did not justify why this was a bad thing to do. I did put the webapp in maintenance mode so there wasn't any transactions/ queries going on at the time.


Thanks guys... So in short it wont damage anything but it could loose lots of valuable diagnostic info.

2
  • 1
    Do you mean "he did not justify"? Commented Sep 1, 2010 at 17:27
  • 15
    Also, small note. On most systems the command is /etc/init.d/postgresql restart Commented Jan 2, 2013 at 17:52

3 Answers 3

49

No, there is no danger of restarting postgres using the init.d method.

However, to restart it because something weird happened is not a good idea, because it limits severely the amount of information you can collect to find the root cause and limits opportunities to fix it.

Also in all the years I have been involved with postgresql, I never encountered a situation in which a restart "fixed" the problem. The immediate 'incident' might be resolved but if there's a problem, it will still be there.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. I knew it wouldn't fix the route problem but sysadmin was unavailable and the clients wanted their site back up.
You might want to keep a close eye on it and/or write a script which regularly checks if the error condition reappears so you have more time next time to do gather data and fix the problem before the customer calls.
5

The only way relations would disappear on a restart of Postgres, would be if they were temp tables or created relations within an open transaction. When the db restarts it would close all connections and thus all temp tables would be dropped and open transactions would be rolled back. But anything that was committed would be safe from a restart.

Comments

4

Relations don't disappear because of a restart, you might loose some running transactions, but that's it. PostgreSQL does not destroy your database when it restarts, don't worry.

Comments

Your Answer

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.