Db2 Study Notes-Impact of Data Types on tables

Source: Internet
Author: User

Db2 Study Notes-Impact of Data Types on tables
When creating a table, you can select a proper data type for the column to improve the database performance. 1. select an appropriate data type to avoid data type conversion. For example, some people use a string to store the date and timestamp. Finally, we also need to use to_date in the program for data type conversion, which will affect the performance of the application. 2. select an appropriate length. For example, the empno field can be used to store employee numbers, and small int can be used. However, if we use int, two bytes will be wasted. 3. If a field in the table is a number, we recommend that you use an integer instead of char. 4. Select char and varchar. If the data in a column does not change much, char is recommended because the read performance of varchar is divided into read-only and read-only data, which is weaker than char. 5. long varchar, blog, clog, and cblog data types. The data types of these large objects are read directly without going through the memory. Check whether varchar can be used as needed; if you use the big object data type, consider whether to record the log not logged for this large object column; Consider storing the big object data column separately in an independent tablespace, separated from the index data.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.