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.

43 line
5.0KB

  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>22.1. Overview</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="managing-databases.html" title="Chapter 22. Managing Databases" /><link rel="next" href="manage-ag-createdb.html" title="22.2. Creating a Database" /></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">22.1. Overview</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="managing-databases.html" title="Chapter 22. Managing Databases">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="managing-databases.html" title="Chapter 22. Managing Databases">Up</a></td><th width="60%" align="center">Chapter 22. Managing Databases</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="manage-ag-createdb.html" title="22.2. Creating a Database">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="MANAGE-AG-OVERVIEW"><div class="titlepage"><div><div><h2 class="title" style="clear: both">22.1. Overview</h2></div></div></div><a id="id-1.6.9.4.2" class="indexterm"></a><p>
  3. A small number of objects, like role, database, and tablespace
  4. names, are defined at the cluster level and stored in the
  5. <code class="literal">pg_global</code> tablespace. Inside the cluster are
  6. multiple databases, which are isolated from each other but can access
  7. cluster-level objects. Inside each database are multiple schemas,
  8. which contain objects like tables and functions. So the full hierarchy
  9. is: cluster, database, schema, table (or some other kind of object,
  10. such as a function).
  11. </p><p>
  12. When connecting to the database server, a client must specify in
  13. its connection request the name of the database it wants to connect
  14. to. It is not possible to access more than one database per
  15. connection. However, an application is not restricted in the number of
  16. connections it opens to the same or other databases. Databases are
  17. physically separated and access control is managed at the
  18. connection level. If one <span class="productname">PostgreSQL</span> server
  19. instance is to house projects or users that should be separate and
  20. for the most part unaware of each other, it is therefore
  21. recommended to put them into separate databases. If the projects
  22. or users are interrelated and should be able to use each other's
  23. resources, they should be put in the same database but possibly
  24. into separate schemas. Schemas are a purely logical structure and who can
  25. access what is managed by the privilege system. More information about
  26. managing schemas is in <a class="xref" href="ddl-schemas.html" title="5.9. Schemas">Section 5.9</a>.
  27. </p><p>
  28. Databases are created with the <code class="command">CREATE DATABASE</code> command
  29. (see <a class="xref" href="manage-ag-createdb.html" title="22.2. Creating a Database">Section 22.2</a>) and destroyed with the
  30. <code class="command">DROP DATABASE</code> command
  31. (see <a class="xref" href="manage-ag-dropdb.html" title="22.5. Destroying a Database">Section 22.5</a>).
  32. To determine the set of existing databases, examine the
  33. <code class="structname">pg_database</code> system catalog, for example
  34. </p><pre class="synopsis">
  35. SELECT datname FROM pg_database;
  36. </pre><p>
  37. The <a class="xref" href="app-psql.html" title="psql"><span class="refentrytitle"><span class="application">psql</span></span></a> program's <code class="literal">\l</code> meta-command
  38. and <code class="option">-l</code> command-line option are also useful for listing the
  39. existing databases.
  40. </p><div class="note"><h3 class="title">Note</h3><p>
  41. The <acronym class="acronym">SQL</acronym> standard calls databases <span class="quote">“<span class="quote">catalogs</span>”</span>, but there
  42. is no difference in practice.
  43. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="managing-databases.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="managing-databases.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="manage-ag-createdb.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 22. Managing Databases </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 22.2. Creating a Database</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1