Explains that date is generally faster than datetime.

This commit is contained in:
johnnymatthews 2024-01-10 11:50:02 -04:00
parent dbb19e72b3
commit 4723a9c082

View File

@ -18,6 +18,12 @@ Supported range of values: \[1970-01-01 00:00:00, 2106-02-07 06:28:15\].
Resolution: 1 second.
## Speed
The `Date` datatype is faster than `DateTime` under _most_ conditions.
The `Date` type requires 2 bytes of storage, while `DateTime` requires 4. However, when the database compresses the database, this difference is amplified. This amplification is due to the minutes and seconds in `DateTime` being less compressible. Filtering and aggregating `Date` instead of DateTime is also faster.
## Usage Remarks
The point in time is saved as a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time), regardless of the time zone or daylight saving time. The time zone affects how the values of the `DateTime` type values are displayed in text format and how the values specified as strings are parsed (2020-01-01 05:00:01).