I have a problem. Sometimes the whole sites stucks in the middle (doesn't matter which page is opened) because of some sql issue. When i reboot postresql it starts working good immediately. But when it's stuck i can see in the log that new and new queries are running, meaning it's stuck only for my session.
What can be a reason and how can i solve this problem?
There are a lot of possible reasons, and I think you'll need to provide more details to get any accuracy on guesses from the list. Here are a few ideas:
You have a middle tier app which is failing to release cursor or other type of open query
You have a deadlock situation in Pg where you are mutually locking a row in some way that prevents your process from completing
You are executing a query that is very long running (not optimized) so your connection appears blocked but is in fact just taking forever to complete