This is absolutely nice thought. A column data type in DB2 table can be a DATE or TIME or it can be a TIMESTAMP.
DATE takes 4 bytes and TIME takes 3 bytes. So total 7 bytes. Where as TIMESTAMP takes 10 bytes. So storage wise DATE and TIME are much better to select two separate columns.
DATE is dec(8,0) and TIME is dec(8,0), so you can do addition and subtraction in both date and time. This is an easy calculation.
In case of Timestamp it is Dec(20,0), do the format is YYYYYXXDDHHMMSSZZZZZZ , even you can do subtraction or addition on Timestamp. But, this is more complex calculation.
There is an another case that is choosing two columns DATE and TIME instead of single column of TIMESTAMP, which causes more I/o and it impacts on performance.
The final judgement is select these columns based on project requirements.
- DB2 Date SQL Queries to Use in Your Current Project
- DB2 Load Utility Useful Questions for Interviews
- Locking Vs Concurrency top database mechanism you need to know