mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
Correct any db url
parent
93ae3489db
commit
d9c5d42154
2
pg.md
2
pg.md
@ -11,7 +11,7 @@ First, it has a reference to the other components of node-postgres:
|
||||
|
||||
The second purpose is more important:
|
||||
|
||||
__pg__ is an _instance_ of __EventEmitter__ which provides a somewhat naive implementation of __[[Client]]__ pooling. It has a function to retrieve __[[Client]]__ instances from a pool of available clients. You can bypass the __pg__ object all together and create __[[Client]]__ objects via their constructor (`new pg.Client()`); however, each __[[Client]]__ represents an open connection to your PostgreSQL server instance, and the initial connection handshake takes many times longer than a single query execution. Also, If you attempt to create and connect more __[[Client]]__ objects than supported connections to your PostgreSQL server you will encounter errors. This becomes especially painful if you manually instantiate a new __[[Client]]__ object per each http request to a web server. Once you receive more simultaneous requests to your web server than your PostgresSQL server can maintain you will be in a bad place...so it's recommended unless you have a particular case, use the __pg__ object to create pooled clients, build your own client pool implementation, or use https://github.com/grncdr/any-db.
|
||||
__pg__ is an _instance_ of __EventEmitter__ which provides a somewhat naive implementation of __[[Client]]__ pooling. It has a function to retrieve __[[Client]]__ instances from a pool of available clients. You can bypass the __pg__ object all together and create __[[Client]]__ objects via their constructor (`new pg.Client()`); however, each __[[Client]]__ represents an open connection to your PostgreSQL server instance, and the initial connection handshake takes many times longer than a single query execution. Also, If you attempt to create and connect more __[[Client]]__ objects than supported connections to your PostgreSQL server you will encounter errors. This becomes especially painful if you manually instantiate a new __[[Client]]__ object per each http request to a web server. Once you receive more simultaneous requests to your web server than your PostgresSQL server can maintain you will be in a bad place...so it's recommended unless you have a particular case, use the __pg__ object to create pooled clients, build your own client pool implementation, or use https://github.com/grncdr/node-any-db.
|
||||
|
||||
* Methods
|
||||
* [[connect|pg#wiki-method-connect]]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user