DWS DEVELOPER 811 version

Reviewed-by: Hasko, Vladimir <vladimir.hasko@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 2023-01-19 13:37:49 +00:00 committed by zuul
parent a037336b6b
commit a24ca60074
1140 changed files with 127700 additions and 0 deletions

File diff suppressed because it is too large Load Diff

8507
docs/dws/dev/CLASS.TXT.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
version=""
language="en-us"
type=""

View File

@ -0,0 +1,20 @@
<a name="EN-US_TOPIC_0000001146360933"></a><a name="EN-US_TOPIC_0000001146360933"></a>
<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>
<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>
<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="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>
<p id="EN-US_TOPIC_0000001146360933__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></ol>
</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>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0986.html">Full Database Migration</a></div>
</div>
</div>

View File

@ -0,0 +1,21 @@
<a name="EN-US_TOPIC_0000001145894951"></a><a name="EN-US_TOPIC_0000001145894951"></a>
<h1 class="topictitle1">Welcome</h1>
<div id="body1546077570978"></div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="dws_04_0002.html">Target Readers</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0004.html">Reading Guide</a></strong><br>
</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>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_1000.html">Developer Guide</a></div>
</div>
</div>

View File

@ -0,0 +1,20 @@
<a name="EN-US_TOPIC_0000001098974562"></a><a name="EN-US_TOPIC_0000001098974562"></a>
<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>
<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>
<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>
<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>
<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_0000001098974562__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_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_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>
</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

@ -0,0 +1,57 @@
<a name="EN-US_TOPIC_0000001147429923"></a><a name="EN-US_TOPIC_0000001147429923"></a>
<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>
<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>
<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_0000001147429923__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>
</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>
</tr>
</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>
</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>
<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>
</td>
</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>
</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>
</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>
</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>
<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>
</td>
</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>
</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>
</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>
</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>
</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>
</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>
<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>
</td>
</tr>
</tbody>
</table>
</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

@ -0,0 +1,94 @@
<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

@ -0,0 +1,13 @@
<a name="EN-US_TOPIC_0000001100619984"></a><a name="EN-US_TOPIC_0000001100619984"></a>
<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>
<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>
<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>
</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

@ -0,0 +1,20 @@
<a name="EN-US_TOPIC_0000001099134502"></a><a name="EN-US_TOPIC_0000001099134502"></a>
<h1 class="topictitle1">System Overview</h1>
<div id="body1494317364745"><p id="EN-US_TOPIC_0000001099134502__en-us_topic_0059777588_p8060118"></p>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="dws_04_0011.html">Highly Reliable Transaction Processing</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0012.html">High Query Performance</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0015.html">Related Concepts</a></strong><br>
</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_1000.html">Developer Guide</a></div>
</div>
</div>

View File

@ -0,0 +1,16 @@
<a name="EN-US_TOPIC_0000001147236333"></a><a name="EN-US_TOPIC_0000001147236333"></a>
<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>
<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_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>
<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>
<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>
<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>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0007.html">System Overview</a></div>
</div>
</div>

View File

@ -0,0 +1,20 @@
<a name="EN-US_TOPIC_0000001147041825"></a><a name="EN-US_TOPIC_0000001147041825"></a>
<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 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>
<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>
</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>
<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>
</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>
<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>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0007.html">System Overview</a></div>
</div>
</div>

View File

@ -0,0 +1,22 @@
<a name="EN-US_TOPIC_0000001099134964"></a><a name="EN-US_TOPIC_0000001099134964"></a>
<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>
<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>
<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>
<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>
<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>
<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>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0007.html">System Overview</a></div>
</div>
</div>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
<a name="EN-US_TOPIC_0000001098814874"></a><a name="EN-US_TOPIC_0000001098814874"></a>
<h1 class="topictitle1">Database Security Management</h1>
<div id="body1494318882616"><p id="EN-US_TOPIC_0000001098814874__en-us_topic_0059778204_p8060118"></p>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="dws_04_0053.html">Managing Users and Their Permissions</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0994.html">Sensitive Data Management</a></strong><br>
</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_1000.html">Developer Guide</a></div>
</div>
</div>

View File

@ -0,0 +1,29 @@
<a name="EN-US_TOPIC_0000001099134534"></a><a name="EN-US_TOPIC_0000001099134534"></a>
<h1 class="topictitle1">Managing Users and Their Permissions</h1>
<div id="body8662426"></div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="dws_04_0054.html">Default Permission Mechanism</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0055.html">System Administrator</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0056.html">Separation of Permissions</a></strong><br>
</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>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0043.html">Database Security Management</a></div>
</div>
</div>

View File

@ -0,0 +1,16 @@
<a name="EN-US_TOPIC_0000001099134980"></a><a name="EN-US_TOPIC_0000001099134980"></a>
<h1 class="topictitle1">Default Permission Mechanism</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>
<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_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>
<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_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>
<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>
</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

@ -0,0 +1,23 @@
<a name="EN-US_TOPIC_0000001098814672"></a><a name="EN-US_TOPIC_0000001098814672"></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>
</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>
<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 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

View File

@ -0,0 +1,36 @@
<a name="EN-US_TOPIC_0000001145894533"></a><a name="EN-US_TOPIC_0000001145894533"></a>
<h1 class="topictitle1">Users</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>
<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>
<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_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>
</pre></div></td></tr></table></div>
</div>
</div>
</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>
</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>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</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>
<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>
<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>
</pre></div></td></tr></table></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>
</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

@ -0,0 +1,20 @@
<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

@ -0,0 +1,52 @@
<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

@ -0,0 +1,38 @@
<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

View File

@ -0,0 +1,19 @@
<a name="EN-US_TOPIC_0000001145694395"></a><a name="EN-US_TOPIC_0000001145694395"></a>
<h1 class="topictitle1">Setting Security Policies</h1>
<div id="body8662426"></div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="dws_04_0064.html">Setting Account Security Policies</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0065.html">Setting the Validity Period of an Account</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0067.html">Setting a User Password</a></strong><br>
</li>
</ul>
<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

@ -0,0 +1,35 @@
<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

@ -0,0 +1,25 @@
<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

@ -0,0 +1,20 @@
<a name="EN-US_TOPIC_0000001146041053"></a><a name="EN-US_TOPIC_0000001146041053"></a>
<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>
<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>
<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>
<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_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_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_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>
</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>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0210.html">Importing Data from MRS to a Cluster</a></div>
</div>
</div>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
<a name="EN-US_TOPIC_0000001099134598"></a><a name="EN-US_TOPIC_0000001099134598"></a>
<h1 class="topictitle1">Development and Design Proposal</h1>
<div id="body1528161858339"></div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="dws_04_0075.html">Development and Design Proposal</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0076.html">Database Object Naming Conventions</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0077.html">Database Object Design</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0083.html">JDBC Configuration</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0084.html">SQL Compilation</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0971.html">PL/Java Usage</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0972.html">PL/pgSQL Usage</a></strong><br>
</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_1000.html">Developer Guide</a></div>
</div>
</div>

View File

@ -0,0 +1,13 @@
<a name="EN-US_TOPIC_0000001145894631"></a><a name="EN-US_TOPIC_0000001145894631"></a>
<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>
<p id="EN-US_TOPIC_0000001145894631__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>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0074.html">Development and Design Proposal</a></div>
</div>
</div>

View File

@ -0,0 +1,16 @@
<a name="EN-US_TOPIC_0000001098974618"></a><a name="EN-US_TOPIC_0000001098974618"></a>
<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>
<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>
</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_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></ul>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0074.html">Development and Design Proposal</a></div>
</div>
</div>

View File

@ -0,0 +1,23 @@
<a name="EN-US_TOPIC_0000001145814423"></a><a name="EN-US_TOPIC_0000001145814423"></a>
<h1 class="topictitle1">Database Object Design</h1>
<div id="body1528161858339"></div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="dws_04_0078.html">Database and Schema Design</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0079.html">Table Design</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0080.html">Column Design</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0081.html">Constraint Design</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0082.html">View and Joined Table Design</a></strong><br>
</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0074.html">Development and Design Proposal</a></div>
</div>
</div>

View File

@ -0,0 +1,16 @@
<a name="EN-US_TOPIC_0000001098654898"></a><a name="EN-US_TOPIC_0000001098654898"></a>
<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>
<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>
<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>
<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>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0077.html">Database Object Design</a></div>
</div>
</div>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,92 @@
<a name="EN-US_TOPIC_0000001099134996"></a><a name="EN-US_TOPIC_0000001099134996"></a>
<h1 class="topictitle1">Column Design</h1>
<div id="body1528162486098"><div class="section" id="EN-US_TOPIC_0000001099134996__section52674274151022"><h4 class="sectiontitle">Selecting a Data Type</h4><p id="EN-US_TOPIC_0000001099134996__p17648120153918">Comply with the following rules to improve query efficiency when you design columns:</p>
<ul id="EN-US_TOPIC_0000001099134996__ul952274495712"><li id="EN-US_TOPIC_0000001099134996__li552294415711">[Proposal] Use the most efficient data types allowed.<p id="EN-US_TOPIC_0000001099134996__p34218508162823"><a name="EN-US_TOPIC_0000001099134996__li552294415711"></a><a name="li552294415711"></a>If all of the following number types provide the required service precision, they are recommended in descending order of priority: integer, floating point, and numeric.</p>
</li><li id="EN-US_TOPIC_0000001099134996__li142377588575">[Proposal] In tables that are logically related, columns having the same meaning should use the same data type.</li><li id="EN-US_TOPIC_0000001099134996__li984870145814">[Proposal] For string data, you are advised to use variable-length strings and specify the maximum length. To avoid truncation, ensure that the specified maximum length is greater than the maximum number of characters to be stored. You are not advised to use CHAR(n), BPCHAR(n), NCHAR(n), or CHARACTER(n), unless you know that the string length is fixed.<p id="EN-US_TOPIC_0000001099134996__p62529563163851"><a name="EN-US_TOPIC_0000001099134996__li984870145814"></a><a name="li984870145814"></a>For details about string types, see <a href="#EN-US_TOPIC_0000001099134996__section290310115932">Common String Types</a>.</p>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001099134996__section290310115932"><a name="EN-US_TOPIC_0000001099134996__section290310115932"></a><a name="section290310115932"></a><h4 class="sectiontitle">Common String Types</h4><p id="EN-US_TOPIC_0000001099134996__p3479669215102">Every column requires a data type suitable for its data characteristics. The following table lists common string types in <span id="EN-US_TOPIC_0000001099134996__text1320630605">GaussDB(DWS)</span>.</p>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001099134996__table50547859" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Common string types</caption><thead align="left"><tr id="EN-US_TOPIC_0000001099134996__row888699"><th align="left" class="cellrowborder" valign="top" width="26.567343265673433%" id="mcps1.3.3.2.4.1.1"><p id="EN-US_TOPIC_0000001099134996__p4875833"><strong id="EN-US_TOPIC_0000001099134996__b43882502">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46.865313468653135%" id="mcps1.3.3.2.4.1.2"><p id="EN-US_TOPIC_0000001099134996__p64821786"><strong id="EN-US_TOPIC_0000001099134996__b46525162">Description</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="26.567343265673433%" id="mcps1.3.3.2.4.1.3"><p id="EN-US_TOPIC_0000001099134996__p10441773"><strong id="EN-US_TOPIC_0000001099134996__b26867098">Max. Storage Capacity</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001099134996__row28751319"><td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001099134996__p47155484">CHAR(n)</p>
</td>
<td class="cellrowborder" valign="top" width="46.865313468653135%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001099134996__p61497874">Fixed-length string, where <em id="EN-US_TOPIC_0000001099134996__i842352697151355">n</em> indicates the stored bytes. If the length of an input string is smaller than <em id="EN-US_TOPIC_0000001099134996__i84235269715200">n</em>, the string is automatically padded to <em id="EN-US_TOPIC_0000001099134996__i842352697152028">n</em> bytes using NULL characters.</p>
</td>
<td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001099134996__p15271904">10 MB</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001099134996__row3229416"><td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001099134996__p60256175">CHARACTER(n)</p>
</td>
<td class="cellrowborder" valign="top" width="46.865313468653135%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001099134996__p48911969">Fixed-length string, where <em id="EN-US_TOPIC_0000001099134996__i230763006">n</em> indicates the stored bytes. If the length of an input string is smaller than <em id="EN-US_TOPIC_0000001099134996__i1655400800">n</em>, the string is automatically padded to <em id="EN-US_TOPIC_0000001099134996__i1449883227">n</em> bytes using NULL characters.</p>
</td>
<td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001099134996__p2446568">10 MB</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001099134996__row22019119"><td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001099134996__p38718224">NCHAR(n)</p>
</td>
<td class="cellrowborder" valign="top" width="46.865313468653135%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001099134996__p49168441">Fixed-length string, where <em id="EN-US_TOPIC_0000001099134996__i259629078">n</em> indicates the stored bytes. If the length of an input string is smaller than <em id="EN-US_TOPIC_0000001099134996__i722675692">n</em>, the string is automatically padded to <em id="EN-US_TOPIC_0000001099134996__i904459278">n</em> bytes using NULL characters.</p>
</td>
<td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001099134996__p23220819">10 MB</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001099134996__row7660786"><td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001099134996__p16543928">BPCHAR(n)</p>
</td>
<td class="cellrowborder" valign="top" width="46.865313468653135%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001099134996__p64989762">Fixed-length string, where <em id="EN-US_TOPIC_0000001099134996__i393738329">n</em> indicates the stored bytes. If the length of an input string is smaller than <em id="EN-US_TOPIC_0000001099134996__i395137356">n</em>, the string is automatically padded to <em id="EN-US_TOPIC_0000001099134996__i45344670">n</em> bytes using NULL characters.</p>
</td>
<td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001099134996__p29679352">10 MB</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001099134996__row65787584"><td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001099134996__p27194084">VARCHAR(n)</p>
</td>
<td class="cellrowborder" valign="top" width="46.865313468653135%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001099134996__p55237225">Variable-length string, where <em id="EN-US_TOPIC_0000001099134996__i842352697152210">n</em> indicates the maximum number of bytes that can be stored.</p>
</td>
<td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001099134996__p45030263">10 MB</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001099134996__row2619184"><td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001099134996__p10827357">CHARACTER VARYING(n)</p>
</td>
<td class="cellrowborder" valign="top" width="46.865313468653135%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001099134996__p4600743">Variable-length string, where <em id="EN-US_TOPIC_0000001099134996__i842352697152255">n</em> indicates the maximum number of bytes that can be stored. This data type and VARCHAR(n) are different representations of the same data type.</p>
</td>
<td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001099134996__p37115893">10 MB</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001099134996__row65607585"><td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001099134996__p12614193">VARCHAR2(n)</p>
</td>
<td class="cellrowborder" valign="top" width="46.865313468653135%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001099134996__p15116730">Variable-length string, where <em id="EN-US_TOPIC_0000001099134996__i1854927984152430">n</em> indicates the maximum number of bytes that can be stored. This data type is added to be compatible with the Oracle database, and its behavior is the same as that of VARCHAR(n).</p>
</td>
<td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001099134996__p16495587">10 MB</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001099134996__row14242555"><td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001099134996__p12796279">NVARCHAR2(n)</p>
</td>
<td class="cellrowborder" valign="top" width="46.865313468653135%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001099134996__p29865704">Variable-length string, where <em id="EN-US_TOPIC_0000001099134996__i1748914844">n</em> indicates the maximum number of bytes that can be stored.</p>
</td>
<td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001099134996__p28826987">10 MB</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001099134996__row58116296"><td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.1 "><p id="EN-US_TOPIC_0000001099134996__p9799559">TEXT</p>
</td>
<td class="cellrowborder" valign="top" width="46.865313468653135%" headers="mcps1.3.3.2.4.1.2 "><p id="EN-US_TOPIC_0000001099134996__p55566810">Variable-length string. Its maximum length is 8203 bytes less than 1 GB.</p>
</td>
<td class="cellrowborder" valign="top" width="26.567343265673433%" headers="mcps1.3.3.2.4.1.3 "><p id="EN-US_TOPIC_0000001099134996__p4617770">8203 bytes less than 1 GB</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0077.html">Database Object Design</a></div>
</div>
</div>

View File

@ -0,0 +1,21 @@
<a name="EN-US_TOPIC_0000001098654806"></a><a name="EN-US_TOPIC_0000001098654806"></a>
<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>
<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>
<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>
</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>
<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>
<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>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0077.html">Database Object Design</a></div>
</div>
</div>

View File

@ -0,0 +1,14 @@
<a name="EN-US_TOPIC_0000001145894807"></a><a name="EN-US_TOPIC_0000001145894807"></a>
<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>
<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>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0077.html">Database Object Design</a></div>
</div>
</div>

View File

@ -0,0 +1,35 @@
<a name="EN-US_TOPIC_0000001145814437"></a><a name="EN-US_TOPIC_0000001145814437"></a>
<h1 class="topictitle1">JDBC Configuration</h1>
<div id="body1528162486098"><p id="EN-US_TOPIC_0000001145814437__p83201518124912">Currently, third-party tools are connected to <span id="EN-US_TOPIC_0000001145814437__text120969138">GaussDB(DWS)</span> trough JDBC. This section describes the precautions for configuring the tools.</p>
<div class="section" id="EN-US_TOPIC_0000001145814437__section51233666102514"><h4 class="sectiontitle">Connection Parameters</h4><ul id="EN-US_TOPIC_0000001145814437__ul4235888102912"><li id="EN-US_TOPIC_0000001145814437__li33742908102912">[Notice] When a third-party tool connects to <span id="EN-US_TOPIC_0000001145814437__text267386391">GaussDB(DWS)</span> through JDBC, JDBC sends a connection request to <span id="EN-US_TOPIC_0000001145814437__text1267787076">GaussDB(DWS)</span>. By default, the following parameters are added. For details, see the implementation of the ConnectionFactoryImpl JDBC code.<pre class="screen" id="EN-US_TOPIC_0000001145814437__screen51783857102912">params = {
{ "user", user },
{ "database", database },
{ "client_encoding", "UTF8" },
{ "DateStyle", "ISO" },
{ "extra_float_digits", "2" },
{ "TimeZone", createPostgresTimeZone() },
};</pre>
<p id="EN-US_TOPIC_0000001145814437__p15181893103553">These parameters may cause the JDBC and gsql clients to display inconsistent data, for example, date data display mode, floating point precision representation, and timezone.</p>
<p id="EN-US_TOPIC_0000001145814437__p63401535102912">If the result is not as expected, you are advised to explicitly set these parameters in the Java connection setting.</p>
</li><li id="EN-US_TOPIC_0000001145814437__li22840275102912">[Proposal] When connecting to the database through JDBC, ensure that the following two time zones are the same:<ul id="EN-US_TOPIC_0000001145814437__ul62190131102912"><li id="EN-US_TOPIC_0000001145814437__li35250721102912">Time zone of the host where the JDBC client is located</li><li id="EN-US_TOPIC_0000001145814437__li16356185655617">Time zone of the host where the <span id="EN-US_TOPIC_0000001145814437__text675913043">GaussDB(DWS)</span> server is located</li></ul>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001145814437__section2864318010275"><h4 class="sectiontitle">fetchsize</h4><p id="EN-US_TOPIC_0000001145814437__p1208899">[Notice] To use <strong id="EN-US_TOPIC_0000001145814437__b21951949173115">fetchsize</strong> in applications, disable the <strong id="EN-US_TOPIC_0000001145814437__b842352706145926">autocommit</strong> switch. Enabling the <strong id="EN-US_TOPIC_0000001145814437__b84235270615044">autocommit</strong> switch makes the <strong id="EN-US_TOPIC_0000001145814437__b84235270615111">fetchsize</strong> configuration invalid.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001145814437__section1636443510276"><h4 class="sectiontitle">autocommit</h4><p id="EN-US_TOPIC_0000001145814437__p40373845104858">[Proposal] It is recommended that you enable the <strong id="EN-US_TOPIC_0000001145814437__b842352706142820">autocommit</strong> switch in the code for connecting to <span id="EN-US_TOPIC_0000001145814437__text265447366">GaussDB(DWS)</span> by the JDBC. If <strong id="EN-US_TOPIC_0000001145814437__b842352706143016">autocommit</strong> needs to be disabled to improve performance or for other purposes, applications need to ensure their transactions are committed. For example, explicitly commit translations after specifying service SQL statements. Particularly, ensure that all transactions are committed before the client exits.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001145814437__section1577694110277"><h4 class="sectiontitle">Connection Releasing</h4><p id="EN-US_TOPIC_0000001145814437__p144341064916">[Proposal] You are advised to use connection pools to limit the number of connections from applications. Do not connect to a database every time you run an SQL statement.</p>
<p id="EN-US_TOPIC_0000001145814437__p23100085">[Proposal] After an application completes its tasks, disconnect its connection to <span id="EN-US_TOPIC_0000001145814437__text94760255">GaussDB(DWS)</span> to release occupied resources. You are advised to set the session timeout interval in the task.</p>
<p id="EN-US_TOPIC_0000001145814437__p1964373612402">[Proposal] Reset the session environment before releasing connections to the JDBC connection tool. Otherwise, historical session information may cause object conflicts.</p>
<ul id="EN-US_TOPIC_0000001145814437__ul319815399488"><li id="EN-US_TOPIC_0000001145814437__li319853920486">If GUC parameters are set in the connection, before you return the connection to the connection pool, run <strong id="EN-US_TOPIC_0000001145814437__b84235270618227">SET SESSION AUTHORIZATION DEFAULT;RESET ALL;</strong> to clear the connection status.</li><li id="EN-US_TOPIC_0000001145814437__li7553164720488">If a temporary table is used, delete it before you return the connection to the connection pool.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001145814437__section1624965810277"><h4 class="sectiontitle">CopyManager</h4><p id="EN-US_TOPIC_0000001145814437__p1841431102854">[Proposal] In the scenario where the ETL tool is not used and real-time data import is required, it is recommended that you use the CopyManger interface driven by the <span id="EN-US_TOPIC_0000001145814437__text2056484717">GaussDB(DWS)</span> JDBC to import data in batches during application development. For details about how to use <a href="dws_04_0116.html">CopyManager</a>, see <a href="dws_04_0116.html">CopyManager</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0074.html">Development and Design Proposal</a></div>
</div>
</div>

View File

@ -0,0 +1,74 @@
<a name="EN-US_TOPIC_0000001145814543"></a><a name="EN-US_TOPIC_0000001145814543"></a>
<h1 class="topictitle1">SQL Compilation</h1>
<div id="body1528161858339"><div class="section" id="EN-US_TOPIC_0000001145814543__section60205875143313"><h4 class="sectiontitle">DDL</h4><ul id="EN-US_TOPIC_0000001145814543__ul1972862419595"><li id="EN-US_TOPIC_0000001145814543__li1072832415918">[Proposal] In <span id="EN-US_TOPIC_0000001145814543__text526581581">GaussDB(DWS)</span>, you are advised to execute DDL operations, such as creating table or making comments, separately from batch processing jobs to avoid performance deterioration caused by many concurrent transactions.</li><li id="EN-US_TOPIC_0000001145814543__li5212735919">[Proposal] Execute data truncation after unlogged tables are used because <span id="EN-US_TOPIC_0000001145814543__text281995683">GaussDB(DWS)</span> cannot ensure the security of unlogged tables in abnormal scenarios.</li><li id="EN-US_TOPIC_0000001145814543__li1719012919599">[Proposal] Suggestions on the storage mode of temporary and unlogged tables are the same as those on base tables. Create temporary tables in the same storage mode as the base tables to avoid high computing costs caused by hybrid row and column correlation.</li><li id="EN-US_TOPIC_0000001145814543__li1661583105916">[Proposal] The total length of an index column cannot exceed 50 bytes. Otherwise, the index size will increase greatly, resulting in large storage cost and low index performance.</li><li id="EN-US_TOPIC_0000001145814543__li17294434115910">[Proposal] Do not delete objects using <strong id="EN-US_TOPIC_0000001145814543__b175334270593533">DROP...CASCADE</strong>, unless the dependency between objects is specified. Otherwise, the objects may be deleted by mistake.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001145814543__section45234071153513"><h4 class="sectiontitle">Data Loading and Uninstalling</h4><ul id="EN-US_TOPIC_0000001145814543__ul866153885912"><li id="EN-US_TOPIC_0000001145814543__li1466143811599">[Proposal] Provide the inserted column list in the insert statement. Example:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145814543__screen206623818595"><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">INSERT</span><span class="w"> </span><span class="k">INTO</span><span class="w"> </span><span class="n">task</span><span class="p">(</span><span class="n">name</span><span class="p">,</span><span class="n">id</span><span class="p">,</span><span class="k">comment</span><span class="p">)</span><span class="w"> </span><span class="k">VALUES</span><span class="w"> </span><span class="p">(</span><span class="s1">'task1'</span><span class="p">,</span><span class="s1">'100'</span><span class="p">,</span><span class="s1">'100th task'</span><span class="p">);</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001145814543__li1018434110596">[Proposal] After data is imported to the database in batches or the data increment reaches the threshold, you are advised to analyze tables to prevent the execution plan from being degraded due to inaccurate statistics.</li><li id="EN-US_TOPIC_0000001145814543__li18713443105913">[Proposal] To clear all data in a table, you are advised to use <strong id="EN-US_TOPIC_0000001145814543__b1688884693638">TRUNCATE TABLE</strong> instead of <strong id="EN-US_TOPIC_0000001145814543__b200528289993638">DELETE TABLE</strong>. <strong id="EN-US_TOPIC_0000001145814543__b60032975893717">DELETE TABLE</strong> is not efficient and cannot release disk space occupied by the deleted data.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001145814543__section28537273145311"><h4 class="sectiontitle">Type conversion</h4><ul id="EN-US_TOPIC_0000001145814543__ul11745246115918"><li id="EN-US_TOPIC_0000001145814543__li27451746135914">[Proposal] Perform type coercion to convert data types. If you perform implicit conversion, the result may differ from expected.</li><li id="EN-US_TOPIC_0000001145814543__li3440349125917">[Proposal] During data query, explicitly specify the data type for constants, and do not attempt to perform any implicit data type conversion.</li><li id="EN-US_TOPIC_0000001145814543__li1731052145918">[Notice] In Oracle compatibility mode, null strings will be automatically converted to NULL during data import. If a null string needs to be reserved, you need to create a database that is compatible with Teradata.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001145814543__section48841047154511"><h4 class="sectiontitle">Query Operation</h4><ul id="EN-US_TOPIC_0000001145814543__ul31156185916"><li id="EN-US_TOPIC_0000001145814543__li1311156185914">[Proposal] Do not return a large number of result sets to a client except the ETL program. If a large result set is returned, consider modifying your service design.</li><li id="EN-US_TOPIC_0000001145814543__li8373115875917">[Proposal] Perform DDL and DML operations encapsulated in transactions. Operations like table truncation, update, deletion, and dropping, cannot be rolled back once committed. You are advised to encapsulate such operations in transactions so that you can roll back the operations if necessary.</li><li id="EN-US_TOPIC_0000001145814543__li13858707018">[Proposal] During query compilation, you are advised to list all columns to be queried and avoid using <strong id="EN-US_TOPIC_0000001145814543__b842352706162352">*</strong>. Doing so reduces output lines, improves query performance, and avoids the impact of adding or deleting columns on front-end service compatibility.</li><li id="EN-US_TOPIC_0000001145814543__li18254841303">[Proposal] During table object access, add the schema prefix to the table object to avoid accessing an unexpected table due to schema switchover.</li><li id="EN-US_TOPIC_0000001145814543__li36071160012">[Proposal] The cost of joining more than three tables or views, especially full joins, is difficult to be estimated. You are advised to use the <strong id="EN-US_TOPIC_0000001145814543__b842352706114736">WITH TABLE AS</strong> statement to create interim tables to improve the readability of SQL statements.</li><li id="EN-US_TOPIC_0000001145814543__li17291295012">[Proposal] Do not use Cartesian products or full joins. Cartesian products and full joins will result in a sharp expansion of result sets and poor performance.</li><li id="EN-US_TOPIC_0000001145814543__li142772131306">[Notice] Only <strong id="EN-US_TOPIC_0000001145814543__b842352706115240">IS NULL</strong> and <strong id="EN-US_TOPIC_0000001145814543__b842352706115243">IS NOT NULL</strong> can be used to determine NULL value comparison results. If any other method is used, NULL is returned. For example, <strong id="EN-US_TOPIC_0000001145814543__b1727151044012">NULL</strong> instead of expected Boolean values is returned for <strong id="EN-US_TOPIC_0000001145814543__b842352706115627">NULL&lt;&gt;NULL</strong>, <strong id="EN-US_TOPIC_0000001145814543__b842352706115631">NULL=NULL</strong>, and <strong id="EN-US_TOPIC_0000001145814543__b842352706115635">NULL&lt;&gt;1</strong>.</li><li id="EN-US_TOPIC_0000001145814543__li16640101611013">[Notice] Do not use count(col) instead of count(*) to count the total number of records in a table. count(*) counts the NULL value (actual rows) while count (col) does not.</li><li id="EN-US_TOPIC_0000001145814543__li94211913016">[Notice] While executing count(col), the number of NULL record rows is counted as 0. While executing sum(col), NULL is returned if all records are NULL. If not all the records are NULL, the number of NULL record rows is counted as 0.</li><li id="EN-US_TOPIC_0000001145814543__li96616211405">[Notice] To count multiple columns using count(), column names must be enclosed with parentheses. For example, count ((col1, col2, col3)). Note: When multiple columns are used to count the number of NULL record rows, a row is counted even if all the selected columns are NULL. The result is the same as that when count(*) is executed.</li><li id="EN-US_TOPIC_0000001145814543__li159382516013">[Notice] Null records are not counted when count(distinct col) is used to calculate the number of non-null columns that are not repeated.</li><li id="EN-US_TOPIC_0000001145814543__li174733286016">[Notice] If all statistical columns are NULL when count(distinct (col1,col2,...)) is used to count the number of unique values in multiple columns, Null records are also counted, and the records are considered the same.</li><li id="EN-US_TOPIC_0000001145814543__li875853413494">[Notice] When constants are used to filter data, the system searches for functions used for calculating these two data types based on the data types of the constants and matched columns. If no function is found, the system converts the data type implicitly. Then, the system searches for a function used for calculating the converted data type.<pre class="screen" id="EN-US_TOPIC_0000001145814543__screen1269491605712">SELECT * FROM test WHERE timestamp_col = 20000101;</pre>
<p id="EN-US_TOPIC_0000001145814543__p3801145495418">In the preceding example, if <strong id="EN-US_TOPIC_0000001145814543__b4478175201020">timestamp_col</strong> is the timestamp type, the system first searches for the function that supports the "equal" operation of the timestamp and int types (constant numbers are considered as the int type). If no such function is found, the <strong id="EN-US_TOPIC_0000001145814543__b1528517173164">timestamp_col</strong> data and constant numbers are implicitly converted into the text type for calculation.</p>
</li><li id="EN-US_TOPIC_0000001145814543__li54741939206">[Proposal] Do not use scalar subquery statements. A scalar subquery appears in the output list of a <strong id="EN-US_TOPIC_0000001145814543__b17735115516138">SELECT</strong> statement. In the following example, the part enclosed in parentheses is a scalar subquery statement:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145814543__screen047418392014"><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">id</span><span class="p">,</span><span class="w"> </span><span class="p">(</span><span class="k">SELECT</span><span class="w"> </span><span class="k">COUNT</span><span class="p">(</span><span class="o">*</span><span class="p">)</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">films</span><span class="w"> </span><span class="n">f</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="n">f</span><span class="p">.</span><span class="n">did</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="n">id</span><span class="p">)</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">staffs_p1</span><span class="w"> </span><span class="n">s</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001145814543__p65339406113426">Scalar subqueries often result in query performance deterioration. During application development, scalar subqueries need to be converted into equivalent table associations based on the service logic.</p>
</li><li id="EN-US_TOPIC_0000001145814543__li6104647302">[Proposal] In <strong id="EN-US_TOPIC_0000001145814543__b842352706172811">WHERE</strong> clauses, the filtering conditions should be sorted. The condition that few records are selected for reading (the number of filtered records is small) is listed at the beginning.</li><li id="EN-US_TOPIC_0000001145814543__li20777449808">[Proposal] Filtering conditions in <strong id="EN-US_TOPIC_0000001145814543__b842352706172821">WHERE</strong> clauses should comply with unilateral rules. That is, when the column name is placed on one side of a comparison operator, the optimizer automatically performs pruning optimization in some scenarios. Filtering conditions in a <strong id="EN-US_TOPIC_0000001145814543__b124629312895126">WHERE</strong> clause will be displayed in <strong id="EN-US_TOPIC_0000001145814543__b139129845295126">col op expression</strong> format, where <strong id="EN-US_TOPIC_0000001145814543__b119823048695126">col</strong> indicates a table column, <strong id="EN-US_TOPIC_0000001145814543__b1037389995126">op</strong> indicates a comparison operator, such as = and &gt;, and <strong id="EN-US_TOPIC_0000001145814543__b89754445695126">expression</strong> indicates an expression that does not contain a column name. For example:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145814543__screen677711491903"><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">id</span><span class="p">,</span><span class="w"> </span><span class="n">from_image_id</span><span class="p">,</span><span class="w"> </span><span class="n">from_person_id</span><span class="p">,</span><span class="w"> </span><span class="n">from_video_id</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">face_data</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="k">current_timestamp</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="k">time</span><span class="w"> </span><span class="o">&lt;</span><span class="w"> </span><span class="s1">'1 days'</span><span class="p">::</span><span class="nb">interval</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001145814543__p26912854112759">The modification is as follows:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145814543__screen40889095112759"><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">id</span><span class="p">,</span><span class="w"> </span><span class="n">from_image_id</span><span class="p">,</span><span class="w"> </span><span class="n">from_person_id</span><span class="p">,</span><span class="w"> </span><span class="n">from_video_id</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">face_data</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="k">time</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="k">current_timestamp</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="s1">'1 days'</span><span class="p">::</span><span class="nb">interval</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001145814543__li18346183117">[Proposal] Do not perform unnecessary sorting operations. Sorting requires a large amount of memory and CPU. If service logic permits, <strong id="EN-US_TOPIC_0000001145814543__b842352706164621">ORDER BY</strong> and <strong id="EN-US_TOPIC_0000001145814543__b842352706164624">LIMIT</strong> can be combined to reduce resource overhead. By default, data in <span id="EN-US_TOPIC_0000001145814543__text30313868">GaussDB(DWS)</span> is sorted by ASC &amp; NULL LAST.</li><li id="EN-US_TOPIC_0000001145814543__li1294114512111">[Proposal] When the <strong id="EN-US_TOPIC_0000001145814543__b842352706164757">ORDER BY</strong> clause is used for sorting, specify sorting modes (ASC or DESC), and use NULL FIRST or NULL LAST for NULL record sorting.</li><li id="EN-US_TOPIC_0000001145814543__li5371188317">[proposal] Do not rely on only the <strong id="EN-US_TOPIC_0000001145814543__b842352706165145">LIMIT</strong> clause to return the result set displayed in a specific sequence. Combine <strong id="EN-US_TOPIC_0000001145814543__b842352706165346">ORDER BY</strong> and <strong id="EN-US_TOPIC_0000001145814543__b842352706165350">LIMIT</strong> clauses for some specific result sets and use offset to skip specific results if necessary.</li><li id="EN-US_TOPIC_0000001145814543__li861011115">[Proposal] If the service logic is accurate, you are advised to use <strong id="EN-US_TOPIC_0000001145814543__b84235270617118">UNION ALL</strong> instead of <strong id="EN-US_TOPIC_0000001145814543__b84235270617121">UNION</strong>.</li><li id="EN-US_TOPIC_0000001145814543__li957714131716">[Proposal] If a filtering condition contains only an <strong id="EN-US_TOPIC_0000001145814543__b84235270617126">OR</strong> expression, convert the <strong id="EN-US_TOPIC_0000001145814543__b84235270617135">OR </strong>expression to <strong id="EN-US_TOPIC_0000001145814543__b84235270617131">UNION ALL</strong> to improve performance. SQL statements that use <strong id="EN-US_TOPIC_0000001145814543__b84235270617155">OR</strong> expressions cannot be optimized, resulting in slow execution. Example:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145814543__screen1757791320111"><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">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">scdc</span><span class="p">.</span><span class="n">pub_menu</span><span class="w"> </span>
<span class="k">WHERE</span><span class="w"> </span><span class="p">(</span><span class="n">cdp</span><span class="o">=</span><span class="w"> </span><span class="mi">300</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="n">inline</span><span class="o">=</span><span class="mi">301</span><span class="p">)</span><span class="w"> </span><span class="k">OR</span><span class="w"> </span><span class="p">(</span><span class="n">cdp</span><span class="o">=</span><span class="w"> </span><span class="mi">301</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="n">inline</span><span class="o">=</span><span class="mi">302</span><span class="p">)</span><span class="w"> </span><span class="k">OR</span><span class="w"> </span><span class="p">(</span><span class="n">cdp</span><span class="o">=</span><span class="w"> </span><span class="mi">302</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="n">inline</span><span class="o">=</span><span class="mi">301</span><span class="p">);</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001145814543__p9824563112759">Convert the statement to the following:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145814543__screen36954014112759"><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="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">scdc</span><span class="p">.</span><span class="n">pub_menu</span><span class="w"> </span>
<span class="k">WHERE</span><span class="w"> </span><span class="p">(</span><span class="n">cdp</span><span class="o">=</span><span class="w"> </span><span class="mi">300</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="n">inline</span><span class="o">=</span><span class="mi">301</span><span class="p">)</span><span class="w"> </span>
<span class="k">union</span><span class="w"> </span><span class="k">all</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">scdc</span><span class="p">.</span><span class="n">pub_menu</span><span class="w"> </span>
<span class="k">WHERE</span><span class="w"> </span><span class="p">(</span><span class="n">cdp</span><span class="o">=</span><span class="w"> </span><span class="mi">301</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="n">inline</span><span class="o">=</span><span class="mi">302</span><span class="p">)</span><span class="w"> </span>
<span class="k">union</span><span class="w"> </span><span class="k">all</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">tablename</span><span class="w"> </span>
<span class="k">WHERE</span><span class="w"> </span><span class="p">(</span><span class="n">cdp</span><span class="o">=</span><span class="w"> </span><span class="mi">302</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="n">inline</span><span class="o">=</span><span class="mi">301</span><span class="p">);</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001145814543__li88758236119">[Proposal] If an <strong id="EN-US_TOPIC_0000001145814543__b842352706163646">in(val1, val2, va...)</strong> expression contains a large number of columns, you are advised to replace it with the <strong id="EN-US_TOPIC_0000001145814543__b842352706163620">in (values (va11), (val2),(val3...)</strong> statement. The optimizer will automatically convert the <strong id="EN-US_TOPIC_0000001145814543__b1458111681316">IN</strong> constraint into a non-correlated subquery to improve the query performance.</li><li id="EN-US_TOPIC_0000001145814543__li1837032616114">[Proposal] Replace <strong id="EN-US_TOPIC_0000001145814543__b842352706174314">(not) in</strong> with <strong id="EN-US_TOPIC_0000001145814543__b842352706174319">(not) exist</strong> when associated columns do not contain <strong id="EN-US_TOPIC_0000001145814543__b176681586284">NULL</strong> values. For example, in the following query statement, if the T1.C1 column does not contain any NULL value, add the NOT NULL constraint to the T1.C1 column, and then rewrite the statements.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145814543__screen133702262115"><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">T1</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="n">T1</span><span class="p">.</span><span class="n">C1</span><span class="w"> </span><span class="k">NOT</span><span class="w"> </span><span class="k">IN</span><span class="w"> </span><span class="p">(</span><span class="k">SELECT</span><span class="w"> </span><span class="n">T2</span><span class="p">.</span><span class="n">C2</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">T2</span><span class="p">);</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001145814543__p58071969112759">Rewrite the statement as follows:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145814543__screen52885675112759"><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">T1</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="k">NOT</span><span class="w"> </span><span class="k">EXISTS</span><span class="w"> </span><span class="p">(</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">T1</span><span class="p">,</span><span class="n">T2</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="n">T1</span><span class="p">.</span><span class="n">C1</span><span class="o">=</span><span class="n">T2</span><span class="p">.</span><span class="n">C2</span><span class="p">);</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<div class="note" id="EN-US_TOPIC_0000001145814543__note30088550112759"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001145814543__ul33169334112759"><li id="EN-US_TOPIC_0000001145814543__li6209029112759">If the value of the T1.C1 column will possibly be NULL, the preceding rewriting cannot be performed.</li><li id="EN-US_TOPIC_0000001145814543__li55881264112759">If T1.C1 is the output of a subquery, check whether the output is NOT NULL based on the service logic.</li></ul>
</div></div>
</li><li id="EN-US_TOPIC_0000001145814543__li145891038416">[Proposal] Use cursors instead of the <strong id="EN-US_TOPIC_0000001145814543__b842352706171649">LIMIT OFFSET</strong> syntax to perform pagination queries to avoid resource overheads caused by multiple executions. A cursor must be used in a transaction, and you must disable it and commit transaction once the query is finished.</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0074.html">Development and Design Proposal</a></div>
</div>
</div>

View File

@ -0,0 +1,21 @@
<a name="EN-US_TOPIC_0000001099134652"></a><a name="EN-US_TOPIC_0000001099134652"></a>
<h1 class="topictitle1">Guide: JDBC- or ODBC-Based Development</h1>
<div id="body1494318355094"></div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="dws_04_0086.html">Development Specifications</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0087.html">Downloading Drivers</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0088.html">JDBC-Based Development</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0117.html">ODBC-Based Development</a></strong><br>
</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_1000.html">Developer Guide</a></div>
</div>
</div>

View File

@ -0,0 +1,13 @@
<a name="EN-US_TOPIC_0000001098974850"></a><a name="EN-US_TOPIC_0000001098974850"></a>
<h1 class="topictitle1">Development Specifications</h1>
<div id="body1524796389552"><p id="EN-US_TOPIC_0000001098974850__p168620462426">If the connection pool mechanism is used during application development, comply with the following specifications:</p>
<ul id="EN-US_TOPIC_0000001098974850__ul319815399488"><li id="EN-US_TOPIC_0000001098974850__li319853920486">If GUC parameters are set in the connection, before you return the connection to the connection pool, run <strong id="EN-US_TOPIC_0000001098974850__b84235270618227">SET SESSION AUTHORIZATION DEFAULT;RESET ALL;</strong> to clear the connection status.</li><li id="EN-US_TOPIC_0000001098974850__li7553164720488">If a temporary table is used, delete it before you return the connection to the connection pool.</li></ul>
<p id="EN-US_TOPIC_0000001098974850__p1686746104213">If you do not do so, the status of connections in the connection pool will remain, which affects subsequent operations using the connection pool.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0085.html">Guide: JDBC- or ODBC-Based Development</a></div>
</div>
</div>

View File

@ -0,0 +1,11 @@
<a name="EN-US_TOPIC_0000001147147293"></a><a name="EN-US_TOPIC_0000001147147293"></a>
<h1 class="topictitle1">Downloading Drivers</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001147147293__en-us_topic_0000001099130898_p4451066501">For details, see section "Downloading the JDBC or ODBC Driver" in the <em id="EN-US_TOPIC_0000001147147293__i0667146155217">Data Warehouse Service User Guide</em>.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0085.html">Guide: JDBC- or ODBC-Based Development</a></div>
</div>
</div>

View File

@ -0,0 +1,38 @@
<a name="EN-US_TOPIC_0000001098974872"></a><a name="EN-US_TOPIC_0000001098974872"></a>
<h1 class="topictitle1">JDBC-Based Development</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001098974872__aa806003196d444e4910e8aeb1d0e7753">Java Database Connectivity (JDBC) is a Java API for executing SQL statements, providing a unified access interface for different relational databases, based on which applications process data. <span id="EN-US_TOPIC_0000001098974872__text868486363">GaussDB(DWS)</span> supports JDBC 4.0 and requires JDK 1.6 or later for code compiling. It does not support JDBC-ODBC Bridge.</p>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="dws_04_0090.html">JDBC Package and Driver Class</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0091.html">Development Process</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0092.html">Loading a Driver</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0093.html">Connecting to a Database</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0095.html">Executing SQL Statements</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0096.html">Processing Data in a Result Set</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0097.html">Closing the Connection</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0098.html">Example: Common Operations</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0099.html">Example: Retrying SQL Queries for Applications</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0100.html">Example: Importing and Exporting Data Through Local Files</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0101.html">Example: Migrating Data from MySQL to GaussDB(DWS)</a></strong><br>
</li>
<li class="ulchildlink"><strong><a href="dws_04_0102.html">JDBC Interface Reference</a></strong><br>
</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0085.html">Guide: JDBC- or ODBC-Based Development</a></div>
</div>
</div>

View File

@ -0,0 +1,16 @@
<a name="EN-US_TOPIC_0000001098814720"></a><a name="EN-US_TOPIC_0000001098814720"></a>
<h1 class="topictitle1">JDBC Package and Driver Class</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001098814720__sbfa536a4d98e47b384c69d8cb91db388"><h4 class="sectiontitle">JDBC Package</h4><p id="EN-US_TOPIC_0000001098814720__p759115835819"><span id="EN-US_TOPIC_0000001098814720__ph158921831987">Obtain the package <strong id="EN-US_TOPIC_0000001098814720__b5875103351920">dws_8.1.x_jdbc_driver.zip</strong> from the management console. For details, see <a href="dws_04_0087.html">Downloading Drivers</a>.</span> </p>
<p id="EN-US_TOPIC_0000001098814720__p18962111516415">Compressed in it is the JDBC driver JAR package:</p>
<p id="EN-US_TOPIC_0000001098814720__p51891491255"><strong id="EN-US_TOPIC_0000001098814720__b9233114133513">gsjdbc4.jar</strong>: Driver package compatible with PostgreSQL. The class name and class structure in the driver are the same as those in the PostgreSQL driver. All the applications running on PostgreSQL can be smoothly transferred to the current system.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001098814720__s10fda0404a3e43beba982d84bd15dc54"><h4 class="sectiontitle">Driver Class</h4><p id="EN-US_TOPIC_0000001098814720__a0419f434ab2c4e3ba492911d10066c10">Before creating a database connection, you need to load the database driver class <strong id="EN-US_TOPIC_0000001098814720__b374112488439">org.postgresql.Driver</strong> (decompressed from <strong id="EN-US_TOPIC_0000001098814720__b16741124864310">gsjdbc4.jar</strong>).</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0088.html">JDBC-Based Development</a></div>
</div>
</div>

View File

@ -0,0 +1,11 @@
<a name="EN-US_TOPIC_0000001145814473"></a><a name="EN-US_TOPIC_0000001145814473"></a>
<h1 class="topictitle1">Development Process</h1>
<div id="body8662426"><div class="fignone" id="EN-US_TOPIC_0000001145814473__fcafbde07cfaa494ab49f20ae5bd84b7a"><span class="figcap"><b>Figure 1 </b>JDBC-based application development process</span><br><span><img id="EN-US_TOPIC_0000001145814473__i6a73e7281bc64638b280d20b489a02a6" src="figure/en-us_image_0000001098815162.png"></span></div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0088.html">JDBC-Based Development</a></div>
</div>
</div>

View File

@ -0,0 +1,13 @@
<a name="EN-US_TOPIC_0000001145694779"></a><a name="EN-US_TOPIC_0000001145694779"></a>
<h1 class="topictitle1">Loading a Driver</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001145694779__aad761dbdae3142a18755e96188b06794">Load the database driver before creating a database connection.</p>
<p id="EN-US_TOPIC_0000001145694779__ac499bb5780dd4eaeb2580d1011438f6b">You can load the driver in the following ways:</p>
<ul id="EN-US_TOPIC_0000001145694779__ubd790d2e5a5c43c192c02a1c1c2a9b71"><li id="EN-US_TOPIC_0000001145694779__l96db4ecf7bd9477cb3a0d3f76cf2a095">Implicitly loading the driver before creating a connection in the code: <strong id="EN-US_TOPIC_0000001145694779__b17355821013">Class.forName ("org.postgresql.Driver")</strong></li><li id="EN-US_TOPIC_0000001145694779__l1dd4ec6c9812458db1b7207604b27579">Transferring a parameter during the JVM startup: <strong id="EN-US_TOPIC_0000001145694779__b616316121518">java -Djdbc.drivers=org.postgresql.Driver jdbctest</strong></li></ul>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0088.html">JDBC-Based Development</a></div>
</div>
</div>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

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