forked from laiweijian4/doc-exports
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>
16 lines
2.3 KiB
HTML
16 lines
2.3 KiB
HTML
<a name="EN-US_TOPIC_0000001099134454"></a><a name="EN-US_TOPIC_0000001099134454"></a>
|
|
|
|
<h1 class="topictitle1">Selecting a Data Type</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001099134454__a0a0152a5a02a4cf0a0e1cf0dc0effe28">Use the following principles to obtain efficient data types:</p>
|
|
<ol id="EN-US_TOPIC_0000001099134454__oeddde42eaa5248c3b8d8b6a6bef76377"><li id="EN-US_TOPIC_0000001099134454__l122d76538afd439e80b6dc1fee335f9f"><strong id="EN-US_TOPIC_0000001099134454__b842352706113748">Using the data type that can be efficiently executed</strong><p class="litext" id="EN-US_TOPIC_0000001099134454__a78787f67aae84b0ba21ba1e6d30af069">Generally, calculation of integers (including common comparison calculations, such as =, >, <, ≥, ≤, and ≠ and group by) is more efficient than that of strings and floating point numbers. For example, if you need to filter data in a column containing numeric data for a column-store table where point query is performed, the execution takes over 10s. However, the execution time is reduced to 1.8s when you change the data type from NUMERIC to INT.</p>
|
|
</li><li id="EN-US_TOPIC_0000001099134454__lff4a61298ace42a4b9ebc9a0ef7aa9dd"><strong id="EN-US_TOPIC_0000001099134454__b842352706141912">Using the data type of short length column</strong><p id="EN-US_TOPIC_0000001099134454__a4fa8a80b24504dce98a9b7ad4378e3ae">Using the data type with a shorter length reduces both the data file size and the memory used for computing, improving the I/O and computing performance. For example, use SMALLINT instead of INT, and INT instead of BIGINT.</p>
|
|
</li><li id="EN-US_TOPIC_0000001099134454__la2b6983de52d45a49788943ea19d1f40"><strong id="EN-US_TOPIC_0000001099134454__b842352706143633">Using the same data type for associated columns</strong><p id="EN-US_TOPIC_0000001099134454__a30f1fe0d4a394f8c8435e7184c2b70b6">Use the same data type for associated columns. If columns having different data types are associated, the database must dynamically convert the different data types into the same ones for comparison. The conversion results in 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>
|
|
|