How to manage dataset?

When I retrieve a dataset from postgresql, I get a pandas dataframe. This df will be plot on browser using hvplot. The df is in backend or front browser? The filter action based widgets is synchronized between python and js, or only in browser if df on browser?
And connection to db should disconnect after retrieve or last in a session?