DWS DEV 830.201 version

Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
This commit is contained in:
Lu, Huayi 2024-05-16 07:24:04 +00:00 committed by zuul
parent 57dcff6915
commit e6fa411af0
1311 changed files with 93310 additions and 63069 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,15 @@
<a name="EN-US_TOPIC_0000001146360933"></a><a name="EN-US_TOPIC_0000001146360933"></a> <a name="EN-US_TOPIC_0000001233761831"></a><a name="EN-US_TOPIC_0000001233761831"></a>
<h1 class="topictitle1">Using DSC to Migrate SQL Scripts</h1> <h1 class="topictitle1">Using DSC to Migrate SQL Scripts</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_p316010150300">The DSC is a CLI tool running on the Linux or Windows OS. It is dedicated to providing customers with simple, fast, and reliable application SQL script migration services. It parses the SQL scripts of source database applications using the built-in syntax migration logic, and converts them to SQL scripts applicable to GaussDB(DWS) databases. You do not need to connect the DSC to a database. It can migrate data in offline mode without service interruption. In GaussDB(DWS), you can run the migrated SQL scripts to restore the database, thereby easily migrating offline databases to the cloud.</p> <div id="body8662426"><p id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_p316010150300">The DSC is a CLI tool running on the Linux or Windows OS. It is dedicated to providing customers with simple, fast, and reliable application SQL script migration services. It parses the SQL scripts of source database applications using the built-in syntax migration logic, and converts them to SQL scripts applicable to GaussDB(DWS) databases. You do not need to connect the DSC to a database. It can migrate data in offline mode without service interruption. In GaussDB(DWS), you can run the migrated SQL scripts to restore the database, thereby easily migrating offline databases to the cloud.</p>
<p id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_p8173195612411">The DSC can migrate SQL scripts of Teradata, Oracle, Netezza, MySQL, and DB2 databases.</p> <p id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_p8173195612411">The DSC can migrate SQL scripts of Teradata, Oracle, Netezza, MySQL, and DB2 databases.</p>
<div class="section" id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_section1728325511316"><h4 class="sectiontitle">Downloading the DSC SQL Migration Tool</h4><ol id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_ol868111584130"><li id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_li14681658161317"><span>Log in to the GaussDB(DWS) management console.</span></li><li id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_li1068220583130"><span>In the navigation tree on the left, click <span class="uicontrol" id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001081821879_uicontrol1842851817810"><b>Connection Management</b></span>.</span></li><li id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_li1682145812134"><span>In the <span class="wintitle" id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001081821879_wintitle17495719886"><b>Download Client and Driver</b></span> area, click <span class="uicontrol" id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001081821879_uicontrol1949551917818"><b>here</b></span> to download the DSC migration tool.</span><p><p id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_p668255812132">If you have clusters of different versions, the system displays a dialog box, prompting you to select the cluster version and download the client corresponding to the cluster version. In the cluster list on the <span class="wintitle" id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001081821879_wintitle38209217615"><b>Cluster Management</b></span> page, click the name of the specified cluster and click the <span class="parmname" id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001081821879_parmname1082042564"><b>Basic Information</b></span> tab to view the cluster version.</p> <div class="section" id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_section1728325511316"><h4 class="sectiontitle">Downloading the DSC SQL Migration Tool</h4><ol id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_ol868111584130"><li id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_li14681658161317"><span>Log in to the GaussDB(DWS) management console.</span></li><li id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_li1068220583130"><span>In the navigation tree on the left, click <span class="uicontrol" id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001081821879_uicontrol1842851817810"><b>Connection Management</b></span>.</span></li><li id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_li1682145812134"><span>In the <span class="wintitle" id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001081821879_wintitle17495719886"><b>Download Client and Driver</b></span> area, click <span class="uicontrol" id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001081821879_uicontrol1949551917818"><b>here</b></span> to download the DSC migration tool.</span><p><p id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_p668255812132">If you have clusters of different versions, the system displays a dialog box, prompting you to select the cluster version and download the client corresponding to the cluster version. In the cluster list on the <span class="wintitle" id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001081821879_wintitle38209217615"><b>Cluster Management</b></span> page, click the name of the specified cluster and click the <span class="parmname" id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001081821879_parmname1082042564"><b>Basic Information</b></span> tab to view the cluster version.</p>
<div class="fignone" id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_fig1990923102215"><span class="figcap"><b>Figure 1 </b>Downloading the tool</span><br><span><img id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_image1146921172210" src="figure/en-us_image_0000001099602632.png"></span></div> <div class="fignone" id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_fig1990923102215"><span class="figcap"><b>Figure 1 </b>Downloading the tool</span><br><span><img id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_image1146921172210" src="figure/en-us_image_0000001188642272.png"></span></div>
<p id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_p15720203711118"></p> <p id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_p15720203711118"></p>
</p></li><li id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_li2682758191314"><span>After downloading the DSC tool to the local PC, use WinSCP to upload it to a Linux host.</span><p><p id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_p156822585132">The user who uploads the tool must have the full control permission on the target directory of the Linux host.</p> </p></li><li id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_li2682758191314"><span>After downloading the DSC tool to the local PC, use WinSCP to upload it to a Linux host.</span><p><p id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_p156822585132">The user who uploads the tool must have the full control permission on the target directory of the Linux host.</p>
</p></li></ol> </p></li></ol>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_section72376514154"><h4 class="sectiontitle">Operation Guide for the DSC SQL Syntax Migration Tool</h4><p id="EN-US_TOPIC_0000001146360933__en-us_topic_0000001082831067_en-us_topic_0000001081821879_p723765121510">For details, see "DSC - SQL Syntax Migration Tool" in the <em id="EN-US_TOPIC_0000001146360933__i1968013441492">Data Warehouse Service Tool Guide</em>.</p> <div class="section" id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_section72376514154"><h4 class="sectiontitle">Operation Guide for the DSC SQL Syntax Migration Tool</h4><p id="EN-US_TOPIC_0000001233761831__en-us_topic_0000001082831067_en-us_topic_0000001081821879_p723765121510">For details, see "DSC - SQL Syntax Migration Tool" in the <em id="EN-US_TOPIC_0000001233761831__i1968013441492">Data Warehouse Service Tool Guide</em>.</p>
</div> </div>
</div> </div>
<div> <div>

View File

@ -1,4 +1,4 @@
<a name="EN-US_TOPIC_0000001145894951"></a><a name="EN-US_TOPIC_0000001145894951"></a> <a name="EN-US_TOPIC_0000001188163582"></a><a name="EN-US_TOPIC_0000001188163582"></a>
<h1 class="topictitle1">Welcome</h1> <h1 class="topictitle1">Welcome</h1>
<div id="body1546077570978"></div> <div id="body1546077570978"></div>
@ -8,14 +8,8 @@
</li> </li>
<li class="ulchildlink"><strong><a href="dws_04_0004.html">Reading Guide</a></strong><br> <li class="ulchildlink"><strong><a href="dws_04_0004.html">Reading Guide</a></strong><br>
</li> </li>
<li class="ulchildlink"><strong><a href="dws_04_0005.html">Conventions</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0006.html">Prerequisites</a></strong><br> <li class="ulchildlink"><strong><a href="dws_04_0006.html">Prerequisites</a></strong><br>
</li> </li>
</ul> </ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_1000.html">Developer Guide</a></div>
</div>
</div> </div>

View File

@ -1,15 +1,15 @@
<a name="EN-US_TOPIC_0000001098974562"></a><a name="EN-US_TOPIC_0000001098974562"></a> <a name="EN-US_TOPIC_0000001188642214"></a><a name="EN-US_TOPIC_0000001188642214"></a>
<h1 class="topictitle1">Target Readers</h1> <h1 class="topictitle1">Target Readers</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001098974562__en-us_topic_0088617413_p76943719112">This document is intended for database designers, application developers, and database administrators, and provides information required for designing, building, querying and maintaining data warehouses.</p> <div id="body8662426"><p id="EN-US_TOPIC_0000001188642214__en-us_topic_0088617413_p76943719112">This document is intended for database designers, application developers, and database administrators, and provides information required for designing, building, querying and maintaining data warehouses.</p>
<p id="EN-US_TOPIC_0000001098974562__en-us_topic_0088617413_p475043342615">As a database administrator or application developer, you need to be familiar with:</p> <p id="EN-US_TOPIC_0000001188642214__en-us_topic_0088617413_p475043342615">As a database administrator or application developer, you need to be familiar with:</p>
<ul id="EN-US_TOPIC_0000001098974562__u7691c55cfe0541c89809a8115af66949"><li id="EN-US_TOPIC_0000001098974562__lc1b601053a1a458a8612e7051824dead">Knowledge about OSs, which is the basis for everything.</li><li id="EN-US_TOPIC_0000001098974562__l7397b98425d14b22b4a478ef883c0366">SQL syntax, which is the necessary skill for database operation.</li></ul> <ul id="EN-US_TOPIC_0000001188642214__u7691c55cfe0541c89809a8115af66949"><li id="EN-US_TOPIC_0000001188642214__lc1b601053a1a458a8612e7051824dead">Knowledge about OSs, which is the basis for everything.</li><li id="EN-US_TOPIC_0000001188642214__l7397b98425d14b22b4a478ef883c0366">SQL syntax, which is the necessary skill for database operation.</li></ul>
<div class="section" id="EN-US_TOPIC_0000001098974562__sfd0735c1ae3146aea494112583a06f13"><h4 class="sectiontitle">Statement</h4><p id="EN-US_TOPIC_0000001098974562__a7fa7fab65b2145be9e9625ff874a16dc">When writing documents, the writers of <span id="EN-US_TOPIC_0000001098974562__text33426438492">GaussDB(DWS)</span> try their best to provide guidance from the perspective of commercial use, application scenarios, and task completion. Even so, references to PostgreSQL content may still exist in the document. For this type of content, the following PostgreSQL Copyright is applicable:</p> <div class="section" id="EN-US_TOPIC_0000001188642214__sfd0735c1ae3146aea494112583a06f13"><h4 class="sectiontitle">Statement</h4><p id="EN-US_TOPIC_0000001188642214__a7fa7fab65b2145be9e9625ff874a16dc">When writing documents, the writers of <span id="EN-US_TOPIC_0000001188642214__text33426438492">GaussDB(DWS)</span> try their best to provide guidance from the perspective of commercial use, application scenarios, and task completion. Even so, references to PostgreSQL content may still exist in the document. For this type of content, the following PostgreSQL Copyright is applicable:</p>
<p id="EN-US_TOPIC_0000001098974562__af05ef527ea2e4d9ea88935c4f4dec964">Postgres-XC is Copyright &copy; 1996-2013 by the PostgreSQL Global Development Group.</p> <p id="EN-US_TOPIC_0000001188642214__af05ef527ea2e4d9ea88935c4f4dec964">Postgres-XC is Copyright &copy; 1996-2013 by the PostgreSQL Global Development Group.</p>
<p id="EN-US_TOPIC_0000001098974562__a18917fc228ec43ba8cfceb4e3751dff7">PostgreSQL is Copyright &copy; 1996-2013 by the PostgreSQL Global Development Group.</p> <p id="EN-US_TOPIC_0000001188642214__a18917fc228ec43ba8cfceb4e3751dff7">PostgreSQL is Copyright &copy; 1996-2013 by the PostgreSQL Global Development Group.</p>
<p id="EN-US_TOPIC_0000001098974562__en-us_topic_0088617413_p145955232323">Postgres95 is Copyright &copy; 1994-5 by the Regents of the University of California.</p> <p id="EN-US_TOPIC_0000001188642214__en-us_topic_0088617413_p145955232323">Postgres95 is Copyright &copy; 1994-5 by the Regents of the University of California.</p>
<p id="EN-US_TOPIC_0000001098974562__a59df8aed2b0f4dbe9817856ee8c1288b">IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p> <p id="EN-US_TOPIC_0000001188642214__a59df8aed2b0f4dbe9817856ee8c1288b">IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
<p id="EN-US_TOPIC_0000001098974562__en-us_topic_0088617413_p145951236322">THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS-IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.</p> <p id="EN-US_TOPIC_0000001188642214__en-us_topic_0088617413_p145951236322">THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS-IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.</p>
</div> </div>
</div> </div>
<div> <div>

View File

@ -1,48 +1,48 @@
<a name="EN-US_TOPIC_0000001147429923"></a><a name="EN-US_TOPIC_0000001147429923"></a> <a name="EN-US_TOPIC_0000001188163728"></a><a name="EN-US_TOPIC_0000001188163728"></a>
<h1 class="topictitle1">Reading Guide</h1> <h1 class="topictitle1">Reading Guide</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p119421276243">If you are a new GaussDB(DWS) user, you are advised to read the following contents first:</p> <div id="body8662426"><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p119421276243">If you are a new GaussDB(DWS) user, you are advised to read the following contents first:</p>
<ul id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_ul139423717245"><li id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_li3156143819234">Sections describing the features, functions, and application scenarios of GaussDB(DWS).</li><li id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_li1094219718241">"Getting Started": guides you through creating a data warehouse cluster, creating a database table, uploading data, and testing queries.</li></ul> <ul id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_ul139423717245"><li id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_li3156143819234">Sections describing the features, functions, and application scenarios of GaussDB(DWS).</li><li id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_li1094219718241">"Getting Started": guides you through creating a data warehouse cluster, creating a database table, uploading data, and testing queries.</li></ul>
<p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p0345056487">If you intend to or are migrating applications from other data warehouses to GaussDB(DWS), you might want to know how GaussDB(DWS) differs from them.</p> <p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p0345056487">If you intend to or are migrating applications from other data warehouses to GaussDB(DWS), you might want to know how GaussDB(DWS) differs from them.</p>
<p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p10942107112415">You can find useful information from the following table for GaussDB(DWS) database application development.</p> <p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p10942107112415">You can find useful information from the following table for GaussDB(DWS) database application development.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_table16151205121211" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_row17549145161217"><th align="left" class="cellrowborder" valign="top" width="24%" id="mcps1.3.5.1.3.1.1"><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p20549185117125"><strong id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_b842352706192044">If you want to...</strong></p> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_table16151205121211" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_row17549145161217"><th align="left" class="cellrowborder" valign="top" width="24%" id="mcps1.3.5.1.3.1.1"><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p20549185117125"><strong id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_b842352706192044">If you want to...</strong></p>
</th> </th>
<th align="left" class="cellrowborder" valign="top" width="76%" id="mcps1.3.5.1.3.1.2"><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p65491751101210"><strong id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_b842352706192052">Query Suggestions</strong></p> <th align="left" class="cellrowborder" valign="top" width="76%" id="mcps1.3.5.1.3.1.2"><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p65491751101210"><strong id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_b842352706192052">Query Suggestions</strong></p>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody><tr id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_row7549205111219"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.5.1.3.1.1 "><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p12549151201213">Quickly get started with GaussDB(DWS).</p> <tbody><tr id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_row7549205111219"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.5.1.3.1.1 "><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p12549151201213">Quickly get started with GaussDB(DWS).</p>
</td> </td>
<td class="cellrowborder" valign="top" width="76%" headers="mcps1.3.5.1.3.1.2 "><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p105091621112310">Deploy a cluster, connect to the database, and perform some queries by following the instructions provided in <span id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_ph1737544541218">"Getting Started" in the <em id="EN-US_TOPIC_0000001147429923__i17228514154417">Data Warehouse Service (DWS) User Guide</em></span>.</p> <td class="cellrowborder" valign="top" width="76%" headers="mcps1.3.5.1.3.1.2 "><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p105091621112310">Deploy a cluster, connect to the database, and perform some queries by following the instructions provided in <span id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_ph1737544541218">"Getting Started" in the <em id="EN-US_TOPIC_0000001188163728__i17228514154417">Data Warehouse Service (DWS) User Guide</em></span>.</p>
<p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p85501351171216">When you are ready to construct a database, load data to tables and compile the query content to operate the data in the data warehouse. Then, you can return to the <em id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_i9533458173417">Data Warehouse Service Database Developer Guide</em>.</p> <p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p85501351171216">When you are ready to construct a database, load data to tables and compile the query content to operate the data in the data warehouse. Then, you can return to the <em id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_i9533458173417">Data Warehouse Service Database Developer Guide</em>.</p>
</td> </td>
</tr> </tr>
<tr id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_row3550165121211"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.5.1.3.1.1 "><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p175501351191218">Understand the internal architecture of a GaussDB(DWS) data warehouse.</p> <tr id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_row3550165121211"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.5.1.3.1.1 "><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p175501351191218">Understand the internal architecture of a GaussDB(DWS) data warehouse.</p>
</td> </td>
<td class="cellrowborder" valign="top" width="76%" headers="mcps1.3.5.1.3.1.2 "><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p555155113127"><span id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_ph45461726010">To know more about GaussDB(DWS), go to the GaussDB(DWS) home page.</span></p> <td class="cellrowborder" valign="top" width="76%" headers="mcps1.3.5.1.3.1.2 "><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p555155113127"><span id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_ph45461726010">To know more about GaussDB(DWS), go to the GaussDB(DWS) home page.</span></p>
</td> </td>
</tr> </tr>
<tr id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_row1255315113125"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.5.1.3.1.1 "><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p1755310518126">Learn how to design tables to achieve the excellent performance.</p> <tr id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_row1255315113125"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.5.1.3.1.1 "><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p1755310518126">Learn how to design tables to achieve the excellent performance.</p>
</td> </td>
<td class="cellrowborder" valign="top" width="76%" headers="mcps1.3.5.1.3.1.2 "><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p13654111934611"><a href="dws_04_0074.html">Development and Design Proposal</a> introduces the design specifications that should be complied with during the development of database applications. Modeling compliant with these specifications fits the distributed processing architecture of GaussDB(DWS) and provides efficient SQL code.</p> <td class="cellrowborder" valign="top" width="76%" headers="mcps1.3.5.1.3.1.2 "><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p13654111934611"><a href="dws_04_0074.html">Development and Design Proposal</a> introduces the design specifications that should be complied with during the development of database applications. Modeling compliant with these specifications fits the distributed processing architecture of GaussDB(DWS) and provides efficient SQL code.</p>
<p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p1455345117122">To facilitate service execution through optimization, you can refer to <a href="dws_04_0400.html">Query Performance Optimization</a>. Successful performance optimization depends more on database administrators' experience and judgment than on instructions and explanation. However, <a href="dws_04_0400.html">Query Performance Optimization</a> still tries to systematically illustrate the performance optimization methods for application development personnel and new GaussDB(DWS) database administrators.</p> <p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p1455345117122">To facilitate service execution through optimization, you can refer to <a href="dws_04_0400.html">Performance Tuning</a>. Successful performance optimization depends more on database administrators' experience and judgment than on instructions and explanation. However, <a href="dws_04_0400.html">Performance Tuning</a> still tries to systematically illustrate the performance optimization methods for application development personnel and new GaussDB(DWS) database administrators.</p>
</td> </td>
</tr> </tr>
<tr id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_row175551251161211"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.5.1.3.1.1 "><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p6555115111217">Load data.</p> <tr id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_row175551251161211"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.5.1.3.1.1 "><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p6555115111217">Load data.</p>
</td> </td>
<td class="cellrowborder" valign="top" width="76%" headers="mcps1.3.5.1.3.1.2 "><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p20378116113412"><a href="dws_04_0179.html">Data Import</a> describes how to import data to GaussDB(DWS).</p> <td class="cellrowborder" valign="top" width="76%" headers="mcps1.3.5.1.3.1.2 "><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p20378116113412"><a href="dws_04_0179.html">Importing Data</a> describes how to import data to GaussDB(DWS).</p>
</td> </td>
</tr> </tr>
<tr id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_row355910512126"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.5.1.3.1.1 "><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p955914513126">Manage users, groups, and database security.</p> <tr id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_row355910512126"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.5.1.3.1.1 "><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p955914513126">Manage users, groups, and database security.</p>
</td> </td>
<td class="cellrowborder" valign="top" width="76%" headers="mcps1.3.5.1.3.1.2 "><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p8559105118127"><a href="dws_04_0043.html">Database Security Management</a> covers database security topics.</p> <td class="cellrowborder" valign="top" width="76%" headers="mcps1.3.5.1.3.1.2 "><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p8559105118127"><a href="dws_04_0043.html">Database Security Management</a> covers database security topics.</p>
</td> </td>
</tr> </tr>
<tr id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_row45594511129"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.5.1.3.1.1 "><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p18559145110127">Monitor and optimize system performance.</p> <tr id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_row45594511129"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.5.1.3.1.1 "><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p18559145110127">Monitor and optimize system performance.</p>
</td> </td>
<td class="cellrowborder" valign="top" width="76%" headers="mcps1.3.5.1.3.1.2 "><p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p256014516125"><a href="dws_04_0559.html">System Catalogs and System Views</a> describes the system catalogs where you can query the database status and monitor the query content and process.</p> <td class="cellrowborder" valign="top" width="76%" headers="mcps1.3.5.1.3.1.2 "><p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p256014516125"><a href="dws_04_0559.html">System Catalogs and System Views</a> describes the system catalogs where you can query the database status and monitor the query content and process.</p>
<p id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_p155601551151210">You can learn how to check the system running status and monitoring metrics on the GaussDB(DWS) console by referring to <span id="EN-US_TOPIC_0000001147429923__en-us_topic_0000001083105849_ph1969811553139">"Monitoring Clusters" in the <em id="EN-US_TOPIC_0000001147429923__i1824418325215">Data Warehouse Service (DWS) User Guide</em>.</span></p> <p id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_p155601551151210">You can learn how to check the system running status and monitoring metrics on the GaussDB(DWS) console by referring to <span id="EN-US_TOPIC_0000001188163728__en-us_topic_0000001083105849_ph1969811553139">"Monitoring Clusters" in the <em id="EN-US_TOPIC_0000001188163728__i1824418325215">Data Warehouse Service (DWS) User Guide</em>.</span></p>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -1,94 +0,0 @@
<a name="EN-US_TOPIC_0000001098975012"></a><a name="EN-US_TOPIC_0000001098975012"></a>
<h1 class="topictitle1">Conventions</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_section9768027811"><h4 class="sectiontitle">Example Conventions</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_table2157164314264" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row1515734372611"><th align="left" class="cellrowborder" valign="top" width="26.02%" id="mcps1.3.1.2.1.3.1.1"><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p9157184392620"><strong id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_b842352706101436">Example</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="73.98%" id="mcps1.3.1.2.1.3.1.2"><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p7157943142613"><strong id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_b842352706101515">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row161578435261"><td class="cellrowborder" valign="top" width="26.02%" headers="mcps1.3.1.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001098975012__p2333102254119">dbadmin</p>
</td>
<td class="cellrowborder" valign="top" width="73.98%" headers="mcps1.3.1.2.1.3.1.2 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p121571043182612">Indicates the user operating and maintaining <span id="EN-US_TOPIC_0000001098975012__text1286495126">GaussDB(DWS)</span> appointed when the cluster is created.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row151572043132614"><td class="cellrowborder" valign="top" width="26.02%" headers="mcps1.3.1.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001098975012__p1597114541063">8000</p>
</td>
<td class="cellrowborder" valign="top" width="73.98%" headers="mcps1.3.1.2.1.3.1.2 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p1215713437261">Indicates the port number used by <span id="EN-US_TOPIC_0000001098975012__text467726869">GaussDB(DWS)</span> to monitor connection requests from the client.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p61571343122610">SQL examples in this manual are developed based on the TPC-DS model. Before you execute the examples, install the TPC-DS benchmark by following the instructions on the official website <a href="https://www.tpc.org/tpcds/" target="_blank" rel="noopener noreferrer">https://www.tpc.org/tpcds/</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_section13414619381"><h4 class="sectiontitle">SQL Syntax Text Conventions</h4><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p16961156174213">To better understand the syntax usage, you can refer to the SQL syntax text conventions described as follows: </p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_table1779115272618" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row147915214268"><th align="left" class="cellrowborder" valign="top" width="26.950000000000003%" id="mcps1.3.2.3.1.3.1.1"><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p157916521264"><strong id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_b842352706102353">Format</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="73.05%" id="mcps1.3.2.3.1.3.1.2"><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p1279115211266"><strong id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_b842352706102356">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row157914526260"><td class="cellrowborder" valign="top" width="26.950000000000003%" headers="mcps1.3.2.3.1.3.1.1 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p6791152112616">Uppercase characters</p>
</td>
<td class="cellrowborder" valign="top" width="73.05%" headers="mcps1.3.2.3.1.3.1.2 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p187935220260">Indicates that keywords must be in uppercase.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row17791652172611"><td class="cellrowborder" valign="top" width="26.950000000000003%" headers="mcps1.3.2.3.1.3.1.1 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p079152192613">Lowercase characters</p>
</td>
<td class="cellrowborder" valign="top" width="73.05%" headers="mcps1.3.2.3.1.3.1.2 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p167920523269">Indicates that parameters must be in lowercase.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row127965222619"><td class="cellrowborder" valign="top" width="26.950000000000003%" headers="mcps1.3.2.3.1.3.1.1 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p179205242615">[ ]</p>
</td>
<td class="cellrowborder" valign="top" width="73.05%" headers="mcps1.3.2.3.1.3.1.2 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p77945212264">Indicates that the items in brackets [] are optional.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row1879165219267"><td class="cellrowborder" valign="top" width="26.950000000000003%" headers="mcps1.3.2.3.1.3.1.1 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p47975272620">...</p>
</td>
<td class="cellrowborder" valign="top" width="73.05%" headers="mcps1.3.2.3.1.3.1.2 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p3792052162619">Indicates that preceding elements can appear repeatedly. </p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row279145262617"><td class="cellrowborder" valign="top" width="26.950000000000003%" headers="mcps1.3.2.3.1.3.1.1 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p579115212613">[ x | y | ... ]</p>
</td>
<td class="cellrowborder" valign="top" width="73.05%" headers="mcps1.3.2.3.1.3.1.2 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p1279175210267">Indicates that one item is selected from two or more options or no item is selected.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row379652132614"><td class="cellrowborder" valign="top" width="26.950000000000003%" headers="mcps1.3.2.3.1.3.1.1 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p1879115211265">{ x | y | ... }</p>
</td>
<td class="cellrowborder" valign="top" width="73.05%" headers="mcps1.3.2.3.1.3.1.2 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p1579052152616">Indicates that one item is selected from two or more options.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row47918525261"><td class="cellrowborder" valign="top" width="26.950000000000003%" headers="mcps1.3.2.3.1.3.1.1 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p379155242618">[x | y | ... ] [ ... ]</p>
</td>
<td class="cellrowborder" valign="top" width="73.05%" headers="mcps1.3.2.3.1.3.1.2 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p27945212614">Indicates that multiple parameters or no parameter can be selected. If multiple parameters are selected, separate them with spaces. </p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row279195242615"><td class="cellrowborder" valign="top" width="26.950000000000003%" headers="mcps1.3.2.3.1.3.1.1 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p079752122611">[ x | y | ... ] [ ,... ]</p>
</td>
<td class="cellrowborder" valign="top" width="73.05%" headers="mcps1.3.2.3.1.3.1.2 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p1779115212264">Indicates that multiple parameters or no parameter can be selected. If multiple parameters are selected, separate them with commas (,).</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row1379152162615"><td class="cellrowborder" valign="top" width="26.950000000000003%" headers="mcps1.3.2.3.1.3.1.1 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p679175212265">{ x | y | ... } [ ... ]</p>
</td>
<td class="cellrowborder" valign="top" width="73.05%" headers="mcps1.3.2.3.1.3.1.2 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p57945202616">Indicates that at least one parameter can be selected. If multiple parameters are selected, separate them with spaces.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_row1179552122618"><td class="cellrowborder" valign="top" width="26.950000000000003%" headers="mcps1.3.2.3.1.3.1.1 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p97925232619">{ x | y | ... } [ ,... ]</p>
</td>
<td class="cellrowborder" valign="top" width="73.05%" headers="mcps1.3.2.3.1.3.1.2 "><p id="EN-US_TOPIC_0000001098975012__en-us_topic_0099576066_p1779152122615">Indicates that at least one parameter can be selected. If multiple parameters are selected, separate them with commas (,).</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0001.html">Welcome</a></div>
</div>
</div>

View File

@ -1,9 +1,9 @@
<a name="EN-US_TOPIC_0000001100619984"></a><a name="EN-US_TOPIC_0000001100619984"></a> <a name="EN-US_TOPIC_0000001188323610"></a><a name="EN-US_TOPIC_0000001188323610"></a>
<h1 class="topictitle1">Prerequisites</h1> <h1 class="topictitle1">Prerequisites</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001100619984__en-us_topic_0000001098651172_en-us_topic_0100008559_p13124746151715">Complete the following tasks before you perform operations described in this document:</p> <div id="body8662426"><p id="EN-US_TOPIC_0000001188323610__en-us_topic_0000001098651172_en-us_topic_0100008559_p13124746151715">Complete the following tasks before you perform operations described in this document:</p>
<ul id="EN-US_TOPIC_0000001100619984__en-us_topic_0000001098651172_en-us_topic_0100008559_ul1012464615174"><li id="EN-US_TOPIC_0000001100619984__en-us_topic_0000001098651172_li12527112919326">Create a GaussDB(DWS) cluster.</li><li id="EN-US_TOPIC_0000001100619984__en-us_topic_0000001098651172_en-us_topic_0100008559_li15124124631711">Install an SQL client.</li><li id="EN-US_TOPIC_0000001100619984__en-us_topic_0000001098651172_en-us_topic_0100008559_li17124164618170">Connect the SQL client to the default database of the cluster.</li></ul> <ul id="EN-US_TOPIC_0000001188323610__en-us_topic_0000001098651172_en-us_topic_0100008559_ul1012464615174"><li id="EN-US_TOPIC_0000001188323610__en-us_topic_0000001098651172_li12527112919326">Create a GaussDB(DWS) cluster.</li><li id="EN-US_TOPIC_0000001188323610__en-us_topic_0000001098651172_en-us_topic_0100008559_li15124124631711">Install an SQL client.</li><li id="EN-US_TOPIC_0000001188323610__en-us_topic_0000001098651172_en-us_topic_0100008559_li17124164618170">Connect the SQL client to the default database of the cluster.</li></ul>
<p id="EN-US_TOPIC_0000001100619984__en-us_topic_0000001098651172_p2011402915287">For details about the preceding tasks, see <span id="EN-US_TOPIC_0000001100619984__en-us_topic_0000001098651172_ph199622047113013">"Getting Started" in the <em id="EN-US_TOPIC_0000001100619984__i862311241434">Data Warehouse Service (DWS) User Guide</em></span>.</p> <p id="EN-US_TOPIC_0000001188323610__p1613844418349">For details about how to perform the preceding tasks, see <span id="EN-US_TOPIC_0000001188323610__ph158502045123416">"Getting Started" in the <em id="EN-US_TOPIC_0000001188323610__i860511508525">Data Warehouse Service (DWS) User Guide</em></span>.</p>
</div> </div>
<div> <div>
<div class="familylinks"> <div class="familylinks">

View File

@ -1,7 +1,7 @@
<a name="EN-US_TOPIC_0000001099134502"></a><a name="EN-US_TOPIC_0000001099134502"></a> <a name="EN-US_TOPIC_0000001233563145"></a><a name="EN-US_TOPIC_0000001233563145"></a>
<h1 class="topictitle1">System Overview</h1> <h1 class="topictitle1">System Overview</h1>
<div id="body1494317364745"><p id="EN-US_TOPIC_0000001099134502__en-us_topic_0059777588_p8060118"></p> <div id="body1494317364745"><p id="EN-US_TOPIC_0000001233563145__en-us_topic_0059777588_p8060118"></p>
</div> </div>
<div> <div>
<ul class="ullinks"> <ul class="ullinks">
@ -12,9 +12,5 @@
<li class="ulchildlink"><strong><a href="dws_04_0015.html">Related Concepts</a></strong><br> <li class="ulchildlink"><strong><a href="dws_04_0015.html">Related Concepts</a></strong><br>
</li> </li>
</ul> </ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_1000.html">Developer Guide</a></div>
</div>
</div> </div>

View File

@ -1,12 +1,12 @@
<a name="EN-US_TOPIC_0000001147236333"></a><a name="EN-US_TOPIC_0000001147236333"></a> <a name="EN-US_TOPIC_0000001233681645"></a><a name="EN-US_TOPIC_0000001233681645"></a>
<h1 class="topictitle1">Highly Reliable Transaction Processing</h1> <h1 class="topictitle1">Highly Reliable Transaction Processing</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_en-us_topic_0059777480_p18508125215341">GaussDB(DWS) manages cluster transactions, the basis of HA and failovers. This ensures speedy fault recovery, guarantees the Atomicity, Consistency, Isolation, Durability (ACID) properties for transactions and after a recovery, and enables concurrent control.</p> <div id="body8662426"><p id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_en-us_topic_0059777480_p18508125215341">GaussDB(DWS) manages cluster transactions, the basis of HA and failovers. This ensures speedy fault recovery, guarantees the Atomicity, Consistency, Isolation, Durability (ACID) properties for transactions and after a recovery, and enables concurrent control.</p>
<p id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_p5441259201918"><strong id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_b199541448264">Fault Rectification</strong></p> <p id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_p5441259201918"><strong id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_b199541448264">Fault Rectification</strong></p>
<p id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_p4937102391917">GaussDB(DWS) provides an HA mechanism to reduce the service interruption time when a cluster is faulty. It protects key user programs to continuously provide external services, minimizing the impact of hardware, software, and human faults on services and ensuring service continuity.</p> <p id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_p4937102391917">GaussDB(DWS) provides an HA mechanism to reduce the service interruption time when a cluster is faulty. It protects key user programs to continuously provide external services, minimizing the impact of hardware, software, and human faults on services and ensuring service continuity.</p>
<ul id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_ul440554114403"><li id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_li12175320103418">Hardware HA: Disk RAID, switch stacking, NIC bond, and uninterruptible power supply (UPS)</li><li id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_li6315165625313">Software HA: HA mechanism used for instances in the GaussDB(DWS) cluster, such as CNs, GTMs, and DNs)</li></ul> <ul id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_ul440554114403"><li id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_li12175320103418">Hardware HA: Disk RAID, switch stacking, NIC bond, and uninterruptible power supply (UPS)</li><li id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_li6315165625313">Software HA: HA mechanism used for instances in the GaussDB(DWS) cluster, such as CNs, GTMs, and DNs)</li></ul>
<p id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_p184255367819"><strong id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_b3425193617810">Transaction Management</strong></p> <p id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_p184255367819"><strong id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_b3425193617810">Transaction Management</strong></p>
<ul id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_ul134255361888"><li id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_li64258366818">Transaction blocks are supported. You can run <strong id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_b16161854103419">start transaction</strong> to make the startup of a transaction block explicit.</li><li id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_li94251636187">Single-statement transactions are supported. If you do not explicitly start a transaction, a single statement is processed as a transaction.</li><li id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_li64257362813">Distributed transaction management and global transaction information management are supported. This includes gxid, snapshot, timestamp management, distributed transaction status management, and gxid overflow processing.</li><li id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_li94250366810">Distributed transactions have ACID properties.</li><li id="EN-US_TOPIC_0000001147236333__en-us_topic_0000001098971038_li104253361985">Deadlocks are prevented in the distributed system. A transaction will be unlocked immediately after a deadlock (if any).</li></ul> <ul id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_ul134255361888"><li id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_li64258366818">Transaction blocks are supported. You can run <strong id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_b16161854103419">start transaction</strong> to make the startup of a transaction block explicit.</li><li id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_li94251636187">Single-statement transactions are supported. If you do not explicitly start a transaction, a single statement is processed as a transaction.</li><li id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_li64257362813">Distributed transaction management and global transaction information management are supported. This includes gxid, snapshot, timestamp management, distributed transaction status management, and gxid overflow processing.</li><li id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_li94250366810">Distributed transactions have ACID properties.</li><li id="EN-US_TOPIC_0000001233681645__en-us_topic_0000001098971038_li104253361985">Deadlocks are prevented in the distributed system. A transaction will be unlocked immediately after a deadlock (if any).</li></ul>
</div> </div>
<div> <div>
<div class="familylinks"> <div class="familylinks">

View File

@ -1,15 +1,15 @@
<a name="EN-US_TOPIC_0000001147041825"></a><a name="EN-US_TOPIC_0000001147041825"></a> <a name="EN-US_TOPIC_0000001233883341"></a><a name="EN-US_TOPIC_0000001233883341"></a>
<h1 class="topictitle1">High Query Performance</h1> <h1 class="topictitle1">High Query Performance</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001147041825__en-us_topic_0000001145651105_p17990103921210">The following <span id="EN-US_TOPIC_0000001147041825__en-us_topic_0000001145651105_ph1692512422530">GaussDB(DWS)</span> features help achieve high query performance.</p> <div id="body8662426"><p id="EN-US_TOPIC_0000001233883341__en-us_topic_0000001145651105_p17990103921210">The following <span id="EN-US_TOPIC_0000001233883341__en-us_topic_0000001145651105_ph1692512422530">GaussDB(DWS)</span> features help achieve high query performance.</p>
<div class="section" id="EN-US_TOPIC_0000001147041825__en-us_topic_0000001145651105_section15932442508"><h4 class="sectiontitle">Fully Parallel Query</h4><p id="EN-US_TOPIC_0000001147041825__en-us_topic_0000001145651105_p5165941205614">GaussDB(DWS) is an MPP system with the shared-nothing architecture. It consists of multiple independent logical nodes that do not share system resources, such as the CPU, memory, and storage units. In such a system architecture, service data is separately stored on numerous nodes. Data analysis tasks are executed in parallel on the nodes where data is stored. The massively parallel data processing significantly improves response speed.</p> <div class="section" id="EN-US_TOPIC_0000001233883341__en-us_topic_0000001145651105_section15932442508"><h4 class="sectiontitle">Fully Parallel Query</h4><p id="EN-US_TOPIC_0000001233883341__en-us_topic_0000001145651105_p5165941205614">GaussDB(DWS) is an MPP system with the shared-nothing architecture. It consists of multiple independent logical nodes that do not share system resources, such as the CPU, memory, and storage units. In such a system architecture, service data is separately stored on numerous nodes. Data analysis tasks are executed in parallel on the nodes where data is stored. The massively parallel data processing significantly improves response speed.</p>
<p id="EN-US_TOPIC_0000001147041825__en-us_topic_0000001145651105_p14997175420585">In addition, GaussDB(DWS) improves data query performance by executing operators in parallel, executing commands in registers in parallel, and using LLVM to dynamically compile the logical conditions of redundancy prune.</p> <p id="EN-US_TOPIC_0000001233883341__en-us_topic_0000001145651105_p14997175420585">In addition, GaussDB(DWS) improves data query performance by executing operators in parallel, executing commands in registers in parallel, and using LLVM to dynamically compile the logical conditions of redundancy prune.</p>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001147041825__en-us_topic_0000001145651105_section88161057145419"><h4 class="sectiontitle">Hybrid Row-Column Storage</h4><p id="EN-US_TOPIC_0000001147041825__en-us_topic_0000001145651105_en-us_topic_0059777898_a30aa33ed6061451c8ed22c26bbe46d34"><span id="EN-US_TOPIC_0000001147041825__en-us_topic_0000001145651105_ph196814173531">GaussDB(DWS)</span> supports both the row and column storage models. You can choose a row- or column-store table as needed.</p> <div class="section" id="EN-US_TOPIC_0000001233883341__en-us_topic_0000001145651105_section88161057145419"><h4 class="sectiontitle">Hybrid Row-Column Storage</h4><p id="EN-US_TOPIC_0000001233883341__en-us_topic_0000001145651105_en-us_topic_0059777898_a30aa33ed6061451c8ed22c26bbe46d34"><span id="EN-US_TOPIC_0000001233883341__en-us_topic_0000001145651105_ph196814173531">GaussDB(DWS)</span> supports both the row and column storage models. You can choose a row- or column-store table as needed.</p>
<p id="EN-US_TOPIC_0000001147041825__en-us_topic_0000001145651105_en-us_topic_0059777898_a60c95b61dafb4694913a80d682e31916">The hybrid row-column storage engine achieves higher data compression ratio (column storage), index performance (column storage), and point update and point query (row storage) performance.</p> <p id="EN-US_TOPIC_0000001233883341__en-us_topic_0000001145651105_en-us_topic_0059777898_a60c95b61dafb4694913a80d682e31916">The hybrid row-column storage engine achieves higher data compression ratio (column storage), index performance (column storage), and point update and point query (row storage) performance.</p>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001147041825__en-us_topic_0000001145651105_section12425115163819"><h4 class="sectiontitle">Data Compression in Column Storage</h4><p id="EN-US_TOPIC_0000001147041825__en-us_topic_0000001145651105_en-us_topic_0085033179_p1050313019230">You can compress old, inactive data to free up space, reducing procurement and O&amp;M costs.</p> <div class="section" id="EN-US_TOPIC_0000001233883341__en-us_topic_0000001145651105_section12425115163819"><h4 class="sectiontitle">Data Compression in Column Storage</h4><p id="EN-US_TOPIC_0000001233883341__en-us_topic_0000001145651105_en-us_topic_0085033179_p1050313019230">You can compress old, inactive data to free up space, reducing procurement and O&amp;M costs.</p>
<p id="EN-US_TOPIC_0000001147041825__en-us_topic_0000001145651105_en-us_topic_0085033179_p9503123015234">In GaussDB(DWS), data can be compressed using the Delta Value Encoding, Dictionary, RLE, LZ4, and ZLIB algorithms. The system automatically selects a compression algorithm based on data characteristics. The average compression ratio is 7:1. Compressed data can be directly accessed and is transparent to services, greatly reducing the preparation time before accessing historical data.</p> <p id="EN-US_TOPIC_0000001233883341__en-us_topic_0000001145651105_en-us_topic_0085033179_p9503123015234">In GaussDB(DWS), data can be compressed using the Delta Value Encoding, Dictionary, RLE, LZ4, and ZLIB algorithms. The system automatically selects a compression algorithm based on data characteristics. The average compression ratio is 7:1. Compressed data can be directly accessed and is transparent to services, greatly reducing the preparation time before accessing historical data.</p>
</div> </div>
</div> </div>
<div> <div>

View File

@ -1,17 +1,17 @@
<a name="EN-US_TOPIC_0000001099134964"></a><a name="EN-US_TOPIC_0000001099134964"></a> <a name="EN-US_TOPIC_0000001233563241"></a><a name="EN-US_TOPIC_0000001233563241"></a>
<h1 class="topictitle1">Related Concepts</h1> <h1 class="topictitle1">Related Concepts</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001099134964__s8eeb92bbb2c9474abec3131c2a3de9be"><h4 class="sectiontitle">Database</h4><p id="EN-US_TOPIC_0000001099134964__a0d56a1d8a499429ab5d27ebc7f8e169b">A database manages data objects and is isolated from other databases. While creating a database, you can specify a tablespace. If you do not specify it, database objects will be saved to the <strong id="EN-US_TOPIC_0000001099134964__b842352706142447">PG_DEFAULT</strong> by default. Objects managed by a database can be distributed to multiple tablespaces.</p> <div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001233563241__s8eeb92bbb2c9474abec3131c2a3de9be"><h4 class="sectiontitle">Database</h4><p id="EN-US_TOPIC_0000001233563241__a0d56a1d8a499429ab5d27ebc7f8e169b">A database manages data objects and is isolated from other databases. While creating an object, you can specify a tablespace for it. If you do not specify it, the object will be saved to the <strong id="EN-US_TOPIC_0000001233563241__b842352706142447">PG_DEFAULT</strong> space by default. Objects managed by a database can be distributed to multiple tablespaces.</p>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001099134964__en-us_topic_0093464731_en-us_topic_0059779238_s174b82ec22a94e478b49737f0bced1ac"><h4 class="sectiontitle">Instance</h4><p id="EN-US_TOPIC_0000001099134964__en-us_topic_0093464731_en-us_topic_0059779238_ad9aa75e070294dada1bb1426c733ac00">In <span id="EN-US_TOPIC_0000001099134964__ph165411332142716">GaussDB(DWS)</span>, instances are a group of database processes running in the memory. An instance can manage one or more databases that form a cluster. A cluster is an area in the storage disk. This area is initialized during installation and composed of a directory. The directory, called data directory, stores all data and is created by <strong id="EN-US_TOPIC_0000001099134964__b20745131862814">initdb</strong>. Theoretically, one server can start multiple instances on different ports, but <span id="EN-US_TOPIC_0000001099134964__ph159118115292">GaussDB(DWS)</span> manages only one instance at a time. The start and stop of an instance rely on the specific data directory. For compatibility purposes, the concept of instance name may be introduced.</p> <div class="section" id="EN-US_TOPIC_0000001233563241__en-us_topic_0093464731_en-us_topic_0059779238_s174b82ec22a94e478b49737f0bced1ac"><h4 class="sectiontitle">Instance</h4><p id="EN-US_TOPIC_0000001233563241__en-us_topic_0093464731_en-us_topic_0059779238_ad9aa75e070294dada1bb1426c733ac00">In <span id="EN-US_TOPIC_0000001233563241__ph165411332142716">GaussDB(DWS)</span>, instances are a group of database processes running in the memory. An instance can manage one or more databases that form a cluster. A cluster is an area in the storage disk. This area is initialized during installation and composed of a directory. The directory, called data directory, stores all data and is created by <strong id="EN-US_TOPIC_0000001233563241__b20745131862814">initdb</strong>. Theoretically, one server can start multiple instances on different ports, but <span id="EN-US_TOPIC_0000001233563241__ph159118115292">GaussDB(DWS)</span> manages only one instance at a time. The start and stop of an instance rely on the specific data directory. For compatibility purposes, the concept of instance name may be introduced.</p>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001099134964__sd02a43df183c4a5ebb95eb554ab910a9"><h4 class="sectiontitle">Tablespaces</h4><p id="EN-US_TOPIC_0000001099134964__a906223c1bcdb4005a529ff2b5401002d">In <span id="EN-US_TOPIC_0000001099134964__text1998133972">GaussDB(DWS)</span>, a tablespace is a directory storing physical files of the databases the tablespace contains. Multiple tablespaces can coexist. Files are physically isolated using tablespaces and managed by a file system.</p> <div class="section" id="EN-US_TOPIC_0000001233563241__sd02a43df183c4a5ebb95eb554ab910a9"><h4 class="sectiontitle">Tablespaces</h4><p id="EN-US_TOPIC_0000001233563241__a906223c1bcdb4005a529ff2b5401002d">In <span id="EN-US_TOPIC_0000001233563241__text1998133972">GaussDB(DWS)</span>, a tablespace is a directory storing physical files of the databases the tablespace contains. Multiple tablespaces can coexist. Files are physically isolated using tablespaces and managed by a file system.</p>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001099134964__s9d3f5dfcecdf4bad99e5f9a2688e21a5"><h4 class="sectiontitle">schema</h4><p id="EN-US_TOPIC_0000001099134964__a2d20c90fc0fe4ac5bc82f0009668ab60"><span id="EN-US_TOPIC_0000001099134964__text169550254">GaussDB(DWS)</span> schemas logically separate databases. All database objects are created under certain schemas. In <span id="EN-US_TOPIC_0000001099134964__text1332219925">GaussDB(DWS)</span>, schemas and users are loosely bound. When you create a user, a schema with the same name as the user will be created automatically. You can also create a schema or specify another schema.</p> <div class="section" id="EN-US_TOPIC_0000001233563241__s9d3f5dfcecdf4bad99e5f9a2688e21a5"><h4 class="sectiontitle">schema</h4><p id="EN-US_TOPIC_0000001233563241__a2d20c90fc0fe4ac5bc82f0009668ab60"><span id="EN-US_TOPIC_0000001233563241__text169550254">GaussDB(DWS)</span> schemas logically separate databases. All database objects are created under certain schemas. In <span id="EN-US_TOPIC_0000001233563241__text1332219925">GaussDB(DWS)</span>, schemas and users are loosely bound. When you create a user, a schema with the same name as the user will be created automatically. You can also create a schema or specify another schema.</p>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001099134964__s6b1917ec12c249d59233c11959b6db79"><h4 class="sectiontitle">User and Role</h4><p id="EN-US_TOPIC_0000001099134964__a400f976a3ed34940b5a45614ea2d4d60"><span id="EN-US_TOPIC_0000001099134964__text1828369993">GaussDB(DWS)</span> uses users and roles to control the access to databases. A role can be a database user or a group of database users, depending on role settings. In <span id="EN-US_TOPIC_0000001099134964__text1349326921">GaussDB(DWS)</span>, the difference between roles and users is that a role does not have the LOGIN permission by default. In <span id="EN-US_TOPIC_0000001099134964__text693192024">GaussDB(DWS)</span>, one user can have only one role, but you can put a user's role under a parent role to grant multiple permissions to the user.</p> <div class="section" id="EN-US_TOPIC_0000001233563241__s6b1917ec12c249d59233c11959b6db79"><h4 class="sectiontitle">User and Role</h4><p id="EN-US_TOPIC_0000001233563241__a400f976a3ed34940b5a45614ea2d4d60"><span id="EN-US_TOPIC_0000001233563241__text1828369993">GaussDB(DWS)</span> uses users and roles to control the access to databases. A role can be a database user or a group of database users, depending on role settings. In <span id="EN-US_TOPIC_0000001233563241__text1349326921">GaussDB(DWS)</span>, the difference between roles and users is that a role does not have the LOGIN permission by default. In <span id="EN-US_TOPIC_0000001233563241__text693192024">GaussDB(DWS)</span>, one user can have only one role, but you can put a user's role under a parent role to grant multiple permissions to the user.</p>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001099134964__s8302eda03d7b4255af235930410f3559"><h4 class="sectiontitle">Transaction Management</h4><p id="EN-US_TOPIC_0000001099134964__a0f7ae2dbc4e64f178f15d7721221bc08">In <span id="EN-US_TOPIC_0000001099134964__text484000412">GaussDB(DWS)</span>, transactions are managed by multi-version concurrency control (MVCC) and two-phase locking (2PL). It enables smooth data reads and writes. In <span id="EN-US_TOPIC_0000001099134964__text674838628">GaussDB(DWS)</span>, MVCC saves historical version data together with the current tuple version. <span id="EN-US_TOPIC_0000001099134964__text796230309">GaussDB(DWS)</span> uses the VACUUM process instead of rollback segments to routinely delete historical version data. Unless in performance optimization, you do not need to pay attention to the VACUUM process. Transactions are automatically submitted in <span id="EN-US_TOPIC_0000001099134964__text1176679149">GaussDB(DWS)</span>.</p> <div class="section" id="EN-US_TOPIC_0000001233563241__s8302eda03d7b4255af235930410f3559"><h4 class="sectiontitle">Transaction Management</h4><p id="EN-US_TOPIC_0000001233563241__a0f7ae2dbc4e64f178f15d7721221bc08">In <span id="EN-US_TOPIC_0000001233563241__text484000412">GaussDB(DWS)</span>, transactions are managed by multi-version concurrency control (MVCC) and two-phase locking (2PL). It enables smooth data reads and writes. In <span id="EN-US_TOPIC_0000001233563241__text674838628">GaussDB(DWS)</span>, MVCC saves historical version data together with the current tuple version. <span id="EN-US_TOPIC_0000001233563241__text796230309">GaussDB(DWS)</span> uses the VACUUM process instead of rollback segments to routinely delete historical version data. Unless in performance optimization, you do not need to pay attention to the VACUUM process. Transactions are automatically submitted in <span id="EN-US_TOPIC_0000001233563241__text1176679149">GaussDB(DWS)</span>.</p>
</div> </div>
</div> </div>
<div> <div>

View File

@ -0,0 +1,30 @@
<a name="EN-US_TOPIC_0000001233761859"></a><a name="EN-US_TOPIC_0000001233761859"></a>
<h1 class="topictitle1">Defining Database Objects</h1>
<div id="body1494317364745"><p id="EN-US_TOPIC_0000001233761859__en-us_topic_0059778336_p8060118"></p>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="dws_04_0025.html">Creating and Managing Databases</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0036.html">Creating and Managing Schemas</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0028.html">Creating and Managing Tables</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0026.html">Selecting a Table Storage Mode</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0037.html">Defining Table Partitions</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0038.html">Creating and Managing Indexes</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0040.html">Creating and Using Sequences</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0039.html">Creating and Managing Views</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0041.html">Creating and Managing Scheduled Tasks</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0034.html">Viewing a System Catalog</a></strong><br>
</li>
</ul>
</div>

View File

@ -0,0 +1,52 @@
<a name="EN-US_TOPIC_0000001188323600"></a><a name="EN-US_TOPIC_0000001188323600"></a>
<h1 class="topictitle1">Creating and Managing Databases</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001188323600__p1424483702418">A database is a collection of objects such as tables, indexes, views, stored procedures, and operators. GaussDB (DWS) supports the creation of multiple databases. However, a client program can connect to and access only one database at a time, and cross-database query is not supported.</p>
<div class="section" id="EN-US_TOPIC_0000001188323600__section122544389266"><h4 class="sectiontitle">Template and Default Databases</h4><ul id="EN-US_TOPIC_0000001188323600__ul967143111312"><li id="EN-US_TOPIC_0000001188323600__li1467163131318">GaussDB (DWS) provides two template databases <strong id="EN-US_TOPIC_0000001188323600__b162801117153210">template0</strong> and <strong id="EN-US_TOPIC_0000001188323600__b1951392133215">template1</strong> and a default database <span id="EN-US_TOPIC_0000001188323600__text1462184614508">gaussdb</span>.</li><li id="EN-US_TOPIC_0000001188323600__li81174559332">By default, each newly created database is based on a template database. The GaussDB(DWS) database uses <strong id="EN-US_TOPIC_0000001188323600__b10799102093619">template1</strong> as the template by default. The encoding format is SQL_ASCII, and user-defined character encoding is not allowed. If you need to specify the character encoding when creating a database, use <strong id="EN-US_TOPIC_0000001188323600__b538912818381">template0</strong> to create the database.</li><li id="EN-US_TOPIC_0000001188323600__li127281040151617">Do not use a client or any other tools to connect to or to perform operations on both the two template databases.<div class="note" id="EN-US_TOPIC_0000001188323600__note04711502378"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001188323600__p140117143366">You can run the <strong id="EN-US_TOPIC_0000001188323600__b69417832541155">show server_encoding</strong> command to view the current database encoding.</p>
</div></div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323600__section17897114011280"><h4 class="sectiontitle">Creating a Database.</h4><p id="EN-US_TOPIC_0000001188323600__p1668754282810">Run the <strong id="EN-US_TOPIC_0000001188323600__b787319574112">CREATE DATABASE</strong> statement to create a database.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323600__screen15688133611315"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">DATABASE</span><span class="w"> </span><span class="n">mydatabase</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
<div class="note" id="EN-US_TOPIC_0000001188323600__en-us_topic_0000001083024525_en-us_topic_0093152895_en-us_topic_0059779126_n8dc53fedcf784d9d893889ddf4f017a9"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001188323600__en-us_topic_0000001083024525_en-us_topic_0093152895_en-us_topic_0059779126_u26fc21318fdc40be947784c5bb32d12e"><li id="EN-US_TOPIC_0000001188323600__li531613183910">When you create a database, if the length of the database name exceeds 63 bytes, the server truncates the database name and retains the first 63 bytes. Therefore, you are advised to set the length of the database name to a value less than or equal to 63 bytes. Do not use multi-byte characters as object names. If an object whose name is truncated mistakenly cannot be deleted, delete the object using the name before the truncation, or manually delete it from the corresponding system catalog on each node.</li><li id="EN-US_TOPIC_0000001188323600__en-us_topic_0000001083024525_en-us_topic_0093152895_en-us_topic_0059779126_le053a9b8847849e4a5ad2b0b8a1f5cb5">Database names must comply with the naming convention of SQL identifiers. The current user automatically becomes the owner of this new database.</li><li id="EN-US_TOPIC_0000001188323600__en-us_topic_0000001083024525_en-us_topic_0093152895_en-us_topic_0059779126_l83e13eb3fd8342088f1842d8988073f2">If a database system is used to support independent users and projects, store them in different databases.</li><li id="EN-US_TOPIC_0000001188323600__en-us_topic_0000001083024525_en-us_topic_0093152895_en-us_topic_0059779126_l97f426d01b6849aca030305671998995">If the projects or users are associated with each other and share resources, store them in different schemas in the same database.</li><li id="EN-US_TOPIC_0000001188323600__li62226497411">A maximum of 128 databases can be created in GaussDB(DWS).</li><li id="EN-US_TOPIC_0000001188323600__li136513131362">You must have the permission to create a database or the permission that the system administrator owns.</li></ul>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323600__section463533692716"><h4 class="sectiontitle">Viewing Databases</h4><div class="p" id="EN-US_TOPIC_0000001188323600__p1318563110321">To view databases, perform the following steps:<ul id="EN-US_TOPIC_0000001188323600__ul2037492910324"><li id="EN-US_TOPIC_0000001188323600__li1537514296324">Run the <strong id="EN-US_TOPIC_0000001188323600__b201325624441155">\l</strong> meta-command to view the database list of the database system.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323600__screen163751293321"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="n">l</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001188323600__li123751029193212">Querying the database list using the <strong id="EN-US_TOPIC_0000001188323600__b6289120103110">pg_database</strong> system catalog<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323600__screen33751129193214"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="n">datname</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pg_database</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323600__section1548916712337"><h4 class="sectiontitle">Modifying a Database</h4><p id="EN-US_TOPIC_0000001188323600__p2010818293414">You can use the <strong id="EN-US_TOPIC_0000001188323600__b66291032302">ALTER DATABASE</strong> statement modify database configuration such as the database owner, name, and default settings.</p>
<ul id="EN-US_TOPIC_0000001188323600__ul1110892918418"><li id="EN-US_TOPIC_0000001188323600__li7108929134119">Run the following command to set the default search path for the database:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323600__screen11108152994110"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">DATABASE</span><span class="w"> </span><span class="n">mydatabase</span><span class="w"> </span><span class="k">SET</span><span class="w"> </span><span class="n">search_path</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">pa_catalog</span><span class="p">,</span><span class="k">public</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001188323600__li15111529124112">Rename the database.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323600__screen611152911411"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">DATABASE</span><span class="w"> </span><span class="n">mydatabase</span><span class="w"> </span><span class="k">RENAME</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">newdatabase</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323600__section025425719419"><h4 class="sectiontitle">Deleting a Database</h4><p id="EN-US_TOPIC_0000001188323600__p29356392422">You can run <strong id="EN-US_TOPIC_0000001188323600__b126202815241155">DROP DATABASE</strong> statement to delete a database. This statement deletes the system catalog of the database and the database directory on the disk. Only the database owner or system administrator can delete a database. A database being accessed by users cannot be deleted, You need to connect to another database before deleting this database.</p>
<div class="p" id="EN-US_TOPIC_0000001188323600__p10381143414217">Run the <strong id="EN-US_TOPIC_0000001188323600__b18151515143112">DROP DATABASE</strong> statement to delete a database:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323600__screen6381134114216"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="k">DATABASE</span><span class="w"> </span><span class="n">newdatabase</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0016.html">Defining Database Objects</a></div>
</div>
</div>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,65 @@
<a name="EN-US_TOPIC_0000001188323660"></a><a name="EN-US_TOPIC_0000001188323660"></a>
<h1 class="topictitle1">Creating and Managing Views</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001188323660__p1222114510216">Views allow users to save queries. Views are not physically stored on disks. Queries to a view run as subqueries. A database only stores the definition of a view and does not store its data. The data is still stored in the original base table. If data in the base table changes, the data in the view changes accordingly. In this sense, a view is like a window through which users can know their interested data and data changes in the database. A view is triggered every time it is referenced.</p>
<div class="section" id="EN-US_TOPIC_0000001188323660__se07db171a2b64c3fb143727491321a84"><h4 class="sectiontitle">Creating a view</h4><div class="p" id="EN-US_TOPIC_0000001188323660__p5748154345117">Run the <strong id="EN-US_TOPIC_0000001188323660__b3388382103">CREATE VIEW</strong> command to create a view.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323660__screen4748144395117"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">OR</span><span class="w"> </span><span class="k">REPLACE</span><span class="w"> </span><span class="k">VIEW</span><span class="w"> </span><span class="n">MyView</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">customer</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="n">c_customer_sk</span><span class="w"> </span><span class="o">&lt;</span><span class="w"> </span><span class="mi">150</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="note" id="EN-US_TOPIC_0000001188323660__note1375044310517"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001188323660__p177509433510">The <strong id="EN-US_TOPIC_0000001188323660__b972653521499">OR REPLACE</strong> parameter in this command is optional. It indicates that if the view exists, the new view will replace the existing view.</p>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323660__section58811612145614"><h4 class="sectiontitle">View Details</h4><ul id="EN-US_TOPIC_0000001188323660__ul1935918240561"><li id="EN-US_TOPIC_0000001188323660__ld156225587b74e3b87897058f1c64c01">View the <em id="EN-US_TOPIC_0000001188323660__i1940751652314">MyView</em> view. Real-time data will be returned.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323660__s1c95a4d61a4246e692a17dfe51f3090c"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">myview</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001188323660__l9cb9329987774605ae4dfca6ac7315bb">Run the following command to query the views in the current user:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323660__s36fb946788504784b5fdef0e59badd89"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">user_views</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001188323660__l11ca417ba0314592b8addcf7aceae216">Run the following command to query all views:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323660__s95cf13ccf3134aa7a0b79ff2baafd345"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">dba_views</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001188323660__l9c0976676c1f42e298a5839b786156cd">View details about a specified view.<div class="p" id="EN-US_TOPIC_0000001188323660__af4c6848c60274f1fb2826ab5ac0a1839"><a name="EN-US_TOPIC_0000001188323660__l9c0976676c1f42e298a5839b786156cd"></a><a name="l9c0976676c1f42e298a5839b786156cd"></a>Run the following command to view details about the dba_users view:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323660__s169fca93eb264b91b87f0c3e239ed28d"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span>
<span class="normal">5</span>
<span class="normal">6</span>
<span class="normal">7</span>
<span class="normal">8</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="n">d</span><span class="o">+</span><span class="w"> </span><span class="n">dba_users</span>
<span class="w"> </span><span class="k">View</span><span class="w"> </span><span class="ss">&quot;PG_CATALOG.DBA_USERS&quot;</span>
<span class="w"> </span><span class="k">Column</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">Type</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Modifiers</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">Storage</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Description</span>
<span class="c1">----------+-----------------------+-----------+----------+-------------</span>
<span class="w"> </span><span class="n">USERNAME</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="nb">CHARACTER</span><span class="w"> </span><span class="nb">VARYING</span><span class="p">(</span><span class="mi">64</span><span class="p">)</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">extended</span><span class="w"> </span><span class="o">|</span>
<span class="k">View</span><span class="w"> </span><span class="n">definition</span><span class="p">:</span>
<span class="w"> </span><span class="k">SELECT</span><span class="w"> </span><span class="n">PG_AUTHID</span><span class="p">.</span><span class="n">ROLNAME</span><span class="p">::</span><span class="nb">CHARACTER</span><span class="w"> </span><span class="nb">VARYING</span><span class="p">(</span><span class="mi">64</span><span class="p">)</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">USERNAME</span>
<span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">PG_AUTHID</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323660__section45851157145414"><h4 class="sectiontitle">Rebuilding a View</h4><p id="EN-US_TOPIC_0000001188323660__p183837313551">Run the <strong id="EN-US_TOPIC_0000001188323660__b43816219174">ALTER VIEW</strong> command to rebuild a view without entering query statements.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323660__screen1480125020551"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">VIEW</span><span class="w"> </span><span class="n">myview</span><span class="w"> </span><span class="n">REBUILD</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323660__section15139145913534"><h4 class="sectiontitle">Deleting a View</h4><div class="p" id="EN-US_TOPIC_0000001188323660__p1118103719543">Run the <strong id="EN-US_TOPIC_0000001188323660__b1020032241919">DROP VIEW</strong> command to delete a view.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323660__screen1211893725413"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="k">VIEW</span><span class="w"> </span><span class="n">myview</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</div>
<p id="EN-US_TOPIC_0000001188323660__p18486161614592">DROP VIEW ... The <strong id="EN-US_TOPIC_0000001188323660__b68310464199">CASCADE</strong> command can be used to delete objects that depend on the view. For example, view A depends on view B. If view B is deleted, view A will also be deleted. Without the CASCADE option, the <strong id="EN-US_TOPIC_0000001188323660__b31880972115">DROP VIEW</strong> command will fail.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0016.html">Defining Database Objects</a></div>
</div>
</div>

View File

@ -0,0 +1,95 @@
<a name="EN-US_TOPIC_0000001233883175"></a><a name="EN-US_TOPIC_0000001233883175"></a>
<h1 class="topictitle1">Creating and Using Sequences</h1>
<div id="body1498525234177"><p id="EN-US_TOPIC_0000001233883175__p111618311243">A sequence is a database object that generates unique integers according to a certain rule and is usually used to generate primary key values.</p>
<div class="p" id="EN-US_TOPIC_0000001233883175__p510074455414">You can create a sequence for a column in either of the following methods:<ul id="EN-US_TOPIC_0000001233883175__ul9475346173310"><li id="EN-US_TOPIC_0000001233883175__li6850853153315">Set the data type of a column to sequence integer. A sequence will be automatically created by the database for this column.</li><li id="EN-US_TOPIC_0000001233883175__li15475446203315">Use <strong id="EN-US_TOPIC_0000001233883175__b17633613419">CREATE SEQUENCE</strong> to create a new sequenc. Use the <strong id="EN-US_TOPIC_0000001233883175__b1899031717362">nextval('</strong><em id="EN-US_TOPIC_0000001233883175__i4253142493620">sequence_name</em><strong id="EN-US_TOPIC_0000001233883175__b355862015365">')</strong> function to increment the sequence and return a new value. Specify the default value of the column as the sequence value returned by the <strong id="EN-US_TOPIC_0000001233883175__b161655119375">nextval('</strong>sequence_name<strong id="EN-US_TOPIC_0000001233883175__b1536123193710">')</strong> function. In this way, this column can be used as a unique identifier.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001233883175__sa82c57fda672457ea8c6fa934915ba5c"><h4 class="sectiontitle">Creating a Sequence.</h4><div class="p" id="EN-US_TOPIC_0000001233883175__p19100144410545">Method 1: Set the data type of a column to a sequence integer. For example:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233883175__sa01899b22f364d91badd0a3689d3a53e"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span>
<span class="normal">5</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">T1</span>
<span class="p">(</span>
<span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="nb">serial</span><span class="p">,</span>
<span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="nb">text</span>
<span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
</div>
<p id="EN-US_TOPIC_0000001233883175__a6e8080438eb2433ea9ea9606b5e8c92e">Method 2: Create a sequence and set the initial value of the <strong id="EN-US_TOPIC_0000001233883175__b17032018804161">nextval</strong>('<em id="EN-US_TOPIC_0000001233883175__i12149377144161">sequence_name</em>') function to the default value of a column. You can cache a specific number of sequence values to reduce the requests to the GTM, improving the performance.</p>
<ol id="EN-US_TOPIC_0000001233883175__ol128283377453"><li id="EN-US_TOPIC_0000001233883175__li208281037164517">Create a sequence.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233883175__screen1282893754511"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="n">SEQUENCE</span><span class="w"> </span><span class="n">seq1</span><span class="w"> </span><span class="k">cache</span><span class="w"> </span><span class="mi">100</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001233883175__li15580165544516">Set the initial value of the <strong id="EN-US_TOPIC_0000001233883175__b96682320327">nextval</strong>('<em id="EN-US_TOPIC_0000001233883175__i766818314322">sequence_name</em>') function to the default value of a column.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233883175__screen1858075515456"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span>
<span class="normal">5</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">T2</span><span class="w"> </span>
<span class="p">(</span><span class="w"> </span>
<span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="nb">int</span><span class="w"> </span><span class="k">not</span><span class="w"> </span><span class="k">null</span><span class="w"> </span><span class="k">default</span><span class="w"> </span><span class="n">nextval</span><span class="p">(</span><span class="s1">'seq1'</span><span class="p">),</span>
<span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="nb">text</span>
<span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
</li></ol>
<div class="note" id="EN-US_TOPIC_0000001233883175__nebd89c17c96e4d4281ef4594972b179b"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001233883175__a62e8fcef7cee4ddcba95bdfd41e2ad43">Methods 1 and 2 are similar except that method 2 specifies cache for the sequence. A sequence using cache has holes (non-consecutive values, for example, 1, 4, 5) and cannot keep the order of the values. After a sequence is deleted, its sub-sequences will be deleted automatically. A sequence shared by multiple columns is not forbidden in a database, but you are not advised to do that.</p>
<p id="EN-US_TOPIC_0000001233883175__a712093feed8c415bb59590d3b9dffc0f">Currently, the preceding two methods cannot be used for existing tables.</p>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0000001233883175__section273144710268"><h4 class="sectiontitle">Modifying a Sequence</h4><p id="EN-US_TOPIC_0000001233883175__p17243185212263">The <strong id="EN-US_TOPIC_0000001233883175__b1161884813418">ALTER SEQUENCE</strong> statement changes the attributes of an existing sequence, including the owner, owning column, and maximum value.</p>
<ul id="EN-US_TOPIC_0000001233883175__ul1281573592820"><li id="EN-US_TOPIC_0000001233883175__li2815173516286">Associate the sequence with a column.<p id="EN-US_TOPIC_0000001233883175__p7259193612381"><a name="EN-US_TOPIC_0000001233883175__li2815173516286"></a><a name="li2815173516286"></a>The sequence will be deleted when you delete the column or the table where the column resides.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233883175__saea6cfa21d814de4a659bdd5df63e056"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="n">SEQUENCE</span><span class="w"> </span><span class="n">seq1</span><span class="w"> </span><span class="n">OWNED</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="n">T2</span><span class="p">.</span><span class="n">id</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001233883175__li716964462815">Modify the maximum value of <strong id="EN-US_TOPIC_0000001233883175__b20931699594161">serial</strong> to <strong id="EN-US_TOPIC_0000001233883175__b7295424924161">300</strong>.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233883175__screen69312213114"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="n">SEQUENCE</span><span class="w"> </span><span class="n">seq1</span><span class="w"> </span><span class="k">MAXVALUE</span><span class="w"> </span><span class="mi">300</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001233883175__section148219245186"><h4 class="sectiontitle">Deleting a Sequence</h4><p id="EN-US_TOPIC_0000001233883175__p2142184591812">Run the <strong id="EN-US_TOPIC_0000001233883175__b11952930481">DROP SEQUENCE</strong> command to delete a sequence. For example, to delete the sequence named <strong id="EN-US_TOPIC_0000001233883175__b1479516496818">seq1</strong>, run the following command:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233883175__screen1559112539181"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="n">SEQUENCE</span><span class="w"> </span><span class="n">seq1</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001233883175__s100b6d4658154113becab048fd2be2e2"><h4 class="sectiontitle">Precautions</h4><p id="EN-US_TOPIC_0000001233883175__a0f82b560bdf74713b18ce50436723504">Sequence values are generated by the GTM. By default, each request for a sequence value is sent to the GTM. The GTM calculates the result of the current value plus the step and then returns the result. As GTM is a globally unique node, generating default sequence numbers can cause performance issues. For operations that need frequent sequence number generation, such as bulkload data import, this is not recommended. For example, the <strong id="EN-US_TOPIC_0000001233883175__b4982598334161">INSERT FROM SELECT</strong> statement has poor performance in the following scenario:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233883175__s9a3a6763887b4f3d8ced3cb3bbe13fe7"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span>
<span class="normal">5</span>
<span class="normal">6</span>
<span class="normal">7</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="n">SEQUENCE</span><span class="w"> </span><span class="n">newSeq1</span><span class="p">;</span>
<span class="k">CREATE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">newT1</span>
<span class="w"> </span><span class="p">(</span><span class="w"> </span>
<span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="nb">int</span><span class="w"> </span><span class="k">not</span><span class="w"> </span><span class="k">null</span><span class="w"> </span><span class="k">default</span><span class="w"> </span><span class="n">nextval</span><span class="p">(</span><span class="s1">'newSeq1'</span><span class="p">),</span><span class="w"> </span>
<span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="nb">text</span>
<span class="w"> </span><span class="p">);</span>
<span class="k">INSERT</span><span class="w"> </span><span class="k">INTO</span><span class="w"> </span><span class="n">newT1</span><span class="p">(</span><span class="n">name</span><span class="p">)</span><span class="w"> </span><span class="k">SELECT</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="k">from</span><span class="w"> </span><span class="n">T1</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001233883175__aa8ad7b8ae6e04785960cecac9f9f96c8">To improve the performance, run the following statements (assume that data of 10,000 rows will be imported from <em id="EN-US_TOPIC_0000001233883175__i2561207904161">T1</em> to <em id="EN-US_TOPIC_0000001233883175__i3796884644161">newT1</em>):</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233883175__s8dbe067a7f0e4b47b3012e9afd34e403"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">INSERT</span><span class="w"> </span><span class="k">INTO</span><span class="w"> </span><span class="n">newT1</span><span class="p">(</span><span class="n">id</span><span class="p">,</span><span class="w"> </span><span class="n">name</span><span class="p">)</span><span class="w"> </span><span class="k">SELECT</span><span class="w"> </span><span class="n">id</span><span class="p">,</span><span class="n">name</span><span class="w"> </span><span class="k">from</span><span class="w"> </span><span class="n">T1</span><span class="p">;</span>
<span class="k">SELECT</span><span class="w"> </span><span class="n">SETVAL</span><span class="p">(</span><span class="s1">'newSeq1'</span><span class="p">,</span><span class="mi">10000</span><span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
<div class="note" id="EN-US_TOPIC_0000001233883175__n1b3ef94778f74cc3a4efd6a73efa3cc9"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001233883175__ad47cc27e4a0a4a50b54b0b2cc52a021f">Rollback is not supported by sequence functions, including <strong id="EN-US_TOPIC_0000001233883175__b1438019201391">nextval()</strong> and <strong id="EN-US_TOPIC_0000001233883175__b324432417916">setval()</strong>. The value of the setval function immediately takes effects on nextval in the current session in any cases and takes effects in other sessions only when no cache is specified for them. If cache is specified for a session, it takes effect only after all the cached values have been used. To avoid duplicate values, use setval only when necessary. Do not set it to an existing sequence value or a cached sequence value.</p>
</div></div>
<p id="EN-US_TOPIC_0000001233883175__a63d1fabfa19e48b8a851454b0e0b1ea2">If BulkLoad is used, set sufficient cache for <em id="EN-US_TOPIC_0000001233883175__i203932248013">newSeq1</em> and do not set <strong id="EN-US_TOPIC_0000001233883175__b134320561707">Maxvalue</strong> or <strong id="EN-US_TOPIC_0000001233883175__b143615310112">Minvalue</strong>. To improve the performance, database may push down the invocation of <strong id="EN-US_TOPIC_0000001233883175__b139991101526">nextval</strong>('<em id="EN-US_TOPIC_0000001233883175__i418919151426">sequence_name</em>') to DNs. Currently, the concurrent connection requests that can be processed by the GTM are limited. If there are too many DNs, a large number of concurrent connection requests will be sent to the GTM. In this case, you need to limit the concurrent connection of BulkLoad to save the GTM connection resources. If the target table is a replication table (<strong id="EN-US_TOPIC_0000001233883175__b366243584161">DISTRIBUTE BY REPLICATION</strong>), pushdown cannot be performed. If the data volume is large, this will be a disaster for the database. In addition, the database space may be exhausted. After the import is complete, do <strong id="EN-US_TOPIC_0000001233883175__b19755615194161">VACUUM FULL</strong>. Therefore, you are not advised to use sequences when BulkLoad is used.</p>
<p id="EN-US_TOPIC_0000001233883175__ab0129c2c35274c51a5a6fed52b8ad40f">After a sequence is created, a single-row table is maintained on each node to store the sequence definition and value, which is obtained from the last interaction with the GTM rather than updated in real time. The single-row table on a node does not update when other nodes request a new value from the GTM or when the sequence is modified using <strong id="EN-US_TOPIC_0000001233883175__b197180393312620">setval</strong>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0016.html">Defining Database Objects</a></div>
</div>
</div>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
<a name="EN-US_TOPIC_0000001098814874"></a><a name="EN-US_TOPIC_0000001098814874"></a> <a name="EN-US_TOPIC_0000001233883333"></a><a name="EN-US_TOPIC_0000001233883333"></a>
<h1 class="topictitle1">Database Security Management</h1> <h1 class="topictitle1">Database Security Management</h1>
<div id="body1494318882616"><p id="EN-US_TOPIC_0000001098814874__en-us_topic_0059778204_p8060118"></p> <div id="body1494318882616"><p id="EN-US_TOPIC_0000001233883333__en-us_topic_0059778204_p8060118"></p>
</div> </div>
<div> <div>
<ul class="ullinks"> <ul class="ullinks">
@ -10,9 +10,5 @@
<li class="ulchildlink"><strong><a href="dws_04_0994.html">Sensitive Data Management</a></strong><br> <li class="ulchildlink"><strong><a href="dws_04_0994.html">Sensitive Data Management</a></strong><br>
</li> </li>
</ul> </ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_1000.html">Developer Guide</a></div>
</div>
</div> </div>

View File

@ -1,25 +1,19 @@
<a name="EN-US_TOPIC_0000001099134534"></a><a name="EN-US_TOPIC_0000001099134534"></a> <a name="EN-US_TOPIC_0000001233681671"></a><a name="EN-US_TOPIC_0000001233681671"></a>
<h1 class="topictitle1">Managing Users and Their Permissions</h1> <h1 class="topictitle1">Managing Users and Their Permissions</h1>
<div id="body8662426"></div> <div id="body8662426"></div>
<div> <div>
<ul class="ullinks"> <ul class="ullinks">
<li class="ulchildlink"><strong><a href="dws_04_0054.html">Default Permission Mechanism</a></strong><br> <li class="ulchildlink"><strong><a href="dws_04_0055.html">Database Users</a></strong><br>
</li> </li>
<li class="ulchildlink"><strong><a href="dws_04_0055.html">System Administrator</a></strong><br> <li class="ulchildlink"><strong><a href="dws_04_0057.html">User Management</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0063.html">User-defined Password Policy</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0054.html">Permissions Management</a></strong><br>
</li> </li>
<li class="ulchildlink"><strong><a href="dws_04_0056.html">Separation of Permissions</a></strong><br> <li class="ulchildlink"><strong><a href="dws_04_0056.html">Separation of Permissions</a></strong><br>
</li> </li>
<li class="ulchildlink"><strong><a href="dws_04_0057.html">Users</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0058.html">Roles</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0059.html">Schema</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0060.html">User Permission Setting</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0063.html">Setting Security Policies</a></strong><br>
</li>
</ul> </ul>
<div class="familylinks"> <div class="familylinks">

View File

@ -1,12 +1,90 @@
<a name="EN-US_TOPIC_0000001099134980"></a><a name="EN-US_TOPIC_0000001099134980"></a> <a name="EN-US_TOPIC_0000001188323582"></a><a name="EN-US_TOPIC_0000001188323582"></a>
<h1 class="topictitle1">Default Permission Mechanism</h1> <h1 class="topictitle1">Permissions Management</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001099134980__p101295419267">A user who creates an object is the owner of this object. By default, <a href="dws_04_0056.html">Separation of Permissions</a> is disabled after cluster installation. A database system administrator has the same permissions as object owners. After an object is created, only the object owner or system administrator can query, modify, and delete the object, and grant permissions for the object to other users through <strong id="EN-US_TOPIC_0000001099134980__b9556629162810">GRANT</strong> by default.</p> <div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001188323582__section8563415142017"><h4 class="sectiontitle">Permission Overview</h4><p id="EN-US_TOPIC_0000001188323582__p558215264394"><strong id="EN-US_TOPIC_0000001188323582__b6813193733114">Permissions</strong> are used to control whether a user is allowed to access a database object (including schemas, tables, functions, and sequences) to perform operations such as adding, deleting, modifying, querying, and creating a database object.</p>
<p id="EN-US_TOPIC_0000001099134980__a45227246018148928ad6033926a11b30">To enable another user to use the object, grant required permissions to the user or the role that contains the user.</p> <p id="EN-US_TOPIC_0000001188323582__p1828011289417">Permission management in GaussDB(DWS) falls into three categories:</p>
<p id="EN-US_TOPIC_0000001099134980__aacde223903c84a3b9173c934213a0dfd"><span id="EN-US_TOPIC_0000001099134980__text53201100">GaussDB(DWS)</span> supports the following permissions: <strong id="EN-US_TOPIC_0000001099134980__b1426917214249">SELECT</strong>, <strong id="EN-US_TOPIC_0000001099134980__b92697210246">INSERT</strong>, <strong id="EN-US_TOPIC_0000001099134980__b1426913215245">UPDATE</strong>, <strong id="EN-US_TOPIC_0000001099134980__b1527017252412">DELETE</strong>, <strong id="EN-US_TOPIC_0000001099134980__b22702232415">TRUNCATE</strong>, <strong id="EN-US_TOPIC_0000001099134980__b627014282413">REFERENCES</strong>, <strong id="EN-US_TOPIC_0000001099134980__b1027114232419">CREATE</strong>, <strong id="EN-US_TOPIC_0000001099134980__b15271122112419">CONNECT</strong>, <strong id="EN-US_TOPIC_0000001099134980__b1627112212247">EXECUTE</strong>, <strong id="EN-US_TOPIC_0000001099134980__b1727182162418">USAGE</strong> and <strong id="EN-US_TOPIC_0000001099134980__b12721824243">ANALYZE</strong>|<strong id="EN-US_TOPIC_0000001099134980__b62721328241">ANALYSE</strong>. Permission types are associated with object types. For permission details, see GRANT.</p> <ul id="EN-US_TOPIC_0000001188323582__ul64171044132518"><li id="EN-US_TOPIC_0000001188323582__li18417114442513">System permissions<p id="EN-US_TOPIC_0000001188323582__aa9331f78835c4effb59ae7315462f8ea"><a name="EN-US_TOPIC_0000001188323582__li18417114442513"></a><a name="li18417114442513"></a>System permissions are also called user attributes, including <strong id="EN-US_TOPIC_0000001188323582__b189302707011452">SYSADMIN</strong>, <strong id="EN-US_TOPIC_0000001188323582__b36781261111452">CREATEDB</strong>, <strong id="EN-US_TOPIC_0000001188323582__b132633487611452">CREATEROLE</strong>, <strong id="EN-US_TOPIC_0000001188323582__b22355050811452">AUDITADMIN</strong>, and <strong id="EN-US_TOPIC_0000001188323582__b146348538011452">LOGIN</strong>.</p>
<p id="EN-US_TOPIC_0000001099134980__a3188c787c3ae4532a0b24724dce9cb59">To remove permissions, use <strong id="EN-US_TOPIC_0000001099134980__b12974172515288">REVOKE</strong>. Object owner permissions such as <strong id="EN-US_TOPIC_0000001099134980__b49241749144815">ALTER</strong>, <strong id="EN-US_TOPIC_0000001099134980__b20924164974812">DROP</strong>, <strong id="EN-US_TOPIC_0000001099134980__b2924849114818">GRANT</strong>, and <strong id="EN-US_TOPIC_0000001099134980__b1692534924819">REVOKE</strong> are implicit and cannot be granted or revoked. That is, you have the implicit permissions for an object if you are the owner of the object. Object owners can remove their own common permissions, for example, making tables read-only to themselves or others.</p> <p id="EN-US_TOPIC_0000001188323582__ac511275173b146c7a3d5c1117cda40fb">They can be specified only by the <strong id="EN-US_TOPIC_0000001188323582__b90868937911452">CREATE ROLE</strong> or <strong id="EN-US_TOPIC_0000001188323582__b103038887711452">ALTER ROLE</strong> syntax. The <strong id="EN-US_TOPIC_0000001188323582__b150045422911452">SYSADMIN</strong> permission can be granted and revoked using <strong id="EN-US_TOPIC_0000001188323582__b174903650611452">GRANT ALL PRIVILEGE</strong> and <strong id="EN-US_TOPIC_0000001188323582__b3313159811452">REVOKE ALL PRIVILEGE</strong>, respectively. System permissions cannot be inherited by a user from a role, and cannot be granted using <strong id="EN-US_TOPIC_0000001188323582__b175146477411452">PUBLIC</strong>.</p>
<p id="EN-US_TOPIC_0000001099134980__en-us_topic_0155088780_p848218311083">System catalogs and views are visible to either system administrators or all users. System catalogs and views that require system administrator permissions can be queried only by system administrators. For details, see <a href="dws_04_0559.html">System Catalogs and System Views</a>.</p> </li></ul>
<p id="EN-US_TOPIC_0000001099134980__p1995746192320">The database provides the object isolation feature. If this feature is enabled, users can view only the objects (tables, views, columns, and functions) that they have the permission to access. System administrators are not affected by this feature. For details, see ALTER DATABASE.</p> <ul id="EN-US_TOPIC_0000001188323582__ul1391012488251"><li id="EN-US_TOPIC_0000001188323582__li391094882516">Object permissions<p id="EN-US_TOPIC_0000001188323582__p224352616259"><a name="EN-US_TOPIC_0000001188323582__li391094882516"></a><a name="li391094882516"></a>Permissions on a database object (table, view, column, database, function, schema, or tablespace) can be granted to a role or user. The <strong id="EN-US_TOPIC_0000001188323582__b40240465111452">GRANT</strong> command can be used to grant permissions to a user or role. These permissions granted are added to the existing ones.</p>
</li><li id="EN-US_TOPIC_0000001188323582__li98127462258">Permissions<p id="EN-US_TOPIC_0000001188323582__a491f58fdf9724a56b29f11cbd156ae08"><a name="EN-US_TOPIC_0000001188323582__li98127462258"></a><a name="li98127462258"></a>Grant a role's or user's permissions to one or more roles or users. In this case, every role or user can be regarded as a set of one or more database permissions.</p>
<p id="EN-US_TOPIC_0000001188323582__abfac7b4c22ac4671b866b61c633faa8f">If <strong id="EN-US_TOPIC_0000001188323582__b121349498811452">WITH ADMIN OPTION</strong> is specified, the member can in turn grant permissions in the role to others, and revoke permissions in the role as well. If a role or user granted with certain permissions is changed or revoked, the permissions inherited from the role or user also change.</p>
<p id="EN-US_TOPIC_0000001188323582__aa7f9eff33e96410b9828534c5949b984">A database administrator can grant permissions to and revoke them from any role or user. Roles having <strong id="EN-US_TOPIC_0000001188323582__b26785177911452">CREATEROLE</strong> permission can grant or revoke membership in any role that is not an administrator.</p>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323582__section21073283249"><h4 class="sectiontitle">Hierarchical Permission Management</h4><p id="EN-US_TOPIC_0000001188323582__p19650134114265">GaussDB(DWS) implements a hierarchical permission management on databases, schemas, and data objects.</p>
<ul id="EN-US_TOPIC_0000001188323582__ul1783019211233"><li id="EN-US_TOPIC_0000001188323582__li16830121732">Databases cannot communicate with each other and share very few resources. Their connections and permissions can be isolated. The database cluster has one or more named databases. Users and roles are shared within the entire cluster, but their data is not shared. That is, a user can connect to any database, but after the connection is successful, any user can access only the database declared in the connection request.</li><li id="EN-US_TOPIC_0000001188323582__li683002120316">Schemas share more resources than databases do. User permissions on schemas and subordinate objects can be flexibly configured using the <strong id="EN-US_TOPIC_0000001188323582__b43506685911452">GRANT</strong> and <strong id="EN-US_TOPIC_0000001188323582__b76023925111452">REVOKE</strong> syntax. Each database has one or more schemas. Each schema contains various types of objects, such as tables, views, and functions. To access an object contained in a specified schema, a user must have the <strong id="EN-US_TOPIC_0000001188323582__b98525806123017">USAGE </strong>permission on the schema.</li><li id="EN-US_TOPIC_0000001188323582__li9214171011443">After an object is created, by default, only the object owner or system administrator can query, modify, and delete the object. To access a specific database object, for example, <strong id="EN-US_TOPIC_0000001188323582__b212517723614">table1</strong>, other users must be granted the <strong id="EN-US_TOPIC_0000001188323582__b1120915118365">CONNECT </strong>permission of database, the <strong id="EN-US_TOPIC_0000001188323582__b1436411149368">USAGE </strong>permission of schema, and the <strong id="EN-US_TOPIC_0000001188323582__b19522201923611">SELECT </strong>permission of <strong id="EN-US_TOPIC_0000001188323582__b4522122110369">table1</strong>. To access an object at the bottom layer, a user must be granted the permission on the object at the upper layer. To create or delete a schema, you must have the <strong id="EN-US_TOPIC_0000001188323582__b79324495811452">CREATE</strong> permission on its database.</li></ul>
<div class="fignone" id="EN-US_TOPIC_0000001188323582__fig1881004519237"><span class="figcap"><b>Figure 1 </b>Hierarchical Permission Management</span><br><span><img id="EN-US_TOPIC_0000001188323582__image19811745162313" src="figure/en-us_image_0000001526705437.png"></span></div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323582__section764344122017"><h4 class="sectiontitle">Roles</h4><p id="EN-US_TOPIC_0000001188323582__p594492172313">The permission management model of GaussDB(DWS) is a typical implementation of the role-based permission control (RBAC). It manages users, roles, and permissions through this model.</p>
<p id="EN-US_TOPIC_0000001188323582__p18997124010386">A role is a set of permissions.</p>
<ul id="EN-US_TOPIC_0000001188323582__ul1069211115236"><li id="EN-US_TOPIC_0000001188323582__li14692171112239">The concept of "user" is equivalent to that of "role". The only difference is that "user" has the <strong id="EN-US_TOPIC_0000001188323582__b179722174382">login </strong>permission while "role" has the <strong id="EN-US_TOPIC_0000001188323582__b25263205380">nologin </strong>permission.</li><li id="EN-US_TOPIC_0000001188323582__li56921211152318">Roles are assigned with different permissions based on their responsibilities in the database system. A role is a set of database permissions and represents the behavior constraints of a database user or a group of data users.</li><li id="EN-US_TOPIC_0000001188323582__li1169271112236">Roles and users can be converted. You can use <strong id="EN-US_TOPIC_0000001188323582__b94823194391">ALTER </strong>to assign the <strong id="EN-US_TOPIC_0000001188323582__b202096210394">login </strong>permission to a role.</li><li id="EN-US_TOPIC_0000001188323582__li196925116231">After a role is granted to a user through <strong id="EN-US_TOPIC_0000001188323582__b167044716011452">GRANT</strong>, the user will have all the permissions of the role. It is recommended that roles be used to efficiently grant permissions. For example, you can create different roles of design, development, and maintenance personnel, grant the roles to users, and then grant specific data permissions required by different users. When permissions are granted or revoked at the role level, these permission changes take effect for all the members of the role.</li><li id="EN-US_TOPIC_0000001188323582__li2537471961">In non-separation-of-duty scenarios, a role can be created, modified, and deleted only by a system administrator or a user with the <strong id="EN-US_TOPIC_0000001188323582__b40108962911452">CREATEROLE</strong> attribute. In separation-of-duty scenarios, a role can be created, modified, and deleted only by a user with the <strong id="EN-US_TOPIC_0000001188323582__b102587796011452">CREATEROLE</strong> attribute.</li></ul>
<p id="EN-US_TOPIC_0000001188323582__af29398cff1464bd1ba13906817e39c79">To view all roles, query the system catalog <strong id="EN-US_TOPIC_0000001188323582__b86742016411452">PG_ROLES</strong>.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323582__sd4f5e25ffae840afadfe668712024ec2"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">PG_ROLES</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001188323582__p75512171567">For details about how to create, modify, and delete a role, see <strong id="EN-US_TOPIC_0000001188323582__b8884826204013">CREARE ROLE</strong>/<strong id="EN-US_TOPIC_0000001188323582__b16541829144012">ALTER ROLE</strong>/<strong id="EN-US_TOPIC_0000001188323582__b441763312404">DROP ROLE</strong> in <em id="EN-US_TOPIC_0000001188323582__i148251911405">SQL Syntax Reference</em>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323582__section1347652012418"><h4 class="sectiontitle">Preset Roles</h4><p id="EN-US_TOPIC_0000001188323582__p1766772684413"><span id="EN-US_TOPIC_0000001188323582__text139660670611452">GaussDB(DWS)</span> provides a group of preset roles. Their names start with <strong id="EN-US_TOPIC_0000001188323582__b115378953011452">gs_role_</strong>. These roles allow access to operations that require high permissions. You can grant these roles to other users or roles in the database for them to access or use specific information and functions. Exercise caution and ensure security when using preset roles.</p>
<p id="EN-US_TOPIC_0000001188323582__p13459145614515">The following table describes the permissions of preset roles.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188323582__table4661394449" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Permissions of preset roles</caption><thead align="left"><tr id="EN-US_TOPIC_0000001188323582__row13674391449"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.4.2.3.1.1"><p id="EN-US_TOPIC_0000001188323582__p468133913446">Role</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="75%" id="mcps1.3.4.4.2.3.1.2"><p id="EN-US_TOPIC_0000001188323582__p116843910441">Permission</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001188323582__row176814394444"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001188323582__p1268113954415">gs_role_signal_backend</p>
</td>
<td class="cellrowborder" valign="top" width="75%" headers="mcps1.3.4.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001188323582__p06823917443">Invokes functions such as <strong id="EN-US_TOPIC_0000001188323582__b121318786811452">pg_cancel_backend</strong>, <strong id="EN-US_TOPIC_0000001188323582__b85122045011452">pg_terminate_backend</strong>, <strong id="EN-US_TOPIC_0000001188323582__b65211112811452">pg_terminate_query</strong>, <strong id="EN-US_TOPIC_0000001188323582__b30098076711452">pg_cancel_query</strong>, <strong id="EN-US_TOPIC_0000001188323582__b66596661811452">pgxc_terminate_query</strong>, and <strong id="EN-US_TOPIC_0000001188323582__b190239757711452">pgxc_cancel_query</strong> to cancel or terminate sessions, excluding those of the initial users.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188323582__row1681139104412"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001188323582__p1968103917444">gs_role_read_all_stats</p>
</td>
<td class="cellrowborder" valign="top" width="75%" headers="mcps1.3.4.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001188323582__p871582612481">Reads the system status view and uses various extension-related statistics, including information that is usually visible only to system administrators. For example:</p>
<p id="EN-US_TOPIC_0000001188323582__p118732471465">Resource management views:</p>
<ul id="EN-US_TOPIC_0000001188323582__ul64973711476"><li id="EN-US_TOPIC_0000001188323582__li1576714100472">pgxc_wlm_operator_history</li><li id="EN-US_TOPIC_0000001188323582__li1850121284713">pgxc_wlm_operator_info</li><li id="EN-US_TOPIC_0000001188323582__li473931434717">pgxc_wlm_operator_statistics</li><li id="EN-US_TOPIC_0000001188323582__li9571116134717">pgxc_wlm_session_info</li><li id="EN-US_TOPIC_0000001188323582__li1038902017476">pgxc_wlm_session_statistics</li><li id="EN-US_TOPIC_0000001188323582__li1989321154714">pgxc_wlm_workload_records</li><li id="EN-US_TOPIC_0000001188323582__li7541112454719">pgxc_workload_sql_count</li><li id="EN-US_TOPIC_0000001188323582__li1840562654720">pgxc_workload_sql_elapse_time</li><li id="EN-US_TOPIC_0000001188323582__li79491432174820">pgxc_workload_transaction</li></ul>
<p id="EN-US_TOPIC_0000001188323582__p7914114164817">Status information views:</p>
<ul id="EN-US_TOPIC_0000001188323582__ul4962184114483"><li id="EN-US_TOPIC_0000001188323582__li59608417487">pgxc_stat_activity</li><li id="EN-US_TOPIC_0000001188323582__li1871864604813">pgxc_get_table_skewness</li><li id="EN-US_TOPIC_0000001188323582__li8676548154819">table_distribution</li><li id="EN-US_TOPIC_0000001188323582__li893495011483">pgxc_total_memory_detail</li><li id="EN-US_TOPIC_0000001188323582__li1696274134817">pgxc_os_run_info</li><li id="EN-US_TOPIC_0000001188323582__li20962184111489">pg_nodes_memory</li><li id="EN-US_TOPIC_0000001188323582__li8962941154811">pgxc_instance_time</li><li id="EN-US_TOPIC_0000001188323582__li16962164154810">pgxc_redo_stat</li></ul>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188323582__row193591543331"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001188323582__p63601443439">gs_role_analyze_any</p>
</td>
<td class="cellrowborder" valign="top" width="75%" headers="mcps1.3.4.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001188323582__p191891611544">A user with the system-level <strong id="EN-US_TOPIC_0000001188323582__b48683385211452">ANALYZE</strong> permission can skip the schema permission check and perform <strong id="EN-US_TOPIC_0000001188323582__b32208375011452">ANALYZE</strong> on all tables.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188323582__row5476048738"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001188323582__p124761648039">gs_role_vacuum_any</p>
</td>
<td class="cellrowborder" valign="top" width="75%" headers="mcps1.3.4.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001188323582__p11189211548">A user with the system-level <strong id="EN-US_TOPIC_0000001188323582__b177375898711452">VACUUM</strong> permission can skip the schema permission check and perform <strong id="EN-US_TOPIC_0000001188323582__b16700219011452">ANALYZE</strong> on all tables.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0000001188323582__p540455112135"><strong id="EN-US_TOPIC_0000001188323582__b3614914175813">Restrictions on using preset roles:</strong></p>
<ul id="EN-US_TOPIC_0000001188323582__ul1404155141318"><li id="EN-US_TOPIC_0000001188323582__li740455181317"><strong id="EN-US_TOPIC_0000001188323582__b195015343711452">gs_role_</strong> is the name field dedicated to preset roles in the database. Do not create users or roles starting with <strong id="EN-US_TOPIC_0000001188323582__b16509430011452">gs_role_</strong> or rename existing users or roles starting with <strong id="EN-US_TOPIC_0000001188323582__b36505684011452">gs_role_</strong>.</li><li id="EN-US_TOPIC_0000001188323582__li20404205111311">Do not perform <strong id="EN-US_TOPIC_0000001188323582__b107550735011452">ALTER </strong>or <strong id="EN-US_TOPIC_0000001188323582__b98811575411452">DROP </strong>operations on preset roles.</li><li id="EN-US_TOPIC_0000001188323582__li14041951141312">By default, a preset role does not have the <strong id="EN-US_TOPIC_0000001188323582__b139146473711452">LOGIN </strong>permission, so there is no preset login password for the role.</li><li id="EN-US_TOPIC_0000001188323582__li14405165118134">The gsql meta-commands <strong id="EN-US_TOPIC_0000001188323582__b159284703411452">\du</strong> and <strong id="EN-US_TOPIC_0000001188323582__b205489844811452">\dg</strong> do not display information about preset roles. However, if <strong id="EN-US_TOPIC_0000001188323582__b206473951711452">PATTERN </strong>is specified, information about preset roles will be displayed.</li><li id="EN-US_TOPIC_0000001188323582__li11405145119133">If the separation of permissions is disabled, the system administrator and users with the <strong id="EN-US_TOPIC_0000001188323582__b166006394211452">ADMIN OPTION</strong> permission of preset roles are allowed to perform GRANT and REVOKE operations on preset roles. If the separation of permissions is enabled, the security administrator (with the <strong id="EN-US_TOPIC_0000001188323582__b204028199411452">CREATEROLE </strong>attribute) and users with the <strong id="EN-US_TOPIC_0000001188323582__b157204735711452">ADMIN OPTION</strong> permission of preset roles are allowed to perform GRANT and REVOKE operations on preset roles. Example:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323582__screen946512153142"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">GRANT</span><span class="w"> </span><span class="n">gs_role_signal_backend</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">user1</span><span class="p">;</span><span class="w"> </span>
<span class="k">REVOKE</span><span class="w"> </span><span class="n">gs_role_signal_backend</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">user1</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323582__section15972183943314"><h4 class="sectiontitle">Granting or Revoking Permissions</h4><p id="EN-US_TOPIC_0000001188323582__p341575218368">A user who creates an object is the owner of this object. By default, <a href="dws_04_0056.html">Separation of Permissions</a> is disabled after cluster installation. A database system administrator has the same permissions as object owners.</p>
<p id="EN-US_TOPIC_0000001188323582__p101295419267">After an object is created, only the object owner or system administrator can query, modify, and delete the object, and grant permissions for the object to other users through <strong id="EN-US_TOPIC_0000001188323582__b114404277011452">GRANT</strong> by default. To enable a user to use an object, the object owner or administrator can run the <strong id="EN-US_TOPIC_0000001188323582__b828810525440">GRANT </strong>or <strong id="EN-US_TOPIC_0000001188323582__b1349075494418">REVOKE </strong>command to grant permissions to or revoke permissions from the user or role.</p>
<ul id="EN-US_TOPIC_0000001188323582__ul27611731229"><li id="EN-US_TOPIC_0000001188323582__li117615317217">Run the <strong id="EN-US_TOPIC_0000001188323582__b270611249451">GRANT </strong>statement to grant permissions.<div class="p" id="EN-US_TOPIC_0000001188323582__p13981243143818">For example, grant the permission of schema <strong id="EN-US_TOPIC_0000001188323582__b647710141549">myschema </strong>to role <strong id="EN-US_TOPIC_0000001188323582__b16871716105414">u1</strong>, and grant the <strong id="EN-US_TOPIC_0000001188323582__b166051719105419">SELECT </strong>permission of table <strong id="EN-US_TOPIC_0000001188323582__b1533722611546">myschema.t1</strong> to role <strong id="EN-US_TOPIC_0000001188323582__b86862916548">u1</strong>.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188323582__sfd7c911cc86147dcadd1c3f050bf3903"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">GRANT</span><span class="w"> </span><span class="k">USAGE</span><span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="k">SCHEMA</span><span class="w"> </span><span class="n">myschema</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">u1</span><span class="p">;</span>
<span class="k">GRANT</span><span class="w"> </span><span class="k">SELECT</span><span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">myschema</span><span class="p">.</span><span class="n">t1</span><span class="w"> </span><span class="k">to</span><span class="w"> </span><span class="n">u1</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</div>
</li></ul>
<ul id="EN-US_TOPIC_0000001188323582__u4d00d0b1312f4bfd98f628d76c4c33a3"><li id="EN-US_TOPIC_0000001188323582__li19740801212">Run the <strong id="EN-US_TOPIC_0000001188323582__b189491218577">REVOKE </strong>command to revoke a permission that has been granted.<div class="p" id="EN-US_TOPIC_0000001188323582__p994041129">For example, revoke all permissions of user <strong id="EN-US_TOPIC_0000001188323582__b1879793419452">u1 </strong>on the <strong id="EN-US_TOPIC_0000001188323582__b145831937154516">myschema.t1</strong> table.<pre class="screen" id="EN-US_TOPIC_0000001188323582__screen117241079509">REVOKE ALL PRIVILEGES ON <em id="EN-US_TOPIC_0000001188323582__i137292775015">myschema.t1</em> FROM u1; </pre>
</div>
</li></ul>
</div>
</div> </div>
<div> <div>
<div class="familylinks"> <div class="familylinks">

View File

@ -1,19 +1,55 @@
<a name="EN-US_TOPIC_0000001098814672"></a><a name="EN-US_TOPIC_0000001098814672"></a> <a name="EN-US_TOPIC_0000001188323750"></a><a name="EN-US_TOPIC_0000001188323750"></a>
<h1 class="topictitle1">System Administrator</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001098814672__ad3bd501facb54ec7b5b5e235ef6a398e">A system administrator is an account with the <strong id="EN-US_TOPIC_0000001098814672__b1722631173520">SYSADMIN</strong> permission. After a cluster is installed, a system administrator has the permissions of all object owners by default.</p>
<p id="EN-US_TOPIC_0000001098814672__a8d3593bc99c94fa0a26216922d49b221">The user <strong id="EN-US_TOPIC_0000001098814672__b132202910109">dbadmin</strong> created upon <span id="EN-US_TOPIC_0000001098814672__text262436061">GaussDB(DWS)</span> startup is a system administrator.</p>
<p id="EN-US_TOPIC_0000001098814672__a4910b68a0fc641e580c5934575c0dcc7">To create a database administrator, connect to the database as an administrator and run the <strong id="EN-US_TOPIC_0000001098814672__b11170121161">CREATE USER</strong> or <strong id="EN-US_TOPIC_0000001098814672__b195017611612">ALTER</strong> statement with <strong id="EN-US_TOPIC_0000001098814672__b7373144774718">SYSADMIN</strong> specified.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001098814672__s675f356958a54cd7b8454ffd3f38fbcd"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">sysadmin</span><span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="n">SYSADMIN</span><span class="w"> </span><span class="n">password</span><span class="w"> </span><span class="s1">'password'</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
<h1 class="topictitle1">Database Users</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001188323750__p254220444810">Without separation of permissions, GaussDB(DWS) supports two types of database accounts: administrator and common user. For details about user types and permissions under separation of permissions, see <a href="dws_04_0056.html">Separation of Permissions</a>.</p>
<ul id="EN-US_TOPIC_0000001188323750__ul1868561754819"><li id="EN-US_TOPIC_0000001188323750__li968617177487">The administrator can manage all common users and databases.</li><li id="EN-US_TOPIC_0000001188323750__li20686201718485">Common users can connect to and access the database, and perform specific database operations and execute SQL statements after being authorized.</li></ul>
<p id="EN-US_TOPIC_0000001188323750__p81191305346">Users are authenticated when they log in to the <span id="EN-US_TOPIC_0000001188323750__text861939956">GaussDB(DWS)</span> database. A user can own databases and database objects (such as tables), and grant permissions of these objects to other users and roles. In addition to system administrators, users with the <strong id="EN-US_TOPIC_0000001188323750__b50960243011512">CREATEDB</strong> attribute can create databases and grant permissions to these databases.</p>
<div class="section" id="EN-US_TOPIC_0000001188323750__section6579918144510"><h4 class="sectiontitle">Database User Types</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188323750__table15592195131713" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Database user types</caption><thead align="left"><tr id="EN-US_TOPIC_0000001188323750__row15931501711"><th align="left" class="cellrowborder" valign="top" width="10%" id="mcps1.3.4.2.2.5.1.1"><p id="EN-US_TOPIC_0000001188323750__p195942514179">User Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.2.5.1.2"><p id="EN-US_TOPIC_0000001188323750__p1117103952910">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="35%" id="mcps1.3.4.2.2.5.1.3"><p id="EN-US_TOPIC_0000001188323750__p8594185111719">Allowed Operations</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="35%" id="mcps1.3.4.2.2.5.1.4"><p id="EN-US_TOPIC_0000001188323750__p47771456153619">How to Create</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001188323750__row20594135111713"><td class="cellrowborder" valign="top" width="10%" headers="mcps1.3.4.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001188323750__p17594115191710">Administrator <strong id="EN-US_TOPIC_0000001188323750__b13783125852518">dbadmin</strong></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001188323750__p269073052517">An administrator, also called a system administrator, is an account with the <strong id="EN-US_TOPIC_0000001188323750__b7617351135413">SYSADMIN </strong>attribute.</p>
</td>
<td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.4.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001188323750__p1159535141712">If separation of permissions is not enabled, this account has the highest permission in the system and can perform all operations. The system administrator has the same permissions as the object owner.</p>
</td>
<td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.4.2.2.5.1.4 "><ul id="EN-US_TOPIC_0000001188323750__ul131441459202914"><li id="EN-US_TOPIC_0000001188323750__li166343714309">User <strong id="EN-US_TOPIC_0000001188323750__b115595432618">dbadmin </strong>created during cluster creation on the GaussDB(DWS) management console is a system administrator.</li><li id="EN-US_TOPIC_0000001188323750__li7145125922912">Use the <strong id="EN-US_TOPIC_0000001188323750__b1719124812274">CREATE USER</strong> or <strong id="EN-US_TOPIC_0000001188323750__b17456205018273">ALTER USER</strong> syntax to create an administrator.<pre class="screen" id="EN-US_TOPIC_0000001188323750__screen4761145817259">CREATE USER <em id="EN-US_TOPIC_0000001188323750__i276173315223">sysadmin</em> WITH SYSADMIN password '<em id="EN-US_TOPIC_0000001188323750__i1996392214229">{Password}</em>';</pre>
<pre class="screen" id="EN-US_TOPIC_0000001188323750__screen13261582272">ALTER USER <em id="EN-US_TOPIC_0000001188323750__i984410118232">u1</em> SYSADMIN;</pre>
</li></ul>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188323750__row195951541715"><td class="cellrowborder" rowspan="2" valign="top" width="10%" headers="mcps1.3.4.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001188323750__p14595105161717">Common user</p>
<p id="EN-US_TOPIC_0000001188323750__p252715354720"></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001188323750__p15951358173">Common user</p>
</td>
<td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.4.2.2.5.1.3 "><ul id="EN-US_TOPIC_0000001188323750__ul89611910203412"><li id="EN-US_TOPIC_0000001188323750__li79612101346">Use a tool to connect to the database.</li><li id="EN-US_TOPIC_0000001188323750__li12962161018343">Have the attributes of specific database system operations, such as <strong id="EN-US_TOPIC_0000001188323750__b104293028181852">CREATEDB</strong>, <strong id="EN-US_TOPIC_0000001188323750__b42385387881852">CREATEROLE</strong>, and <strong id="EN-US_TOPIC_0000001188323750__b50948786081852">SYSADMIN</strong>.</li><li id="EN-US_TOPIC_0000001188323750__li1296213107340">Access database objects.</li><li id="EN-US_TOPIC_0000001188323750__li12962141018344">Run SQL statements.</li></ul>
</td>
<td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.4.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001188323750__p677765611364">Run the <strong id="EN-US_TOPIC_0000001188323750__b20486135515299">CREATE USER</strong> syntax to create a common user.</p>
<pre class="screen" id="EN-US_TOPIC_0000001188323750__screen191761133172618">CREATE USER <em id="EN-US_TOPIC_0000001188323750__i53382048174113">u1</em> PASSWORD '<em id="EN-US_TOPIC_0000001188323750__i36631725181012">{Password}</em>';</pre>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188323750__row4526113194710"><td class="cellrowborder" valign="top" headers="mcps1.3.4.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001188323750__p0409347152715">Private user</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.4.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001188323750__p291652416506">A user created with the <strong id="EN-US_TOPIC_0000001188323750__b23721642311512">INDEPENDENT</strong> attribute in non-separation-of-permissions mode.</p>
<p id="EN-US_TOPIC_0000001188323750__p11108114315012">Database administrators can manage (<strong id="EN-US_TOPIC_0000001188323750__b205609301211512">DROP</strong>, <strong id="EN-US_TOPIC_0000001188323750__b212561601811512">ALTER</strong>, and <strong id="EN-US_TOPIC_0000001188323750__b191003805911512">TRUNCATE</strong>) objects of private users but cannot access (<strong id="EN-US_TOPIC_0000001188323750__b32776326711512">INSERT</strong>, <strong id="EN-US_TOPIC_0000001188323750__b4193836311512">DELETE</strong>, <strong id="EN-US_TOPIC_0000001188323750__b184949162111512">SELECT</strong>, <strong id="EN-US_TOPIC_0000001188323750__b150389627111512">UPDATE</strong>, <strong id="EN-US_TOPIC_0000001188323750__b1423971711512">COPY</strong>, <strong id="EN-US_TOPIC_0000001188323750__b210071563211512">GRANT</strong>, <strong id="EN-US_TOPIC_0000001188323750__b207253897111512">REVOKE</strong>, and <strong id="EN-US_TOPIC_0000001188323750__b107328697511512">ALTER OWNER</strong>) the objects before being authorized.</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.4.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001188323750__p147114710272">Use the <strong id="EN-US_TOPIC_0000001188323750__b738085810321">CREATE USER</strong> syntax to create a private user.</p>
<pre class="screen" id="EN-US_TOPIC_0000001188323750__screen1953020257272">CREATE USER <em id="EN-US_TOPIC_0000001188323750__i470265417105">user_independent </em>WITH INDEPENDENT<em id="EN-US_TOPIC_0000001188323750__i2036937171113"> </em>IDENTIFIED BY '<em id="EN-US_TOPIC_0000001188323750__i270255412103">{Password}'</em>;</pre>
</td>
</tr>
</tbody>
</table>
</div> </div>
<p id="EN-US_TOPIC_0000001098814672__en-us_topic_0155088780_p163516014463">Alternatively, you can run the following statement:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001098814672__s0ee463ee27f54d56abed1ee963c62a63"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">joe</span><span class="w"> </span><span class="n">SYSADMIN</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div> </div>
<p id="EN-US_TOPIC_0000001098814672__en-us_topic_0155088780_p135187482336">To run the <strong id="EN-US_TOPIC_0000001098814672__b186389213493">ALTER USER</strong> statement, the user must exist.</p>
</div> </div>
<div> <div>
<div class="familylinks"> <div class="familylinks">

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +1,64 @@
<a name="EN-US_TOPIC_0000001145894533"></a><a name="EN-US_TOPIC_0000001145894533"></a> <a name="EN-US_TOPIC_0000001233563239"></a><a name="EN-US_TOPIC_0000001233563239"></a>
<h1 class="topictitle1">Users</h1> <h1 class="topictitle1">User Management</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001145894533__ab211f1190a3a49f1ae26d391cf4c820a">You can use <strong id="EN-US_TOPIC_0000001145894533__b1286263181411">CREATE USER</strong> and <strong id="EN-US_TOPIC_0000001145894533__b195831715146">ALTER USER</strong> to create and manage database users, respectively. The database cluster has one or more named databases. Users and roles are shared within the entire cluster, but their data is not shared. That is, a user can connect to any database, but after the connection is successful, any user can access only the database declared in the connection request.</p> <div id="body8662426"><p id="EN-US_TOPIC_0000001233563239__p1868572342914">You can use <strong id="EN-US_TOPIC_0000001233563239__b177176812178">CREATE USER</strong> and <strong id="EN-US_TOPIC_0000001233563239__b20717186172">ALTER USER</strong> to create and manage database users.</p>
<p id="EN-US_TOPIC_0000001145894533__a566124869f49472780199b06c42415d7">In non-<a href="dws_04_0056.html">separation-of-duty</a> scenarios, a <span id="EN-US_TOPIC_0000001145894533__text249229464">GaussDB(DWS)</span> user account can be created and deleted only by a system administrator or a security administrator with the <strong id="EN-US_TOPIC_0000001145894533__en-us_topic_0157416672_b54441931101611">CREATEROLE</strong> attribute. In separation-of-duty scenarios, a user account can be created only by a security administrator.</p> <ul id="EN-US_TOPIC_0000001233563239__ul18954124143010"><li id="EN-US_TOPIC_0000001233563239__li495444203012">In the non-<a href="dws_04_0056.html">separation-of-permission</a> mode, a <span id="EN-US_TOPIC_0000001233563239__text10257114155518">GaussDB(DWS)</span> user account can be created and deleted only by a system administrator or a security administrator with the <strong id="EN-US_TOPIC_0000001233563239__b192571420555">CREATEROLE</strong> attribute.</li><li id="EN-US_TOPIC_0000001233563239__li99541347309">In separation-of-permission mode, a user account can be created only by a security administrator.</li></ul>
<p id="EN-US_TOPIC_0000001145894533__en-us_topic_0155089862_p967512110275">When a user logs in, <span id="EN-US_TOPIC_0000001145894533__text861939956">GaussDB(DWS)</span> authenticates the user. A user can own databases and database objects (such as tables), and grant permissions of these objects to other users and roles. In addition to system administrators, users with the <strong id="EN-US_TOPIC_0000001145894533__b172454016209">CREATEDB</strong> attribute can create databases and grant permissions to these databases.</p> <div class="section" id="EN-US_TOPIC_0000001233563239__s5a76876c562240bb9a03705a6487337f"><h4 class="sectiontitle">Creating a User</h4><p id="EN-US_TOPIC_0000001233563239__p1573314153610">The <strong id="EN-US_TOPIC_0000001233563239__b962032611406">CREATE USER</strong> statement is used to create a GaussDB (DWS) user. After creating a user, you can use the user to connect to the database.</p>
<div class="section" id="EN-US_TOPIC_0000001145894533__s5a76876c562240bb9a03705a6487337f"><h4 class="sectiontitle">Adding, Modifying, and Deleting Users</h4><ul id="EN-US_TOPIC_0000001145894533__u4bfa4d1112af43318dd434b9cfffcbf0"><li id="EN-US_TOPIC_0000001145894533__l2049a7122c434a029455124ffc1fd627">To create a user, use the SQL CREATE USER statement.<div class="p" id="EN-US_TOPIC_0000001145894533__a9f9301016ac84e0ab3c1e6236a4c1198"><a name="EN-US_TOPIC_0000001145894533__l2049a7122c434a029455124ffc1fd627"></a><a name="l2049a7122c434a029455124ffc1fd627"></a>For example, create a user <strong id="EN-US_TOPIC_0000001145894533__b11967125692018">joe</strong> and set the <strong id="EN-US_TOPIC_0000001145894533__b280419111218">CREATEDB</strong> attribute for the user.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145894533__s892d131194b3404fa2acfc6472700f9f"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">joe</span><span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="k">CREATEDB</span><span class="w"> </span><span class="n">PASSWORD</span><span class="w"> </span><span class="s1">'password'</span><span class="p">;</span><span class="w"></span> <ul id="EN-US_TOPIC_0000001233563239__u4bfa4d1112af43318dd434b9cfffcbf0"><li id="EN-US_TOPIC_0000001233563239__li116850349186">Create common user <strong id="EN-US_TOPIC_0000001233563239__b3419153524014">u1</strong> and assign the <strong id="EN-US_TOPIC_0000001233563239__b113871438124015">CREATEDB </strong>attribute to the user.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563239__s892d131194b3404fa2acfc6472700f9f"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">u1</span><span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="k">CREATEDB</span><span class="w"> </span><span class="n">PASSWORD</span><span class="w"> </span><span class="s1">'{Password}'</span><span class="p">;</span><span class="w"> </span>
</pre></div></td></tr></table></div> </pre></div></td></tr></table></div>
</div> </div>
</div> </li><li id="EN-US_TOPIC_0000001233563239__lccbf77bee88541569c5e40005095843d">To create the system administrator <strong id="EN-US_TOPIC_0000001233563239__b4538194264020">mydbadmin</strong>, you need to specify the <strong id="EN-US_TOPIC_0000001233563239__b095615443403">SYSADMIN </strong>parameter.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563239__screen325453331915"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">mydbadmin</span><span class="w"> </span><span class="n">sysadmin</span><span class="w"> </span><span class="n">PASSWORD</span><span class="w"> </span><span class="s1">'{Password}'</span><span class="p">;</span>
</li><li id="EN-US_TOPIC_0000001145894533__lccbf77bee88541569c5e40005095843d">To create a system administrator, use the CREATE USER statement with the <strong id="EN-US_TOPIC_0000001145894533__b1478612392112">SYSADMIN</strong> parameter.</li><li id="EN-US_TOPIC_0000001145894533__ldd3060b2c4914b6a82e6696cb970c61f">To delete an existing user, use the DROP USER statement.</li><li id="EN-US_TOPIC_0000001145894533__l0d85d2fc5c794bc4b83988b683ea8267">To change a user account (for example, rename the user or change the password), use the ALTER USER statement.</li><li id="EN-US_TOPIC_0000001145894533__en-us_topic_0155089862_li69266599132">To view a user list, query the <a href="dws_04_0791.html">PG_USER</a> view.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145894533__sc2a210ac740e4d19bd710d40d9496405"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pg_user</span><span class="p">;</span><span class="w"> </span>
</pre></div></td></tr></table></div> </pre></div></td></tr></table></div>
</div> </div>
</li><li id="EN-US_TOPIC_0000001145894533__l46bd6ed365544771a90386e90a1f5c31">To view user attributes, query the system catalog <a href="dws_04_0574.html">PG_AUTHID</a>.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145894533__s5d4870c3957d4590a2bdfd86247e801f"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pg_authid</span><span class="p">;</span><span class="w"> </span> </li><li id="EN-US_TOPIC_0000001233563239__li497513519333">View the created user in the <a href="dws_04_0791.html">PG_USER</a> view.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563239__screen35510488336"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pg_user</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001233563239__li198021759132313">To view user attributes, query the system catalog <a href="dws_04_0574.html">PG_AUTHID</a>.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563239__screen1480295916239"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pg_authid</span><span class="p">;</span><span class="w"> </span>
</pre></div></td></tr></table></div> </pre></div></td></tr></table></div>
</div> </div>
</li></ul> </li></ul>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001145894533__section12234116194510"><h4 class="sectiontitle">Private Users</h4><p id="EN-US_TOPIC_0000001145894533__p27831729154519">If multiple service departments use different database user accounts to perform service operations and a database maintenance department at the same level uses database administrator accounts to perform maintenance operations, service departments may require that database administrators, without specific authorization, can manage (<strong id="EN-US_TOPIC_0000001145894533__b2861135378">DROP</strong>, <strong id="EN-US_TOPIC_0000001145894533__b18121314377">ALTER</strong>, and <strong id="EN-US_TOPIC_0000001145894533__b27847201375">TRUNCATE</strong>) their data but cannot access (<strong id="EN-US_TOPIC_0000001145894533__b283111351272">INSERT</strong>, <strong id="EN-US_TOPIC_0000001145894533__b209979439718">DELETE</strong>, <strong id="EN-US_TOPIC_0000001145894533__b203235217713">UPDATE</strong>, <strong id="EN-US_TOPIC_0000001145894533__b81458561971">SELECT</strong>, and <strong id="EN-US_TOPIC_0000001145894533__b1517715510817">COPY</strong>) the data. That is, the management permissions of database administrators for tables need to be isolated from their access permissions to improve the data security of common users.</p> <div class="section" id="EN-US_TOPIC_0000001233563239__section177791258171313"><h4 class="sectiontitle">Altering User Attributes</h4><p id="EN-US_TOPIC_0000001233563239__p02921820161416">The <strong id="EN-US_TOPIC_0000001233563239__b17869132174116">ALTER USER</strong> statement is used to alter user attributes, such as changing user passwords or permissions.</p>
<p id="EN-US_TOPIC_0000001145894533__p93879318541">In <a href="dws_04_0056.html">Separation of Permissions</a> mode, a database administrator does not have permissions for the tables in schemas of other users. In this case, database administrators have neither management permissions nor access permissions, which does not meet the requirements of the service departments mentioned above. Therefore, <span id="EN-US_TOPIC_0000001145894533__text1006556763">GaussDB(DWS)</span> provides private users to solve the problem. That is, create private users with the <strong id="EN-US_TOPIC_0000001145894533__b45047117216">INDEPENDENT</strong> attribute in non-separation-of-duties mode.</p> <p id="EN-US_TOPIC_0000001233563239__p19125111219143">Example:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145894533__screen89147321833"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">user_independent</span><span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="n">INDEPENDENT</span><span class="w"> </span><span class="n">IDENTIFIED</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="ss">&quot;password&quot;</span><span class="p">;</span><span class="w"></span> <ul id="EN-US_TOPIC_0000001233563239__ul8921195210312"><li id="EN-US_TOPIC_0000001233563239__li292145233116">Rename user <strong id="EN-US_TOPIC_0000001233563239__b161931737104020">u1</strong> to <strong id="EN-US_TOPIC_0000001233563239__b93511839104011">u2</strong>.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563239__en-us_topic_0000001082926733_s1aa0fa851c7f45c9aac01f563e469336"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">u1</span><span class="w"> </span><span class="k">RENAME</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">u2</span><span class="p">;</span>
</pre></div></td></tr></table></div> </pre></div></td></tr></table></div>
</div> </div>
<p id="EN-US_TOPIC_0000001145894533__p14363122319413">Database administrators can manage (<strong id="EN-US_TOPIC_0000001145894533__b66215232236">DROP</strong>, <strong id="EN-US_TOPIC_0000001145894533__b63414253235">ALTER</strong>, and <strong id="EN-US_TOPIC_0000001145894533__b19965152618239">TRUNCATE</strong>) objects of private users but cannot access (<strong id="EN-US_TOPIC_0000001145894533__b1120123314246">INSERT</strong>, <strong id="EN-US_TOPIC_0000001145894533__b1219413384247">DELETE</strong>, <strong id="EN-US_TOPIC_0000001145894533__b178731641172414">SELECT</strong>, <strong id="EN-US_TOPIC_0000001145894533__b79794513240">UPDATE</strong>, <strong id="EN-US_TOPIC_0000001145894533__b12131448202414">COPY</strong>, <strong id="EN-US_TOPIC_0000001145894533__b3130185152415">GRANT</strong>, <strong id="EN-US_TOPIC_0000001145894533__b62591354192411">REVOKE</strong>, and <strong id="EN-US_TOPIC_0000001145894533__b669210552516">ALTER OWNER</strong> the objects before being authorized.</p> </li><li id="EN-US_TOPIC_0000001233563239__li39221752183118">Grant the <strong id="EN-US_TOPIC_0000001233563239__b655711156422">CREATEROLE</strong> permission to user <strong id="EN-US_TOPIC_0000001233563239__b0818131814425">u1</strong>:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563239__screen2649718142220"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">u1</span><span class="w"> </span><span class="n">CREATEROLE</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001233563239__li238439133819">For details about how to change the user password, see <a href="dws_04_0063.html#EN-US_TOPIC_0000001188482292__section1897910435417">Setting and Changing a Password</a>.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001233563239__section5530258152512"><h4 class="sectiontitle">Locking a User</h4><p id="EN-US_TOPIC_0000001233563239__p583454519420">The <strong id="EN-US_TOPIC_0000001233563239__b156216105177">ACCOUNT LOCK</strong> | <strong id="EN-US_TOPIC_0000001233563239__b434581371710">ACCOUNT UNLOCK</strong> parameter in the statement is used to lock or unlock a user. A locked user cannot log in to the system. If an account is stolen or illegally accessed, the administrator can manually lock the account. After the account is secured, the administrator can manually unlock the account.</p>
<p id="EN-US_TOPIC_0000001233563239__a965c39fa6c1b485d9531984163b5df7b">Example:</p>
<ul id="EN-US_TOPIC_0000001233563239__ul56140553218"><li id="EN-US_TOPIC_0000001233563239__li4615175133217">To lock user <strong id="EN-US_TOPIC_0000001233563239__b515120719181">u1</strong>, run the following command:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563239__sd7a7a6ffd93848ec82772e85e1152046"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">u1</span><span class="w"> </span><span class="n">ACCOUNT</span><span class="w"> </span><span class="k">LOCK</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001233563239__li62371119328">To unlock user <strong id="EN-US_TOPIC_0000001233563239__b293139141812">u1</strong>, run the following command:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563239__sfbbbae6fbe514ae7865f2696ee6b9e4c"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">u1</span><span class="w"> </span><span class="n">ACCOUNT</span><span class="w"> </span><span class="n">UNLOCK</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001233563239__section1365185119379"><h4 class="sectiontitle">Deleting a User</h4><p id="EN-US_TOPIC_0000001233563239__p114873574371">The <strong id="EN-US_TOPIC_0000001233563239__b1520929122217">DROP USER</strong> statement is used to delete one or more GaussDB(DWS) users. An administrator can delete an account that is no longer used. Deleted users cannot be restored.</p>
<ul id="EN-US_TOPIC_0000001233563239__ul41936112209"><li id="EN-US_TOPIC_0000001233563239__li171932192015">If multiple users are deleted at the same time, separate them with commas (,).</li><li id="EN-US_TOPIC_0000001233563239__li11193101142015">After a user is deleted successfully, all the permissions of the user are also deleted.</li><li id="EN-US_TOPIC_0000001233563239__li1299164410401">When an account to be deleted is in the active state, it is deleted after the session is disconnected.</li><li id="EN-US_TOPIC_0000001233563239__li6974145124118">When <strong id="EN-US_TOPIC_0000001233563239__b663378102316">CASCADE </strong>is specified in the <strong id="EN-US_TOPIC_0000001233563239__b1193303212315">DROP USER</strong> statement, objects such as tables that depend on the user will be deleted. That is, the objects whose owner is the user are deleted, and the authorizations of other objects to the user are also deleted.</li></ul>
<p id="EN-US_TOPIC_0000001233563239__p1545712420105">Example:</p>
<ul id="EN-US_TOPIC_0000001233563239__ul19914101516326"><li id="EN-US_TOPIC_0000001233563239__li129141815183214">-- Delete user <strong id="EN-US_TOPIC_0000001233563239__b209671513122518">u1</strong>.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563239__screen12472141917136"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">u1</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
<ul id="EN-US_TOPIC_0000001233563239__ul13205121973219"><li id="EN-US_TOPIC_0000001233563239__li2205101943217">Delete account <strong id="EN-US_TOPIC_0000001233563239__b321421822517">u2</strong> in a cascading manner.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233563239__saf2296eb7a554757b09ed7c4f05c4816"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">u2</span><span class="w"> </span><span class="k">CASCADE</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div> </div>
</div> </div>
<div> <div>

View File

@ -1,20 +0,0 @@
<a name="EN-US_TOPIC_0000001098974514"></a><a name="EN-US_TOPIC_0000001098974514"></a>
<h1 class="topictitle1">Roles</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001098974514__a0e365e8ec5b84a899bf1a6438fd40b32">A role is a set of permissions. After a role is granted to a user through <strong id="EN-US_TOPIC_0000001098974514__b35816143266">GRANT</strong>, the user will have all the permissions of the role. It is recommended that roles be used to efficiently grant permissions. For example, you can create different roles of design, development, and maintenance personnel, grant the roles to users, and then grant specific data permissions required by different users. When permissions are granted or revoked at the role level, these changes take effect on all members of the role.</p>
<p id="EN-US_TOPIC_0000001098974514__p1682774412408"><span id="EN-US_TOPIC_0000001098974514__text1007343817">GaussDB(DWS)</span> provides an implicitly defined group <strong id="EN-US_TOPIC_0000001098974514__b223948121718">PUBLIC</strong> that contains all roles. By default, all new users and roles have the permissions of <strong id="EN-US_TOPIC_0000001098974514__b64610281810">PUBLIC</strong>. For details about the default permissions of <strong id="EN-US_TOPIC_0000001098974514__b194027579186">PUBLIC</strong>, see GRANT. To revoke permissions of <strong id="EN-US_TOPIC_0000001098974514__b82749347208">PUBLIC</strong> from a user or role, or re-grant these permissions to them, add the <strong id="EN-US_TOPIC_0000001098974514__b933413162120">PUBLIC</strong> keyword in the <strong id="EN-US_TOPIC_0000001098974514__b8673195982114">REVOKE</strong> or <strong id="EN-US_TOPIC_0000001098974514__b1330712567215">GRANT</strong> statement.</p>
<p id="EN-US_TOPIC_0000001098974514__af29398cff1464bd1ba13906817e39c79">To view all roles, query the system catalog <strong id="EN-US_TOPIC_0000001098974514__b144855413292">PG_ROLES</strong>.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001098974514__sd4f5e25ffae840afadfe668712024ec2"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">PG_ROLES</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<div class="section" id="EN-US_TOPIC_0000001098974514__se88a9cf3a28945eaae15369d7ace068d"><h4 class="sectiontitle">Adding, Modifying, and Deleting Roles</h4><p id="EN-US_TOPIC_0000001098974514__en-us_topic_0155089863_p191418216455">In non-<a href="dws_04_0056.html">separation-of-duty</a> scenarios, a role can be created, modified, and deleted only by a system administrator or a user with the <strong id="EN-US_TOPIC_0000001098974514__b17735165223014">CREATEROLE</strong> attribute. In separation-of-duty scenarios, a role can be created, modified, and deleted only by a user with the <strong id="EN-US_TOPIC_0000001098974514__b255329153219">CREATEROLE</strong> attribute.</p>
<ul id="EN-US_TOPIC_0000001098974514__en-us_topic_0155089863_ul6897143531"><li id="EN-US_TOPIC_0000001098974514__l48433d332d8c4a63ab8bccfb9ed7e7e7">To create a role, use <strong id="EN-US_TOPIC_0000001098974514__b454185923013">CREATE ROLE</strong>.</li><li id="EN-US_TOPIC_0000001098974514__l3f05a2ec584544ceacea89d45ad143d1">To add or delete users in an existing role, use <strong id="EN-US_TOPIC_0000001098974514__b18945163313717">ALTER ROLE</strong>.</li><li id="EN-US_TOPIC_0000001098974514__l5936019333fb45c88778ced832eaf0aa">To delete a role, use <strong id="EN-US_TOPIC_0000001098974514__b1991491375">DROP ROLE</strong>. <strong id="EN-US_TOPIC_0000001098974514__b9835211173319">DROP ROLE</strong> deletes only a role, rather than member users in the role.</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0053.html">Managing Users and Their Permissions</a></div>
</div>
</div>

View File

@ -1,52 +0,0 @@
<a name="EN-US_TOPIC_0000001145495017"></a><a name="EN-US_TOPIC_0000001145495017"></a>
<h1 class="topictitle1">Schema</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001145495017__a6213d09d1ceb4fcdbb4713aa5eac0bc0">Schemas function as models. Schema management allows multiple users to use the same database without mutual impacts, to organize database objects as manageable logical groups, and to add third-party applications to the same schema without causing conflicts.</p>
<p id="EN-US_TOPIC_0000001145495017__af9fc01f07d9c452e8ec701ab0779911a">Each database has one or more schemas. Each schema contains tables and other types of objects. When a database is created, a schema named <strong id="EN-US_TOPIC_0000001145495017__b050234019431">public</strong> is created by default, and all users have permissions for this schema. You can group database objects by schema. A schema is similar to an OS directory but cannot be nested.</p>
<p id="EN-US_TOPIC_0000001145495017__ad688620dd190447280515535bc37fe6e">The same database object name can be used in different schemas of the same database without causing conflicts. For example, both <strong id="EN-US_TOPIC_0000001145495017__b1512010402459">a_schema</strong> and <strong id="EN-US_TOPIC_0000001145495017__b112811842154510">b_schema</strong> can contain a table named <strong id="EN-US_TOPIC_0000001145495017__b979665724519">mytable</strong>. Users with required permissions can access objects across multiple schemas of the same database.</p>
<p id="EN-US_TOPIC_0000001145495017__aa8ec337a2a1741718cfbde0e195582ff">If a user is created, a schema named after the user will also be created in the current database.</p>
<p id="EN-US_TOPIC_0000001145495017__a4e09fc2cca2e4804823edb42e2e728ab">Database objects are generally created in the first schema in a database search path. For details about the first schema and how to change the schema order, see <a href="#EN-US_TOPIC_0000001145495017__s54bcf3a1631c42058bbbe25df4b8523b">Search Path</a>.</p>
<div class="section" id="EN-US_TOPIC_0000001145495017__sb4d9c2e675ab4e8d9d57f896c9e4823e"><h4 class="sectiontitle">Creating, Modifying, and Deleting Schemas</h4><ul id="EN-US_TOPIC_0000001145495017__u715e78514c8942b9b47a132292c687ea"><li id="EN-US_TOPIC_0000001145495017__lcdbbd3e6b4b34adb9f1c4ae8b32272e5">To create a schema, use <strong id="EN-US_TOPIC_0000001145495017__b02741451784">CREATE SCHEMA</strong>. Any user can create a schema.</li><li id="EN-US_TOPIC_0000001145495017__lbd8983740cec41f0ac03ec4fc2681dd5">To change the name or owner of a schema, use <strong id="EN-US_TOPIC_0000001145495017__b41468184811">ALTER SCHEMA</strong>. Only the schema owner can do so.</li><li id="EN-US_TOPIC_0000001145495017__l0935434e5be94f74b874d80ba28517a7">To delete a schema and its objects, use <strong id="EN-US_TOPIC_0000001145495017__b1528412271684">DROP SCHEMA</strong>. Only the schema owner can do so.</li><li id="EN-US_TOPIC_0000001145495017__l9e8c3ba62b5e4f98a00dca8bb19144fc">To create a table in a schema, use the <em id="EN-US_TOPIC_0000001145495017__i8878171810501">schema_name</em><strong id="EN-US_TOPIC_0000001145495017__b18592112145013">.</strong><em id="EN-US_TOPIC_0000001145495017__i19041523175019">table_name</em> format to specify the table. If <em id="EN-US_TOPIC_0000001145495017__i206971627115015">schema_name</em> is not specified, the table will be created in the first schema in <a href="#EN-US_TOPIC_0000001145495017__s54bcf3a1631c42058bbbe25df4b8523b">Search Path</a>.</li><li id="EN-US_TOPIC_0000001145495017__l7f2438b17b424139bf02c49f7e947597">To view the owner of a schema, perform the following join query on the system catalogs <strong id="EN-US_TOPIC_0000001145495017__b263316289512">PG_NAMESPACE</strong> and <strong id="EN-US_TOPIC_0000001145495017__b1569503118513">PG_USER</strong>. Replace <em id="EN-US_TOPIC_0000001145495017__i9401135125110">schema_name</em> in the statement with the name of the schema to be queried.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145495017__s0986197b2f4e4d5ea8265f4930ed218e"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="n">nspname</span><span class="p">,</span><span class="n">u</span><span class="p">.</span><span class="n">usename</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">nspowner</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pg_namespace</span><span class="w"> </span><span class="n">s</span><span class="p">,</span><span class="w"> </span><span class="n">pg_user</span><span class="w"> </span><span class="n">u</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="n">nspname</span><span class="o">=</span><span class="s1">'schema_name'</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="n">nspowner</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">u</span><span class="p">.</span><span class="n">usesysid</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001145495017__lecaae9ea66d64072b1ab715073698836">To view a list of all schemas, query the system catalog <strong id="EN-US_TOPIC_0000001145495017__b181191213165214">PG_NAMESPACE</strong>.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145495017__s940ec357a54f4cb7b89d609e8408fe7c"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pg_namespace</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001145495017__l22931b8d595944e0a42a778fd3c64b37">To view a list of tables in a schema, query the system catalog <strong id="EN-US_TOPIC_0000001145495017__b771110805316">PG_TABLES</strong>. For example, the following query will return a table list from <strong id="EN-US_TOPIC_0000001145495017__b7110851105312">PG_CATALOG</strong> in the schema.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145495017__s9de64766691d4cbbab0d430b3242d618"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="k">distinct</span><span class="p">(</span><span class="n">tablename</span><span class="p">),</span><span class="n">schemaname</span><span class="w"> </span><span class="k">from</span><span class="w"> </span><span class="n">pg_tables</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="n">schemaname</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'pg_catalog'</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001145495017__s54bcf3a1631c42058bbbe25df4b8523b"><a name="EN-US_TOPIC_0000001145495017__s54bcf3a1631c42058bbbe25df4b8523b"></a><a name="s54bcf3a1631c42058bbbe25df4b8523b"></a><h4 class="sectiontitle">Search Path</h4><p id="EN-US_TOPIC_0000001145495017__en-us_topic_0156599225_p331913481347">A search path is defined in the <a href="dws_04_0925.html#EN-US_TOPIC_0000001145894759__sc0cb61109de045049d5802f668be2392">search_path</a> parameter. The parameter value is a list of schema names separated by commas (,). If no target schema is specified during object creation, the object will be added to the first schema listed in the search path. If there are objects with the same name across different schemas and no schema is specified for an object query, the object will be returned from the first schema containing the object in the search path.</p>
<ul id="EN-US_TOPIC_0000001145495017__u642fe49bc8c248128bac1e22fcbd9b91"><li id="EN-US_TOPIC_0000001145495017__en-us_topic_0156599225_li86784213224">To view the current search path, use <strong id="EN-US_TOPIC_0000001145495017__b119943341284">SHOW</strong>.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145495017__sf1f71b75227f4932bf93778630cf4336"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span>
<span class="normal">5</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SHOW</span><span class="w"> </span><span class="n">SEARCH_PATH</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="n">search_path</span><span class="w"></span>
<span class="c1">----------------</span>
<span class="w"> </span><span class="ss">&quot;$user&quot;</span><span class="p">,</span><span class="k">public</span><span class="w"></span>
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001145495017__en-us_topic_0156599225_p118434120229">The default value of <strong id="EN-US_TOPIC_0000001145495017__b7983546315">search_path</strong> is <strong id="EN-US_TOPIC_0000001145495017__b23471421625">"$user",public</strong>. <strong id="EN-US_TOPIC_0000001145495017__b13918851126">$user</strong> indicates the name of the schema with the same name as the current session user. If the schema does not exist, <strong id="EN-US_TOPIC_0000001145495017__b76691039123">$user</strong> will be ignored. By default, after a user connects to a database that has schemas with the same name, objects will be added to all the schemas. If there are no such schemas, objects will be added to only to the <strong id="EN-US_TOPIC_0000001145495017__b13819232547">public</strong> schema.</p>
</li><li id="EN-US_TOPIC_0000001145495017__l82eda2461e1147e29a22769cbfcf295d">To change the default schema of the current session, run the <strong id="EN-US_TOPIC_0000001145495017__b65015461948">SET</strong> statement.<div class="p" id="EN-US_TOPIC_0000001145495017__a59279eef391a4566b8877de9a9b478f0">Run the following command to set <strong id="EN-US_TOPIC_0000001145495017__en-us_topic_0058967624_b842352706111029">search_path</strong> to <strong id="EN-US_TOPIC_0000001145495017__en-us_topic_0058967624_b842352706111038">myschema</strong> and <strong id="EN-US_TOPIC_0000001145495017__en-us_topic_0058967624_b842352706111041">public</strong> (<strong id="EN-US_TOPIC_0000001145495017__en-us_topic_0058967624_b842352706111047">myschema</strong> will be searched first):<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145495017__s8a42b7c88f2a4805860be27977bacc7e"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SET</span><span class="w"> </span><span class="n">SEARCH_PATH</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">myschema</span><span class="p">,</span><span class="w"> </span><span class="k">public</span><span class="p">;</span><span class="w"></span>
<span class="k">SET</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</div>
</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0053.html">Managing Users and Their Permissions</a></div>
</div>
</div>

View File

@ -1,38 +0,0 @@
<a name="EN-US_TOPIC_0000001145494829"></a><a name="EN-US_TOPIC_0000001145494829"></a>
<h1 class="topictitle1">User Permission Setting</h1>
<div id="body8662426"><ul id="EN-US_TOPIC_0000001145494829__u4d00d0b1312f4bfd98f628d76c4c33a3"><li id="EN-US_TOPIC_0000001145494829__l0652cc2f872540b39dadf06043ecd992">To grant the permission for an object directly to a user, use <strong id="EN-US_TOPIC_0000001145494829__b2026814461488">GRANT</strong>.<p id="EN-US_TOPIC_0000001145494829__a628135a5c5974571b0acd1fc59b4de58">When permissions for a table or view in a schema are granted to a user or role, the <strong id="EN-US_TOPIC_0000001145494829__b115195191411">USAGE</strong> permission of the schema must be granted together. Otherwise, the user or role can only see the names of the objects but cannot actually access them.</p>
<p id="EN-US_TOPIC_0000001145494829__adb9ddeb1b84f4d24b84aa542852162b0">In the following example, permissions for the schema <strong id="EN-US_TOPIC_0000001145494829__b10238359161511">tpcds</strong> are first granted to the user <strong id="EN-US_TOPIC_0000001145494829__b86639991616">joe</strong>, and then the <strong id="EN-US_TOPIC_0000001145494829__b77501819161">SELECT</strong> permission for the <strong id="EN-US_TOPIC_0000001145494829__b1975842910164"><span id="EN-US_TOPIC_0000001145494829__en-us_topic_0155089864_text916711817457">tpcds.</span>web_returns</strong> table is also granted.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145494829__s64816eb39e7440668aa6957718ad1d76"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">GRANT</span><span class="w"> </span><span class="k">USAGE</span><span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="k">SCHEMA</span><span class="w"> </span><span class="n">tpcds</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">joe</span><span class="p">;</span><span class="w"></span>
<span class="k">GRANT</span><span class="w"> </span><span class="k">SELECT</span><span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">web_returns</span><span class="w"> </span><span class="k">to</span><span class="w"> </span><span class="n">joe</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001145494829__l456bbf1fee3d4d1594d2a45d51fbc90c">Granting a role to a user allows the user to inherit the object permissions of the role.<ol id="EN-US_TOPIC_0000001145494829__oc749dfc1add84852a2272ede7caf28fe"><li id="EN-US_TOPIC_0000001145494829__la5bcc4c1d76c44c9bdad099c54b7df24">Create a role.<p id="EN-US_TOPIC_0000001145494829__af2ea164a79aa4220b190dd94db0c543f"><a name="EN-US_TOPIC_0000001145494829__la5bcc4c1d76c44c9bdad099c54b7df24"></a><a name="la5bcc4c1d76c44c9bdad099c54b7df24"></a>Create a role <strong id="EN-US_TOPIC_0000001145494829__b1293453148">lily</strong> and grant the system permission <strong id="EN-US_TOPIC_0000001145494829__b17938501410">CREATEDB</strong> to the role.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145494829__s7856d481d99443708d10dd2956f4b065"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">ROLE</span><span class="w"> </span><span class="n">lily</span><span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="k">CREATEDB</span><span class="w"> </span><span class="n">PASSWORD</span><span class="w"> </span><span class="s1">'password'</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001145494829__l2ece061b2def4d5783e71606c8e98e06">To grant object permissions to a role, use <strong id="EN-US_TOPIC_0000001145494829__b16331297146">GRANT</strong>.<p id="EN-US_TOPIC_0000001145494829__a512f878317184178a38a66c02f46812e">For example, first grant permissions for the schema <strong id="EN-US_TOPIC_0000001145494829__b5229542111814">tpcds</strong> to the role <strong id="EN-US_TOPIC_0000001145494829__b677974919188">lily</strong>, and then grant the <strong id="EN-US_TOPIC_0000001145494829__b04261018191">SELECT</strong> permission of the <strong id="EN-US_TOPIC_0000001145494829__b854820851917"><span id="EN-US_TOPIC_0000001145494829__en-us_topic_0155089864_text3802194554914">tpcds.</span>web_returns</strong> table to <strong id="EN-US_TOPIC_0000001145494829__b1382561431919">lily</strong>.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145494829__sfd7c911cc86147dcadd1c3f050bf3903"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">GRANT</span><span class="w"> </span><span class="k">USAGE</span><span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="k">SCHEMA</span><span class="w"> </span><span class="n">tpcds</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">lily</span><span class="p">;</span><span class="w"></span>
<span class="k">GRANT</span><span class="w"> </span><span class="k">SELECT</span><span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">tpcds</span><span class="p">.</span><span class="n">web_returns</span><span class="w"> </span><span class="k">to</span><span class="w"> </span><span class="n">lily</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001145494829__l2e777a3c72944fc59c31f79ba64a9d73">Grant the role permissions to a user.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145494829__s38cacaf50cc148a6931e151f65e35cbc"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">GRANT</span><span class="w"> </span><span class="n">lily</span><span class="w"> </span><span class="k">to</span><span class="w"> </span><span class="n">joe</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<div class="note" id="EN-US_TOPIC_0000001145494829__n7fa9e5c9d25c4fef93a37a193a2c2690"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001145494829__abaeb9b5718604f858d9766e7114c9d72">When the permissions of a role are granted to a user, the attributes of the role are not transferred together.</p>
</div></div>
</li></ol>
</li><li id="EN-US_TOPIC_0000001145494829__l32faea1ba7b94871b9444985207b1771">To revoke user permissions, use <strong id="EN-US_TOPIC_0000001145494829__b12493771397">REVOKE</strong>.</li></ul>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0053.html">Managing Users and Their Permissions</a></div>
</div>
</div>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +0,0 @@
<a name="EN-US_TOPIC_0000001099134912"></a><a name="EN-US_TOPIC_0000001099134912"></a>
<h1 class="topictitle1">Setting Account Security Policies</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001099134912__s1f3f187a2a1b4561ba81672245332f5e"><h4 class="sectiontitle">Background</h4><p id="EN-US_TOPIC_0000001099134912__a445fe8be77ed473691e50ecadbf21a27">For data security purposes, <span id="EN-US_TOPIC_0000001099134912__text254499444">GaussDB(DWS)</span> provides a series of security measures, such as automatically locking and unlocking accounts, manually locking and unlocking abnormal accounts, and deleting accounts that are no longer used.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001099134912__s0dcb0f12e0694cb09db6d8497c6ba38c"><h4 class="sectiontitle">Automatically Locking and Unlocking Accounts</h4><ul id="EN-US_TOPIC_0000001099134912__u54180f3c57dd43ab8f4436c726142217"><li id="EN-US_TOPIC_0000001099134912__lb914c4f0a4774a8aa0031af6b490c96d">If a user fails to enter the correct password for over 10 times during database connection, the system automatically locks the account.</li><li id="EN-US_TOPIC_0000001099134912__l4d5b92a68adf43e3ae9bb8a14616ac63">An account is automatically unlocked one day after it was locked.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001099134912__s8e045aa026174be8b2242de1b2a5340c"><h4 class="sectiontitle">Manually Locking and Unlocking Accounts</h4><p id="EN-US_TOPIC_0000001099134912__af6dd67cc26c84bdba0ad7392835b06c9">If administrators detect an abnormal account that may be stolen or illegally accesses the database, they can manually lock the account.</p>
<p id="EN-US_TOPIC_0000001099134912__aa98a29d580b3439f86806bb25bdeb6eb">The administrator can also manually unlock the account if the account becomes normal again.</p>
<p id="EN-US_TOPIC_0000001099134912__a965c39fa6c1b485d9531984163b5df7b">For details about how to create a user, see <a href="dws_04_0057.html">Users</a>. To manually lock and unlock user <strong id="EN-US_TOPIC_0000001099134912__b1880982642101335">joe</strong>, run commands in the following format:</p>
<ul id="EN-US_TOPIC_0000001099134912__ua39402c683cc44a98794544444d44c61"><li id="EN-US_TOPIC_0000001099134912__l433c967bd1cc45d1a9598a55533d7f77">To manually lock the user:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001099134912__sd7a7a6ffd93848ec82772e85e1152046"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">joe</span><span class="w"> </span><span class="n">ACCOUNT</span><span class="w"> </span><span class="k">LOCK</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001099134912__l8d8fdb8eba84471ca8434eadddafa7d2">To manually unlock the user:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001099134912__sfbbbae6fbe514ae7865f2696ee6b9e4c"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">joe</span><span class="w"> </span><span class="n">ACCOUNT</span><span class="w"> </span><span class="n">UNLOCK</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001099134912__sfd2be0ec3e7b4fccb9382999bd5ef3dd"><h4 class="sectiontitle">Deleting Accounts that Are No Longer Used</h4><p id="EN-US_TOPIC_0000001099134912__a30de1cc710954869bfa8debf54467741">An administrator can delete an account that is no longer used. This operation cannot be rolled back.</p>
<p id="EN-US_TOPIC_0000001099134912__a35ea53d4adb84afa97a56868db3c6c30">When an account to be deleted is in the active state, it is deleted after the session is disconnected.</p>
<p id="EN-US_TOPIC_0000001099134912__ac2826380827f4295a1ceaabbc3f48552">For example, if you want to delete account <strong id="EN-US_TOPIC_0000001099134912__b8991263259251">joe</strong>, run the command in the following format:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001099134912__saf2296eb7a554757b09ed7c4f05c4816"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">joe</span><span class="w"> </span><span class="k">CASCADE</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0063.html">Setting Security Policies</a></div>
</div>
</div>

View File

@ -1,25 +0,0 @@
<a name="EN-US_TOPIC_0000001098654996"></a><a name="EN-US_TOPIC_0000001098654996"></a>
<h1 class="topictitle1">Setting the Validity Period of an Account</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001098654996__s7c1c2565b2b841ec881829e704e8a717"><h4 class="sectiontitle">Precautions</h4><p id="EN-US_TOPIC_0000001098654996__ab25b557ff4474f9680f699c770dd54c9">When creating a user, you need to specify the validity period of the user, including the start time and end time.</p>
<p id="EN-US_TOPIC_0000001098654996__ace34c9ceff984f948355ff898766d7c2">To enable a user not within the validity period to use its account, set a new validity period.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001098654996__sa398a839e3d74c50a068b14b208697ea"><h4 class="sectiontitle">Procedure</h4><ol id="EN-US_TOPIC_0000001098654996__o99f94fab8e694050a76370943a5a216b"><li id="EN-US_TOPIC_0000001098654996__l174a0e50032e450b84f352b350c3967e"><span>Run the following command to create a user and specify the start time and end time.</span><p><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001098654996__s7dec106782c740e7a2baef0a23a6b805"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">joe</span><span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="n">PASSWORD</span><span class="w"> </span><span class="s1">'password'</span><span class="w"> </span><span class="k">VALID</span><span class="w"> </span><span class="k">BEGIN</span><span class="w"> </span><span class="s1">'2015-10-10 08:00:00'</span><span class="w"> </span><span class="k">VALID</span><span class="w"> </span><span class="k">UNTIL</span><span class="w"> </span><span class="s1">'2016-10-10 08:00:00'</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</p></li><li id="EN-US_TOPIC_0000001098654996__ld5c1660f0dba4e458ad7fb23d4310d36"><span>If the user is not within the specified validity period, run the following command to set the start time and end time of a new validity period.</span><p><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001098654996__s027dd039d2fa40e08fb75b694f113008"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">USER</span><span class="w"> </span><span class="n">joe</span><span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="k">VALID</span><span class="w"> </span><span class="k">BEGIN</span><span class="w"> </span><span class="s1">'2016-11-10 08:00:00'</span><span class="w"> </span><span class="k">VALID</span><span class="w"> </span><span class="k">UNTIL</span><span class="w"> </span><span class="s1">'2017-11-10 08:00:00'</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</p></li></ol>
<div class="note" id="EN-US_TOPIC_0000001098654996__nbe8d04c697874b449321e13d8de92a92"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001098654996__a92951797c10843768c69cf9691c07fd4">If <strong id="EN-US_TOPIC_0000001098654996__en-us_topic_0151096201_en-us_topic_0085032332_b842352706164027">VALID BEGIN</strong> is not specified in the <strong id="EN-US_TOPIC_0000001098654996__en-us_topic_0151096201_en-us_topic_0085032332_b1454926090103234">CREATE ROLE</strong> or <strong id="EN-US_TOPIC_0000001098654996__en-us_topic_0151096201_en-us_topic_0085032332_b21245649103234">ALTER ROLE</strong> statement, the start time of the validity period is not limited. If <strong id="EN-US_TOPIC_0000001098654996__en-us_topic_0151096201_en-us_topic_0085032332_b1872733137103234">VALID UNTIL</strong> is not specified, the end time of the validity period is not limited. If both of the parameters are not specified, the user is always valid.</p>
</div></div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0063.html">Setting Security Policies</a></div>
</div>
</div>

View File

@ -1,15 +1,15 @@
<a name="EN-US_TOPIC_0000001146041053"></a><a name="EN-US_TOPIC_0000001146041053"></a> <a name="EN-US_TOPIC_0000001233563291"></a><a name="EN-US_TOPIC_0000001233563291"></a>
<h1 class="topictitle1">Overview</h1> <h1 class="topictitle1">Overview</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_p7807105913718">MRS is a big data cluster running based on the open-source Hadoop ecosystem. It provides the industry's latest cutting-edge storage and analytical capabilities of massive volumes of data, satisfying your data storage and processing requirements. For details, see the <span id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_ph2740729133515"><i><cite id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_en-us_topic_0135554668_cite245375118115">MapReduce Service User Guide</cite></i><em id="EN-US_TOPIC_0000001146041053__i13654203215310"></em><em id="EN-US_TOPIC_0000001146041053__i188061438139"></em></span>.</p> <div id="body8662426"><p id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_p7807105913718">MRS is a big data cluster running based on the open-source Hadoop ecosystem. It provides the industry's latest cutting-edge storage and analytical capabilities of massive volumes of data, satisfying your data storage and processing requirements. For details, see the <span id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_ph2740729133515"><i><cite id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_en-us_topic_0135554668_cite245375118115">MapReduce Service User Guide</cite></i><em id="EN-US_TOPIC_0000001233563291__i13654203215310"></em><em id="EN-US_TOPIC_0000001233563291__i188061438139"></em></span>.</p>
<p id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_p56178650111411">You can use Hive/Spark (analysis cluster of MRS) to store massive volumes of service data. Hive/Spark data files are stored on HDFS. On <span id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_ph1692512422530">GaussDB(DWS)</span>, you can connect a <span id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_ph111997429518">GaussDB(DWS)</span> cluster to an MRS cluster, read data from HDFS files, and write the data to <span id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_ph33147185110">GaussDB(DWS)</span> when the clusters are on the same network.</p> <p id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_p56178650111411">You can use Hive/Spark (analysis cluster of MRS) to store massive volumes of service data. Hive/Spark data files are stored on HDFS. On <span id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_ph1692512422530">GaussDB(DWS)</span>, you can connect a <span id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_ph111997429518">GaussDB(DWS)</span> cluster to an MRS cluster, read data from HDFS files, and write the data to <span id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_ph33147185110">GaussDB(DWS)</span> when the clusters are on the same network.</p>
<div class="notice" id="EN-US_TOPIC_0000001146041053__note1775105323310"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="EN-US_TOPIC_0000001146041053__p177511536337">Ensure that MRS can communicate with DWS:</p> <div class="notice" id="EN-US_TOPIC_0000001233563291__note1775105323310"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="EN-US_TOPIC_0000001233563291__p177511536337">Ensure that MRS can communicate with DWS:</p>
<p id="EN-US_TOPIC_0000001146041053__p122834109344">Scenario 1: If MRS and DWS are in the same region and VPC, they can communicate with each other by default.</p> <p id="EN-US_TOPIC_0000001233563291__p122834109344">Scenario 1: If MRS and DWS are in the same region and VPC, they can communicate with each other by default.</p>
<p id="EN-US_TOPIC_0000001146041053__p13939142613348">Scenario 2: If MRS and DWS are in the same region but in different VPCs, you need to create a VPC peering connection. For details, see "VPC Peering Connection Overview" in <em id="EN-US_TOPIC_0000001146041053__i633992575719">Virtual Private Cloud User Guide</em>.</p> <p id="EN-US_TOPIC_0000001233563291__p13939142613348">Scenario 2: If MRS and GaussDB(DWS) are in the same region but in different VPCs, you need to create a VPC peering connection. For details, see "VPC Peering Connection Overview" in <em id="EN-US_TOPIC_0000001233563291__i0526163863219">Virtual Private Cloud User Guide</em>.</p>
<p id="EN-US_TOPIC_0000001146041053__p594017456346">Scenario 3: If MRS and DWS are not in the same region. You need to use Cloud Connect (CC) to create network connections. For details, see the user guide of the corresponding service.</p> <p id="EN-US_TOPIC_0000001233563291__p594017456346">Scenario 3: If MRS and GaussDB(DWS) are not in the same region, you need to use Cloud Connect (CC) to create network connections. For details, see the user guide of the corresponding service.</p>
<p id="EN-US_TOPIC_0000001146041053__p11875339174014">Scenario 4: If MRS is deployed on-premises, you need to use Direct Connect (DC) or Virtual Private Network (VPN) to create network connections. For details, see the user guide of the corresponding service.</p> <p id="EN-US_TOPIC_0000001233563291__p11875339174014">Scenario 4: If MRS is deployed on-premises, you need to use Direct Connect (DC) or Virtual Private Network (VPN) to connect the network. For details, see the User Guide of the corresponding service.</p>
</div></div> </div></div>
<div class="section" id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_section1298319298101"><h4 class="sectiontitle">Importing Data from MRS to a GaussDB(DWS) Cluster</h4><ol id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_ol1725018516137"><li id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_li524814581319"><a href="dws_04_0212.html">Preparing Data in an MRS Cluster</a></li><li id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_li424812561318">(Optional) <a href="dws_04_0213.html">Manually Creating a Foreign Server</a></li><li id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_li1324910521314"><a href="dws_04_0214.html">Creating a Foreign Table</a></li><li id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_li6249258138"><a href="dws_04_0215.html">Importing Data</a></li><li id="EN-US_TOPIC_0000001146041053__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_li42491154139"><a href="dws_04_0216.html">Deleting Resources</a></li></ol> <div class="section" id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_section1298319298101"><h4 class="sectiontitle">Importing Data from MRS to a GaussDB(DWS) Cluster</h4><ol id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_ol1725018516137"><li id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_li524814581319"><a href="dws_04_0212.html">Preparing Data in an MRS Cluster</a></li><li id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_li424812561318">(Optional) <a href="dws_04_0213.html">Manually Creating a Foreign Server</a></li><li id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_li1324910521314"><a href="dws_04_0214.html">Creating a Foreign Table</a></li><li id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_li6249258138"><a href="dws_04_0215.html">Importing Data</a></li><li id="EN-US_TOPIC_0000001233563291__en-us_topic_0000001082926693_en-us_topic_0109259514_en-us_topic_0101455468_li42491154139"><a href="dws_04_0216.html">Deleting Resources</a></li></ol>
</div> </div>
</div> </div>
<div> <div>

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
<a name="EN-US_TOPIC_0000001099134598"></a><a name="EN-US_TOPIC_0000001099134598"></a> <a name="EN-US_TOPIC_0000001233761903"></a><a name="EN-US_TOPIC_0000001233761903"></a>
<h1 class="topictitle1">Development and Design Proposal</h1> <h1 class="topictitle1">Development and Design Proposal</h1>
<div id="body1528161858339"></div> <div id="body1528161858339"></div>
@ -14,14 +14,10 @@
</li> </li>
<li class="ulchildlink"><strong><a href="dws_04_0084.html">SQL Compilation</a></strong><br> <li class="ulchildlink"><strong><a href="dws_04_0084.html">SQL Compilation</a></strong><br>
</li> </li>
<li class="ulchildlink"><strong><a href="dws_04_0971.html">PL/Java Usage</a></strong><br> <li class="ulchildlink"><strong><a href="dws_04_0971.html">User-defined External Function Usage (pgSQL/Java)</a></strong><br>
</li> </li>
<li class="ulchildlink"><strong><a href="dws_04_0972.html">PL/pgSQL Usage</a></strong><br> <li class="ulchildlink"><strong><a href="dws_04_0972.html">PL/pgSQL Usage</a></strong><br>
</li> </li>
</ul> </ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_1000.html">Developer Guide</a></div>
</div>
</div> </div>

View File

@ -1,9 +1,9 @@
<a name="EN-US_TOPIC_0000001145894631"></a><a name="EN-US_TOPIC_0000001145894631"></a> <a name="EN-US_TOPIC_0000001188482086"></a><a name="EN-US_TOPIC_0000001188482086"></a>
<h1 class="topictitle1">Development and Design Proposal</h1> <h1 class="topictitle1">Development and Design Proposal</h1>
<div id="body1528161858339"><p id="EN-US_TOPIC_0000001145894631__p8060118">This chapter describes the design specifications for database modeling and application development. Modeling compliant with these specifications fits the distributed processing architecture of <span id="EN-US_TOPIC_0000001145894631__text11730754172518">GaussDB(DWS)</span> and provides efficient SQL code.</p> <div id="body1528161858339"><p id="EN-US_TOPIC_0000001188482086__p8060118">This chapter describes the design specifications for database modeling and application development. Modeling compliant with these specifications fits the distributed processing architecture of <span id="EN-US_TOPIC_0000001188482086__text11730754172518">GaussDB(DWS)</span> and provides efficient SQL code.</p>
<p id="EN-US_TOPIC_0000001145894631__p116856421219">The meaning of "Proposal" and "Notice" in this chapter is as follows:</p> <p id="EN-US_TOPIC_0000001188482086__p116856421219">The meaning of "Proposal" and "Notice" in this chapter is as follows:</p>
<ul id="EN-US_TOPIC_0000001145894631__ul1137573119221"><li id="EN-US_TOPIC_0000001145894631__li103752031122219"><strong id="EN-US_TOPIC_0000001145894631__b16921839112211">Proposal</strong>: Design rules. Services compliant with the rules can run efficiently, and those violating the rules may have low performance or logic errors.</li><li id="EN-US_TOPIC_0000001145894631__li154431751122212"><strong id="EN-US_TOPIC_0000001145894631__b14755202118236">Notice</strong>: Details requiring attention during service development. This term identifies SQL behavior that complies with SQL standards but users may have misconceptions about, and default behavior that users may be unaware of in a program.</li></ul> <ul id="EN-US_TOPIC_0000001188482086__ul1137573119221"><li id="EN-US_TOPIC_0000001188482086__li103752031122219"><strong id="EN-US_TOPIC_0000001188482086__b16921839112211">Proposal</strong>: Design rules. Services compliant with the rules can run efficiently, and those violating the rules may have low performance or logic errors.</li><li id="EN-US_TOPIC_0000001188482086__li154431751122212"><strong id="EN-US_TOPIC_0000001188482086__b14755202118236">Notice</strong>: Details requiring attention during service development. This term identifies SQL behavior that complies with SQL standards but users may have misconceptions about, and default behavior that users may be unaware of in a program.</li></ul>
</div> </div>
<div> <div>
<div class="familylinks"> <div class="familylinks">

View File

@ -1,11 +1,11 @@
<a name="EN-US_TOPIC_0000001098974618"></a><a name="EN-US_TOPIC_0000001098974618"></a> <a name="EN-US_TOPIC_0000001233883317"></a><a name="EN-US_TOPIC_0000001233883317"></a>
<h1 class="topictitle1">Database Object Naming Conventions</h1> <h1 class="topictitle1">Database Object Naming Conventions</h1>
<div id="body1528161858339"><p id="EN-US_TOPIC_0000001098974618__p1832121193017">The name of a database object must contain 1 to 63 characters, start with a letter or underscore (_), and can contain letters, digits, underscores (_), dollar signs ($), and number signs (#).</p> <div id="body1528161858339"><p id="EN-US_TOPIC_0000001233883317__p1832121193017">The name of a database object must contain 1 to 63 characters, start with a letter or underscore (_), and can contain letters, digits, underscores (_), dollar signs ($), and number signs (#).</p>
<ul id="EN-US_TOPIC_0000001098974618__ul1732014239567"><li id="EN-US_TOPIC_0000001098974618__li183207238569">[Proposal] Do not use reserved or non-reserved keywords to name database objects.<div class="note" id="EN-US_TOPIC_0000001098974618__note133201623175616"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001098974618__p173201323105613">To query the keywords of <span id="EN-US_TOPIC_0000001098974618__text1722747791">GaussDB(DWS)</span>, run <strong id="EN-US_TOPIC_0000001098974618__b1517115117327">select * from pg_get_keywords()</strong> or refer to section "Keyword."</p> <ul id="EN-US_TOPIC_0000001233883317__ul1732014239567"><li id="EN-US_TOPIC_0000001233883317__li183207238569">[Proposal] Do not use reserved or non-reserved keywords to name database objects.<div class="note" id="EN-US_TOPIC_0000001233883317__note133201623175616"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001233883317__p173201323105613">You can run <strong id="EN-US_TOPIC_0000001233883317__b3106953151114">SELECT * FROM pg_get_keywords()</strong> to query GaussDB(DWS) keywords or view the keywords in section "Keywords" in <em id="EN-US_TOPIC_0000001233883317__i618071031215">SQL Syntax Reference</em>.</p>
</div></div> </div></div>
</li><li id="EN-US_TOPIC_0000001098974618__li1724252616567">[Proposal] Do not use a string enclosed in double quotation marks ("") to define the database object name, unless you need to specify its capitalization. Case sensitivity of database object names makes problem location difficult.</li><li id="EN-US_TOPIC_0000001098974618__li15563344563">[Proposal] Use the same naming format for database objects.<ul id="EN-US_TOPIC_0000001098974618__ul75615347563"><li id="EN-US_TOPIC_0000001098974618__li05603416563">In a system undergoing incremental development or service migration, you are advised to comply with its historical naming conventions.</li><li id="EN-US_TOPIC_0000001098974618__li9561734205613">A database object name consists of letters, digits, and underscores (_); and cannot start with a digit. You are advised to use multiple words separated with hyphens (-).</li><li id="EN-US_TOPIC_0000001098974618__li1556123455615">You are advised to use intelligible names and common acronyms or abbreviations for database objects. Acronyms or abbreviations that are generally understood are recommended. For example, you can use English words indicating actual business terms. The naming format should be consistent within a cluster.</li><li id="EN-US_TOPIC_0000001098974618__li1442681418122">A variable name must be descriptive and meaningful. It must have a prefix indicating its type.</li></ul> </li><li id="EN-US_TOPIC_0000001233883317__li1724252616567">[Proposal] Do not use strings enclosed in double quotation marks to define database object names. In GaussDB(DWS), double quotation marks are used to specify that the enclosed database object names are case sensitive. Case sensitivity of database object names makes problem location difficult.</li><li id="EN-US_TOPIC_0000001233883317__li15563344563">[Proposal] Use the same naming format for database objects.<ul id="EN-US_TOPIC_0000001233883317__ul75615347563"><li id="EN-US_TOPIC_0000001233883317__li05603416563">In a system undergoing incremental development or service migration, you are advised to comply with its historical naming conventions.</li><li id="EN-US_TOPIC_0000001233883317__li9561734205613">A database object name consists of letters, digits, and underscores (_); and cannot start with a digit. You are advised to use multiple words separated with hyphens (-).</li><li id="EN-US_TOPIC_0000001233883317__li1556123455615">You are advised to use intelligible names and common acronyms or abbreviations for database objects. Acronyms or abbreviations that are generally understood are recommended. For example, you can use English words indicating actual business terms. The naming format should be consistent within a cluster.</li><li id="EN-US_TOPIC_0000001233883317__li1442681418122">A variable name must be descriptive and meaningful. It must have a prefix indicating its type.</li></ul>
</li><li id="EN-US_TOPIC_0000001098974618__li22041237145610">[Proposal] The name of a table object should indicate its main characteristics, for example, whether it is an ordinary, temporary, or unlogged table.<ul id="EN-US_TOPIC_0000001098974618__ul7204337175616"><li id="EN-US_TOPIC_0000001098974618__li1320483745615">An ordinary table name should indicate the business relevant to a data set.</li><li id="EN-US_TOPIC_0000001098974618__li3204123718567">Temporary tables are named in the format of <strong id="EN-US_TOPIC_0000001098974618__en-us_topic_0097059046_b842352706173450">tmp_</strong><em id="EN-US_TOPIC_0000001098974618__en-us_topic_0097059046_i842352697173448">Suffix</em>.</li><li id="EN-US_TOPIC_0000001098974618__li132041337105615">Unlogged tables are named in the format of <strong id="EN-US_TOPIC_0000001098974618__en-us_topic_0097059046_b84235270617351">ul_</strong><em id="EN-US_TOPIC_0000001098974618__en-us_topic_0097059046_i84235269717357">Suffix</em>.</li><li id="EN-US_TOPIC_0000001098974618__li19204137195614">Foreign tables are named in the format of <strong id="EN-US_TOPIC_0000001098974618__en-us_topic_0097059046_b842352706143019">f_</strong><em id="EN-US_TOPIC_0000001098974618__en-us_topic_0097059046_i842352697143034">Suffix</em>.</li></ul> </li><li id="EN-US_TOPIC_0000001233883317__li22041237145610">[Proposal] The name of a table object should indicate its main characteristics, for example, whether it is an ordinary, temporary, or unlogged table.<ul id="EN-US_TOPIC_0000001233883317__ul7204337175616"><li id="EN-US_TOPIC_0000001233883317__li1320483745615">An ordinary table name should indicate the business relevant to a data set.</li><li id="EN-US_TOPIC_0000001233883317__li3204123718567">Temporary tables are named in the format of <strong id="EN-US_TOPIC_0000001233883317__en-us_topic_0097059046_b842352706173450">tmp_</strong><em id="EN-US_TOPIC_0000001233883317__en-us_topic_0097059046_i842352697173448">Suffix</em>.</li><li id="EN-US_TOPIC_0000001233883317__li132041337105615">Unlogged tables are named in the format of <strong id="EN-US_TOPIC_0000001233883317__en-us_topic_0097059046_b84235270617351">ul_</strong><em id="EN-US_TOPIC_0000001233883317__en-us_topic_0097059046_i84235269717357">Suffix</em>.</li><li id="EN-US_TOPIC_0000001233883317__li19204137195614">Foreign tables are named in the format of <strong id="EN-US_TOPIC_0000001233883317__en-us_topic_0097059046_b842352706143019">f_</strong><em id="EN-US_TOPIC_0000001233883317__en-us_topic_0097059046_i842352697143034">Suffix</em>.</li></ul>
</li></ul> </li></ul>
</div> </div>
<div> <div>

View File

@ -1,4 +1,4 @@
<a name="EN-US_TOPIC_0000001145814423"></a><a name="EN-US_TOPIC_0000001145814423"></a> <a name="EN-US_TOPIC_0000001188323740"></a><a name="EN-US_TOPIC_0000001188323740"></a>
<h1 class="topictitle1">Database Object Design</h1> <h1 class="topictitle1">Database Object Design</h1>
<div id="body1528161858339"></div> <div id="body1528161858339"></div>

View File

@ -1,11 +1,11 @@
<a name="EN-US_TOPIC_0000001098654898"></a><a name="EN-US_TOPIC_0000001098654898"></a> <a name="EN-US_TOPIC_0000001188482124"></a><a name="EN-US_TOPIC_0000001188482124"></a>
<h1 class="topictitle1">Database and Schema Design</h1> <h1 class="topictitle1">Database and Schema Design</h1>
<div id="body1528162486098"><p id="EN-US_TOPIC_0000001098654898__a163526b0670d42fa992ba7033a636dc1">In <span id="EN-US_TOPIC_0000001098654898__text1265888159">GaussDB(DWS)</span>, services can be isolated by databases and schemas. Databases share little resources and cannot directly access each other. Connections to and permissions on them are also isolated. Schemas share more resources than databases do. User permissions on schemas and subordinate objects can be controlled using the <strong id="EN-US_TOPIC_0000001098654898__b84235270694635">GRANT</strong> and <strong id="EN-US_TOPIC_0000001098654898__b84235270694632">REVOKE</strong> syntax.</p> <div id="body1528162486098"><p id="EN-US_TOPIC_0000001188482124__a163526b0670d42fa992ba7033a636dc1">In <span id="EN-US_TOPIC_0000001188482124__text1265888159">GaussDB(DWS)</span>, services can be isolated by databases and schemas. Databases share little resources and cannot directly access each other. Connections to and permissions on them are also isolated. Schemas share more resources than databases do. User permissions on schemas and subordinate objects can be controlled using the <strong id="EN-US_TOPIC_0000001188482124__b84235270694635">GRANT</strong> and <strong id="EN-US_TOPIC_0000001188482124__b84235270694632">REVOKE</strong> syntax.</p>
<ul id="EN-US_TOPIC_0000001098654898__ul14407749155613"><li id="EN-US_TOPIC_0000001098654898__li17407249185610">You are advised to use schemas to isolate services for convenience and resource sharing.</li><li id="EN-US_TOPIC_0000001098654898__li57147515561">It is recommended that system administrators create schemas and databases and then assign required permissions to users.</li></ul> <ul id="EN-US_TOPIC_0000001188482124__ul14407749155613"><li id="EN-US_TOPIC_0000001188482124__li17407249185610">You are advised to use schemas to isolate services for convenience and resource sharing.</li><li id="EN-US_TOPIC_0000001188482124__li57147515561">It is recommended that system administrators create schemas and databases and then assign required permissions to users.</li></ul>
<div class="section" id="EN-US_TOPIC_0000001098654898__sb41154e9d50a48e6ada14ffd10d2b591"><h4 class="sectiontitle">Database Design Suggestions</h4><ul id="EN-US_TOPIC_0000001098654898__ul1241013276555"><li id="EN-US_TOPIC_0000001098654898__li47531831165518">Create databases as required. Do not use the default <strong id="EN-US_TOPIC_0000001098654898__b149702415296"><span id="EN-US_TOPIC_0000001098654898__text17442175020432">gaussdb</span></strong> database of a cluster.</li><li id="EN-US_TOPIC_0000001098654898__li7201934125511">Create a maximum of three user-defined databases in a cluster.</li><li id="EN-US_TOPIC_0000001098654898__li17746153765510">To make your database encoding compatible with most characters, you are advised to use the UTF-8 encoding when creating a database.</li><li id="EN-US_TOPIC_0000001098654898__li1931294213555">Exercise caution when you set <strong id="EN-US_TOPIC_0000001098654898__b84235270619237">ENCODING</strong> and <strong id="EN-US_TOPIC_0000001098654898__b84235270619239">DBCOMPATIBILITY</strong> configuration items during database creation. In <span id="EN-US_TOPIC_0000001098654898__text1069744734">GaussDB(DWS)</span>, <strong id="EN-US_TOPIC_0000001098654898__b842352706113254">DBCOMPATIBILITY</strong> can be set to <strong id="EN-US_TOPIC_0000001098654898__b842352706114537">TD</strong>, <strong id="EN-US_TOPIC_0000001098654898__b842352706114542">Oracle</strong>, or <strong id="EN-US_TOPIC_0000001098654898__b1733613542491">MySQL</strong> to be compatible with Teradata, Oracle, or MySQL syntax, respectively. Syntax behavior may vary with the three modes. For details, see <a href="dws_04_0042.html">Syntax Compatibility Differences Among Oracle, Teradata, and MySQL</a>.</li><li id="EN-US_TOPIC_0000001098654898__li164101627125511">By default, a database owner has all permissions for all objects in the database, including the deletion permission. Exercise caution when using the deletion permission.</li></ul> <div class="section" id="EN-US_TOPIC_0000001188482124__sb41154e9d50a48e6ada14ffd10d2b591"><h4 class="sectiontitle">Database Design Suggestions</h4><ul id="EN-US_TOPIC_0000001188482124__ul1241013276555"><li id="EN-US_TOPIC_0000001188482124__li47531831165518">Create databases as required. Do not use the default <strong id="EN-US_TOPIC_0000001188482124__b149702415296"><span id="EN-US_TOPIC_0000001188482124__text17442175020432">gaussdb</span></strong> database of a cluster.</li><li id="EN-US_TOPIC_0000001188482124__li7201934125511">Create a maximum of three user-defined databases in a cluster.</li><li id="EN-US_TOPIC_0000001188482124__li17746153765510">To make your database encoding compatible with most characters, you are advised to use the UTF-8 encoding when creating a database.</li><li id="EN-US_TOPIC_0000001188482124__li1931294213555">Exercise caution when you set <strong id="EN-US_TOPIC_0000001188482124__b84235270619237">ENCODING</strong> and <strong id="EN-US_TOPIC_0000001188482124__b84235270619239">DBCOMPATIBILITY</strong> configuration items during database creation. In <span id="EN-US_TOPIC_0000001188482124__text1069744734">GaussDB(DWS)</span>, <strong id="EN-US_TOPIC_0000001188482124__b842352706113254">DBCOMPATIBILITY</strong> can be set to <strong id="EN-US_TOPIC_0000001188482124__b842352706114537">TD</strong>, <strong id="EN-US_TOPIC_0000001188482124__b842352706114542">Oracle</strong>, or <strong id="EN-US_TOPIC_0000001188482124__b1733613542491">MySQL</strong> to be compatible with Teradata, Oracle, or MySQL syntax, respectively. Syntax behavior may vary with the three modes. For details, see <a href="dws_04_0042.html">Syntax Compatibility Differences Among Oracle, Teradata, and MySQL</a>.</li><li id="EN-US_TOPIC_0000001188482124__li164101627125511">By default, a database owner has all permissions for all objects in the database, including the deletion permission. Exercise caution when using the deletion permission.</li></ul>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001098654898__s51d3bc0fb11b4dccbfd9db3d49343942"><h4 class="sectiontitle">Schema Design Suggestions</h4><ul id="EN-US_TOPIC_0000001098654898__ul14634748125512"><li id="EN-US_TOPIC_0000001098654898__li846585175513">To let a user access an object in a schema, grant the <strong id="EN-US_TOPIC_0000001098654898__b16307749125110">usage</strong> permission and the permissions for the object to the user, unless the user has the <strong id="EN-US_TOPIC_0000001098654898__b7235165515515">sysadmin</strong> permission or is the schema owner.</li><li id="EN-US_TOPIC_0000001098654898__li46701354105515">To let a user create an object in the schema, grant the <strong id="EN-US_TOPIC_0000001098654898__b9700145918515">create</strong> permission for the schema to the user.</li><li id="EN-US_TOPIC_0000001098654898__li17634124817557">By default, a schema owner has all permissions for all objects in the schema, including the deletion permission. Exercise caution when using the deletion permission.</li></ul> <div class="section" id="EN-US_TOPIC_0000001188482124__s51d3bc0fb11b4dccbfd9db3d49343942"><h4 class="sectiontitle">Schema Design Suggestions</h4><ul id="EN-US_TOPIC_0000001188482124__ul14634748125512"><li id="EN-US_TOPIC_0000001188482124__li846585175513">To let a user access an object in a schema, grant the <strong id="EN-US_TOPIC_0000001188482124__b16307749125110">usage</strong> permission and the permissions for the object to the user, unless the user has the <strong id="EN-US_TOPIC_0000001188482124__b7235165515515">sysadmin</strong> permission or is the schema owner.</li><li id="EN-US_TOPIC_0000001188482124__li46701354105515">To let a user create an object in the schema, grant the <strong id="EN-US_TOPIC_0000001188482124__b9700145918515">CREATE</strong> permission for the schema to the user.</li><li id="EN-US_TOPIC_0000001188482124__li17634124817557">By default, a schema owner has all permissions for all objects in the schema, including the deletion permission. Exercise caution when using the deletion permission.</li></ul>
</div> </div>
</div> </div>
<div> <div>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,16 @@
<a name="EN-US_TOPIC_0000001098654806"></a><a name="EN-US_TOPIC_0000001098654806"></a> <a name="EN-US_TOPIC_0000001233681823"></a><a name="EN-US_TOPIC_0000001233681823"></a>
<h1 class="topictitle1">Constraint Design</h1> <h1 class="topictitle1">Constraint Design</h1>
<div id="body1528162486098"><div class="section" id="EN-US_TOPIC_0000001098654806__section555838816718"><h4 class="sectiontitle">DEFAULT and NULL Constraints</h4><ul id="EN-US_TOPIC_0000001098654806__ul1188131610581"><li id="EN-US_TOPIC_0000001098654806__li1188616165818">[Proposal] If all the column values can be obtained from services, you are not advised to use the <strong id="EN-US_TOPIC_0000001098654806__b842352706163544">DEFAULT</strong> constraint, because doing so will generate unexpected results during data loading.</li><li id="EN-US_TOPIC_0000001098654806__li124803200584">[Proposal] Add <strong id="EN-US_TOPIC_0000001098654806__b842352706163730">NOT NULL</strong> constraints to columns that never have NULL values. The optimizer automatically optimizes the columns in certain scenarios.</li><li id="EN-US_TOPIC_0000001098654806__li11798102210586">[Proposal] Explicitly name all constraints excluding <strong id="EN-US_TOPIC_0000001098654806__b842352706163934">NOT NULL</strong> and <strong id="EN-US_TOPIC_0000001098654806__b842352706163937">DEFAULT</strong>.</li></ul> <div id="body1528162486098"><div class="section" id="EN-US_TOPIC_0000001233681823__section555838816718"><h4 class="sectiontitle">DEFAULT and NULL Constraints</h4><ul id="EN-US_TOPIC_0000001233681823__ul1188131610581"><li id="EN-US_TOPIC_0000001233681823__li1188616165818">[Proposal] If all the column values can be obtained from services, you are not advised to use the <strong id="EN-US_TOPIC_0000001233681823__b842352706163544">DEFAULT</strong> constraint, because doing so will generate unexpected results during data loading.</li><li id="EN-US_TOPIC_0000001233681823__li124803200584">[Proposal] Add <strong id="EN-US_TOPIC_0000001233681823__b842352706163730">NOT NULL</strong> constraints to columns that never have NULL values. The optimizer automatically optimizes the columns in certain scenarios.</li><li id="EN-US_TOPIC_0000001233681823__li11798102210586">[Proposal] Explicitly name all constraints excluding <strong id="EN-US_TOPIC_0000001233681823__b842352706163934">NOT NULL</strong> and <strong id="EN-US_TOPIC_0000001233681823__b842352706163937">DEFAULT</strong>.</li></ul>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001098654806__section2578598416718"><h4 class="sectiontitle">Partial Cluster Key</h4><p id="EN-US_TOPIC_0000001098654806__p46071979">A partial cluster key (PCK) is a local clustering technology used for column-store tables. After creating a PCK, you can quickly filter and scan fact tables using min or max sparse indexes in <span id="EN-US_TOPIC_0000001098654806__text1158130347">GaussDB(DWS)</span>. Comply with the following rules to create a PCK:</p> <div class="section" id="EN-US_TOPIC_0000001233681823__section2578598416718"><h4 class="sectiontitle">Partial Cluster Key</h4><p id="EN-US_TOPIC_0000001233681823__p46071979">A partial cluster key (PCK) is a local clustering technology used for column-store tables. After creating a PCK, you can quickly filter and scan fact tables using min or max sparse indexes in <span id="EN-US_TOPIC_0000001233681823__text1158130347">GaussDB(DWS)</span>. Comply with the following rules to create a PCK:</p>
<ul id="EN-US_TOPIC_0000001098654806__ul8800142614588"><li id="EN-US_TOPIC_0000001098654806__li480092635814">[Notice] Only one PCK can be created in a table. A PCK can contain multiple columns, preferably no more than two columns.</li><li id="EN-US_TOPIC_0000001098654806__li1378132910586">[Proposal] Create a PCK on simple expression filter conditions in a query. Such filter conditions are usually in the form of <strong id="EN-US_TOPIC_0000001098654806__b84235270617039">col op const</strong>, where <strong id="EN-US_TOPIC_0000001098654806__b84235270617137">col</strong> specifies a column name, <strong id="EN-US_TOPIC_0000001098654806__b84235270617143">op</strong> specifies an operator (such as =, &gt;, &gt;=, &lt;=, and &lt;), and <strong id="EN-US_TOPIC_0000001098654806__b8423527061721">const</strong> specifies a constant.</li><li id="EN-US_TOPIC_0000001098654806__li1131316325583">[Proposal] If the preceding conditions are met, create a PCK on the column having the least distinct values.</li></ul> <ul id="EN-US_TOPIC_0000001233681823__ul8800142614588"><li id="EN-US_TOPIC_0000001233681823__li480092635814">[Notice] Only one PCK can be created in a table. A PCK can contain multiple columns, preferably no more than two columns.</li><li id="EN-US_TOPIC_0000001233681823__li1378132910586">[Proposal] Create a PCK on simple expression filter conditions in a query. Such filter conditions are usually in the form of <strong id="EN-US_TOPIC_0000001233681823__b84235270617039">col op const</strong>, where <strong id="EN-US_TOPIC_0000001233681823__b84235270617137">col</strong> specifies a column name, <strong id="EN-US_TOPIC_0000001233681823__b84235270617143">op</strong> specifies an operator (such as =, &gt;, &gt;=, &lt;=, and &lt;), and <strong id="EN-US_TOPIC_0000001233681823__b8423527061721">const</strong> specifies a constant.</li><li id="EN-US_TOPIC_0000001233681823__li1131316325583">[Proposal] If the preceding conditions are met, create a PCK on the column having the least distinct values.</li></ul>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001098654806__section958094516718"><h4 class="sectiontitle">Unique Constraint</h4><ul id="EN-US_TOPIC_0000001098654806__ul184984019587"><li id="EN-US_TOPIC_0000001098654806__li17849940165819">[Notice] Both row-store and column-store tables support unique constraints.</li><li id="EN-US_TOPIC_0000001098654806__li15802104395817">[Proposal] The constraint name should indicate that it is a unique constraint, for example, <strong id="EN-US_TOPIC_0000001098654806__b84235270617735">UNI</strong><em id="EN-US_TOPIC_0000001098654806__i84235269717747">Included columns</em>.</li></ul> <div class="section" id="EN-US_TOPIC_0000001233681823__section958094516718"><h4 class="sectiontitle">Unique Constraint</h4><ul id="EN-US_TOPIC_0000001233681823__ul184984019587"><li id="EN-US_TOPIC_0000001233681823__li17849940165819">[Notice] Both row-store and column-store tables support unique constraints.</li><li id="EN-US_TOPIC_0000001233681823__li15802104395817">[Proposal] The constraint name should indicate that it is a unique constraint, for example, <strong id="EN-US_TOPIC_0000001233681823__b84235270617735">UNI</strong><em id="EN-US_TOPIC_0000001233681823__i84235269717747">Included columns</em>.</li></ul>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001098654806__section3696271616719"><h4 class="sectiontitle">Primary Key Constraint</h4><ul id="EN-US_TOPIC_0000001098654806__ul139403464585"><li id="EN-US_TOPIC_0000001098654806__li2940646185816">[Notice] Both row-store and column-store tables support the primary key constraint.</li><li id="EN-US_TOPIC_0000001098654806__li3376144911587">[Proposal] The constraint name should indicate that it is a primary key constraint, for example, <strong id="EN-US_TOPIC_0000001098654806__b982443271171149">PK</strong><em id="EN-US_TOPIC_0000001098654806__i2143730926171149">Included columns</em>.</li></ul> <div class="section" id="EN-US_TOPIC_0000001233681823__section3696271616719"><h4 class="sectiontitle">Primary Key Constraint</h4><ul id="EN-US_TOPIC_0000001233681823__ul139403464585"><li id="EN-US_TOPIC_0000001233681823__li2940646185816">[Notice] Both row-store and column-store tables support the primary key constraint.</li><li id="EN-US_TOPIC_0000001233681823__li3376144911587">[Proposal] The constraint name should indicate that it is a primary key constraint, for example, <strong id="EN-US_TOPIC_0000001233681823__b982443271171149">PK</strong><em id="EN-US_TOPIC_0000001233681823__i2143730926171149">Included columns</em>.</li></ul>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001098654806__section45602286161148"><h4 class="sectiontitle">Check Constraint</h4><ul id="EN-US_TOPIC_0000001098654806__ul9583552165819"><li id="EN-US_TOPIC_0000001098654806__li135837525587">[Notice] Check constraints can be used in row-store tables but not in column-store tables.</li><li id="EN-US_TOPIC_0000001098654806__li3792165419589">[Proposal] The constraint name should indicate that it is a check constraint, for example, <strong id="EN-US_TOPIC_0000001098654806__b1629266142">CK</strong><em id="EN-US_TOPIC_0000001098654806__i1069563465">Included columns</em>.</li></ul> <div class="section" id="EN-US_TOPIC_0000001233681823__section45602286161148"><h4 class="sectiontitle">Check Constraint</h4><ul id="EN-US_TOPIC_0000001233681823__ul9583552165819"><li id="EN-US_TOPIC_0000001233681823__li135837525587">[Notice] Check constraints can be used in row-store tables but not in column-store tables.</li><li id="EN-US_TOPIC_0000001233681823__li3792165419589">[Proposal] The constraint name should indicate that it is a check constraint, for example, <strong id="EN-US_TOPIC_0000001233681823__b914985737">CK</strong><em id="EN-US_TOPIC_0000001233681823__i1486198355">Included columns</em>.</li></ul>
</div> </div>
</div> </div>
<div> <div>

View File

@ -1,9 +1,9 @@
<a name="EN-US_TOPIC_0000001145894807"></a><a name="EN-US_TOPIC_0000001145894807"></a> <a name="EN-US_TOPIC_0000001233681661"></a><a name="EN-US_TOPIC_0000001233681661"></a>
<h1 class="topictitle1">View and Joined Table Design</h1> <h1 class="topictitle1">View and Joined Table Design</h1>
<div id="body1528162486098"><div class="section" id="EN-US_TOPIC_0000001145894807__section4431103710524"><h4 class="sectiontitle">View Design</h4><ul id="EN-US_TOPIC_0000001145894807__ul15374258175816"><li id="EN-US_TOPIC_0000001145894807__li18374258155814">[Proposal] Do not nest views unless they have strong dependency on each other.</li><li id="EN-US_TOPIC_0000001145894807__li95301035916">[Proposal] Try to avoid sort operations in a view definition.</li></ul> <div id="body1528162486098"><div class="section" id="EN-US_TOPIC_0000001233681661__section4431103710524"><h4 class="sectiontitle">View Design</h4><ul id="EN-US_TOPIC_0000001233681661__ul15374258175816"><li id="EN-US_TOPIC_0000001233681661__li18374258155814">[Proposal] Do not nest views unless they have strong dependency on each other.</li><li id="EN-US_TOPIC_0000001233681661__li95301035916">[Proposal] Try to avoid sort operations in a view definition.</li></ul>
</div> </div>
<div class="section" id="EN-US_TOPIC_0000001145894807__section6265550010713"><h4 class="sectiontitle">Joined Table Design</h4><ul id="EN-US_TOPIC_0000001145894807__ul1798817211596"><li id="EN-US_TOPIC_0000001145894807__li15988523595">[Proposal] Minimize joined columns across tables.</li><li id="EN-US_TOPIC_0000001145894807__li82861353592">[Proposal] Joined columns should use the same data type.</li><li id="EN-US_TOPIC_0000001145894807__li96527718596">[Proposal] The names of joined columns should indicate their relationship. For example, they can use the same name.</li></ul> <div class="section" id="EN-US_TOPIC_0000001233681661__section6265550010713"><h4 class="sectiontitle">Joined Table Design</h4><ul id="EN-US_TOPIC_0000001233681661__ul1798817211596"><li id="EN-US_TOPIC_0000001233681661__li15988523595">[Proposal] Minimize joined columns across tables.</li><li id="EN-US_TOPIC_0000001233681661__li82861353592">[Proposal] Joined columns should use the same data type.</li><li id="EN-US_TOPIC_0000001233681661__li96527718596">[Proposal] The names of associated fields should show the associations. For example, they can use the same name.</li></ul>
</div> </div>
</div> </div>
<div> <div>

Some files were not shown because too many files have changed in this diff Show More