Page 1 of 1

Using Date as key in KSDS.

Posted: Sat Oct 16, 2021 8:32 pm
by pratik_bhandari
Hi,

Interviewer asked me that can we use Date as key in KSDS? I did say that it can be used but I was confused with this question. Interviewer did not tell me if it was wrong or right and asked next question. I searched on google also but I did not find if using date has different meaning in key. Could someone tell me if there is a difference using date as key and some other variable as key?

Re: Using Date as key in KSDS.

Posted: Sun Oct 17, 2021 6:29 pm
by Robert Sample
There is nothing special about using a date as a key in a KSDS. However, you have to carefully consider the date format since it will impact how the data is stored. Using the date in DDMMYYYY or MMDDYYYY format, for example, means the data will NOT be arranged in a uniformly ascending format. Using the date in YYYYMMDD format means all new records will be added at the end of the KSDS (assuming the date is the beginning of the key); this can impact performance.

Re: Using Date as key in KSDS.

Posted: Mon Oct 18, 2021 8:43 pm
by pratik_bhandari
Robert Sample wrote: Sun Oct 17, 2021 6:29 pm There is nothing special about using a date as a key in a KSDS. However, you have to carefully consider the date format since it will impact how the data is stored. Using the date in DDMMYYYY or MMDDYYYY format, for example, means the data will NOT be arranged in a uniformly ascending format. Using the date in YYYYMMDD format means all new records will be added at the end of the KSDS (assuming the date is the beginning of the key); this can impact performance.
Thanks Robert. Your point is correct that it will be in ascending order, assuming it is in ascending order. This will also limit the total number of keys as 365 for a year? Right? That's another performance limitation.

Re: Using Date as key in KSDS.

Posted: Tue Oct 19, 2021 1:52 am
by Robert Sample
If the key is nothing but the date (which would be rarely if ever used), then there would be a limit of 365 (or 366) records per year. If the key is compound and includes the date and one -- or more -- other fields, then the limit no longer applies.

Re: Using Date as key in KSDS.

Posted: Wed Oct 20, 2021 4:04 pm
by pratik_bhandari
Yes correct Robert, I also agree. Thanks for your answers this has helped.