Understand Unix Socket vs TCP Socket modes
mainpy-pglite supports two connection modes:
Unix Socket Mode (Default)
- Best for: Local testing and maximum performance.
- Mechanism: Uses Unix domain sockets.
- Note: Fastest for local testing.
TCP Socket Mode
- Best for:
asyncpgcompatibility, cloud-native testing, Docker containers with network isolation, and testing network-based tools. - Mechanism: Binds to a TCP port (defaults to
127.0.0.1:5432). - Requirement:
asyncpgrequires TCP mode.
Important Constraints:
- PGlite Socket supports only one active connection at a time.
- SSL is not supported; always use
sslmode=disable. - TCP mode binds to
localhostby default for security.