doc-exports/docs/dws/dev/dws_04_0444.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-16 07:24:04 +00:00

16 lines
2.8 KiB
HTML

<a name="EN-US_TOPIC_0000001233883193"></a><a name="EN-US_TOPIC_0000001233883193"></a>
<h1 class="topictitle1">Selecting a Data type</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001233883193__a6892aebb5f084c8ba9bed970be03c292">You can use data types with the following features to improve efficiency:</p>
<ol id="EN-US_TOPIC_0000001233883193__ofb60ce381ae446c3a436044f079c8281"><li id="EN-US_TOPIC_0000001233883193__ld1a32bd87c0749e38d24318965a83a0e"><strong id="EN-US_TOPIC_0000001233883193__a40df53415f064985bc664e2a8eaa472e">Data types that boost execution efficiency</strong><p class="litext" id="EN-US_TOPIC_0000001233883193__aff062bf59f7947e0ac12e02fe2a017bc">Generally, the calculation of integers (including common comparison calculations, such as =, &gt;, &lt;, ≥, ≤, and ≠ and <strong id="EN-US_TOPIC_0000001233883193__b56020192335745">GROUP BY</strong>) is more efficient than that of strings and floating point numbers. For example, if you need to perform a point query on a column-store table whose <strong id="EN-US_TOPIC_0000001233883193__b1470343520147">NUMERIC</strong> column is used as a filter criterion, the query will take over 10 seconds. If you change the data type from <strong id="EN-US_TOPIC_0000001233883193__b47088717135745">NUMERIC</strong> to <strong id="EN-US_TOPIC_0000001233883193__b98101610035745">INT</strong>, the query takes only about 1.8 seconds.</p>
</li><li id="EN-US_TOPIC_0000001233883193__l8b6189934f78421a96f540a2e374074c"><strong id="EN-US_TOPIC_0000001233883193__a1bded9abd34d4150b689f965805d305e">Data types with a short length</strong><p id="EN-US_TOPIC_0000001233883193__a705b0062ae404fc3abc852c09ab8a82c">Data types with short length reduce both the data file size and the memory used for computing, improving the I/O and computing performance. For example, use <strong id="EN-US_TOPIC_0000001233883193__b165548082935745">SMALLINT</strong> instead of <strong id="EN-US_TOPIC_0000001233883193__b25338975035745">INT</strong>, and <strong id="EN-US_TOPIC_0000001233883193__b213714787835745">INT</strong> instead of <strong id="EN-US_TOPIC_0000001233883193__b55899065135745">BIGINT</strong>.</p>
</li><li id="EN-US_TOPIC_0000001233883193__l12dffcf3c8fa49f38eccbd54d3687a3d"><strong id="EN-US_TOPIC_0000001233883193__a321fdf0c6f6e43aab87ce4be8315fbf8">Same data type for a join</strong><p id="EN-US_TOPIC_0000001233883193__a82750a80944b4019b54e79fd9ad109c7">You are advised to use the same data type for a join. To join columns with different data types, the database needs to convert them to the same type, which leads to additional performance overheads.</p>
</li></ol>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0437.html">Reviewing and Modifying a Table Definition</a></div>
</div>
</div>