gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
4.2KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>50.2. How Connections Are Established</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="query-path.html" title="50.1. The Path of a Query" /><link rel="next" href="parser-stage.html" title="50.3. The Parser Stage" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">50.2. How Connections Are Established</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="query-path.html" title="50.1. The Path of a Query">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="overview.html" title="Chapter 50. Overview of PostgreSQL Internals">Up</a></td><th width="60%" align="center">Chapter 50. Overview of PostgreSQL Internals</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="parser-stage.html" title="50.3. The Parser Stage">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="CONNECT-ESTAB"><div class="titlepage"><div><div><h2 class="title" style="clear: both">50.2. How Connections Are Established</h2></div></div></div><p>
  3. <span class="productname">PostgreSQL</span> is implemented using a
  4. simple <span class="quote">“<span class="quote">process per user</span>”</span> client/server model. In this model
  5. there is one <em class="firstterm">client process</em> connected to
  6. exactly one <em class="firstterm">server process</em>. As we do not
  7. know ahead of time how many connections will be made, we have to
  8. use a <em class="firstterm">master process</em> that spawns a new
  9. server process every time a connection is requested. This master
  10. process is called <code class="literal">postgres</code> and listens at a
  11. specified TCP/IP port for incoming connections. Whenever a request
  12. for a connection is detected the <code class="literal">postgres</code>
  13. process spawns a new server process. The server tasks
  14. communicate with each other using <em class="firstterm">semaphores</em> and
  15. <em class="firstterm">shared memory</em> to ensure data integrity
  16. throughout concurrent data access.
  17. </p><p>
  18. The client process can be any program that understands the
  19. <span class="productname">PostgreSQL</span> protocol described in
  20. <a class="xref" href="protocol.html" title="Chapter 52. Frontend/Backend Protocol">Chapter 52</a>. Many clients are based on the
  21. C-language library <span class="application">libpq</span>, but several independent
  22. implementations of the protocol exist, such as the Java
  23. <span class="application">JDBC</span> driver.
  24. </p><p>
  25. Once a connection is established the client process can send a query
  26. to the <em class="firstterm">backend</em> (server). The query is transmitted using plain text,
  27. i.e., there is no parsing done in the <em class="firstterm">frontend</em> (client). The
  28. server parses the query, creates an <em class="firstterm">execution plan</em>,
  29. executes the plan and returns the retrieved rows to the client
  30. by transmitting them over the established connection.
  31. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="query-path.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="overview.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="parser-stage.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">50.1. The Path of a Query </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 50.3. The Parser Stage</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1