db_postgres document how to use it with unix socket (#15187)
This commit is contained in:
parent
ba042af9cc
commit
c9fdad2c21
1 changed files with 22 additions and 2 deletions
|
|
@ -37,6 +37,26 @@
|
|||
## VALUES ($1, $2, $3)""",
|
||||
## 3)
|
||||
##
|
||||
##
|
||||
## Unix Socket
|
||||
## ===========
|
||||
##
|
||||
## Using Unix sockets instead of TCP connection can
|
||||
## `improve performance up to 30% ~ 175% for some operations <https://momjian.us/main/blogs/pgblog/2012.html#June_6_2012>`_.
|
||||
##
|
||||
## To use Unix sockets with `db_postgres`, change the server address to the socket file path:
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
## import db_postgres ## Change "localhost" or "127.0.0.1" to the socket file path
|
||||
## let db = db_postgres.open("/run/postgresql", "user", "password", "database")
|
||||
## echo db.getAllRows(sql"SELECT version();")
|
||||
## db.close()
|
||||
##
|
||||
## The socket file path is operating system specific and distribution specific,
|
||||
## additional configuration may or may not be needed on your `postgresql.conf`.
|
||||
## The Postgres server must be on the same computer and only works for Unix-like operating systems.
|
||||
##
|
||||
##
|
||||
## Examples
|
||||
## ========
|
||||
##
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue