The session will not drop. The query will not hang. Your remote database tools should work as fast and reliably as your local ones.
Mosh and pgcli together make that happen. Mosh (“mobile shell”) is a remote terminal application designed for persistent, low-latency sessions over unstable networks. Pgcli is an interactive PostgreSQL client with autocompletion, syntax highlighting, and faster workflows than psql. Combining them creates a powerful, resilient way to work with Postgres databases from anywhere, over any connection.
Mosh maintains a constant process, even if your IP changes or your connection drops for a moment. Traditional SSH sessions die when the network wavers. With mosh, you reconnect instantly and pick up exactly where you left off. No re-login. No broken pipelines.
Pgcli adds intelligent command-line tooling. Autocomplete for table names, column names, and keywords. Syntax highlighting for complex queries. Inline previews for query results. You move faster without switching context.
To use mosh with pgcli:
Connect through mosh: