Files
doc-exports/docs/dws/dev/dws_04_0108.html
luhuayi 177cd61a57 DWS DEVG 910.211 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: luhuayi <luhuayi@huawei.com>
Co-committed-by: luhuayi <luhuayi@huawei.com>
2025-05-05 07:44:03 +00:00

35 lines
6.7 KiB
HTML

<a name="EN-US_TOPIC_0000002100746046"></a><a name="EN-US_TOPIC_0000002100746046"></a>
<h1 class="topictitle1">DATABASE Object Design</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_section9462145153713"><h4 class="sectiontitle">Rule 2.1: Avoiding Direct Usage of Built-in Databases Such As postgres and gaussdb</h4><div class="note" id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_note11878105141516"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_p256983971910"><strong id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_b419351613112452">Impact of rule violation:</strong></p>
<ul id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_ul143841426152411"><li id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_li7978113918440">If the code or the compatibility setting of the built-in databases does not meet service requirements, you may need to migrate your data again.</li><li id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_li838532692412">The time for changes to be applied may be prolonged if all services use built-in databases.</li></ul>
<p id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_p1535535214192"><strong id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_b312435883112623">Solution:</strong></p>
<ul id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_ul19865131117396"><li id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_li1086561153913">To meet the specific requirements of each service, it is recommended to create a dedicated database and allocate it accordingly.</li></ul>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_section812010258370"><h4 class="sectiontitle">Rule 2.2: Selecting the Suitable Database Code During Database Creation</h4><div class="note" id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_note158041440111315"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_p1830121716342"><strong id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_b604116950112452">Impact of rule violation:</strong></p>
<ul id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_ul143012017103412"><li id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_li18301101763410">Selecting the wrong database code may result in displaying garbled characters, and it is not possible to directly change the database code. In such cases, you will need to create a database and import the data again.</li></ul>
<p id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_p130131715346"><strong id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_b615984372112623">Solution:</strong></p>
<ul id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_ul511404214114"><li id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_li1411417422419">It is advisable to set the <strong id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_b1894510561279">ENCODING</strong> to the UTF-8 format during database creation, unless there are specific requirements for a different encoding.</li></ul>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_section12587184219378"><h4 class="sectiontitle">Rule 2.3: Choosing the Right Database Type for Compatibility with the Database to Be Created</h4><div class="note" id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_note12607191571018"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_p1270418413918"><strong id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_b1207647912112452">Impact of rule violation:</strong></p>
<ul id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_ul670404118910"><li id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_li5704204118910">Selecting the wrong type can lead to behavior inconsistencies after migrating the database from a different vendor to GaussDB(DWS). Unfortunately, it is not possible to directly change the compatibility setting. The only solution is to create a database and import the data again.</li></ul>
<p id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_p1870410411795"><strong id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_b189085938112623">Solution:</strong></p>
<ul id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_ul270454120912"><li id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_li270418418915">GaussDB(DWS) supports compatibility with databases like Teradata, Oracle, and MySQL. You can specify <strong id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_b37105510382">DBCOMPATIBILITY</strong> to set the compatible database type when creating a database.</li></ul>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_section7642125613377"><h4 class="sectiontitle">Suggestion 2.4: Creating the Objects with Associated Calculations in the Same Database</h4><div class="note" id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_note668780152515"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_p42334441334"><strong id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_b929974791112452">Impact of rule violation:</strong></p>
<ul id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_ul823384423314"><li id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_li152338441336">Cross-database access tends to have poorer performance compared to performing operations within the same database.</li></ul>
<p id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_p1323344463316"><strong id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_b727578094112623">Solution:</strong></p>
<ul id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_ul1706338354"><li id="EN-US_TOPIC_0000002100746046__en-us_topic_0000002135726589_li370623173515">If multiple databases are created, it is advisable to create the objects requiring associated calculations in the same database.</li></ul>
</div></div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0104.html">GaussDB(DWS) Object Design Specifications</a></div>
</div>
</div>