Note that there are some explanatory texts on larger screens.

plurals
  1. POtrying to understand postgresql via php database connection sharing
    primarykey
    data
    text
    <p>To say I am new to PostgreSQL is an understatement. As such I have spent a great deal of time in the last couple of days going over the various manuals at <a href="http://www.php.net/manual/en/ref.pgsql.php" rel="nofollow">http://www.php.net/manual/en/ref.pgsql.php</a> and at <a href="http://www.postgresql.org/docs/9.1/interactive/index.html" rel="nofollow">http://www.postgresql.org/docs/9.1/interactive/index.html</a> .</p> <p>Short form of my question:</p> <p>Do different users (logged in from separate IP addresses) utilize the same connection to a PostgreSQL data base behind the scenes?</p> <p>Long form of the question:</p> <p>In a given php script the database connection <code>$connection</code> is defined near the very beginning of script. That connection is then used throughout the rest of the script via <code>$GLOBALS['connection']</code>. Thus in that script a given user simply reuses the same connection over and over again.</p> <p>A second user using the same script while logging in from a different location also uses a single copy of the connection.</p> <p>From the manual (at <a href="http://www.php.net/manual/en/function.pg-connect.php" rel="nofollow">http://www.php.net/manual/en/function.pg-connect.php</a>):</p> <p><code>If a second call is made to pg_connect() with the same connection_string as an existing connection, the existing connection will be returned unless you pass PGSQL_CONNECT_FORCE_NEW as connect_type.</code></p> <p>So, does this mean that both users are sharing the same connection (unless the <code>PGSQL_CONNECT_FORCE_NEW</code> flag is sent)?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload