Qianbo Wang
08/26/2021, 11:17 PMcreated_at
which records the epoch time in seconds, we have a use case needs to search for entries created in the last 30 days, 60 days, 90 days, etc. I wonder if there is a best practice I could follow to optimize this, for example:
1. What type is best for this created_at
column? Timestamp, Long, etc.?
2. What kind of indexing would help? range index?
3. anything else could help?
Thanks in advance!Kishore G
Qianbo Wang
08/26/2021, 11:33 PMcreated_at
for this kind of use case considering we need to query something like “in the past 30 days”? we could achieve it by using epoch time in seond like where created_at > timestamp_30_days_before and created_at < current_timestamp
. However I wonder if there is a better way?Ken Krugler
08/26/2021, 11:40 PMQianbo Wang
08/26/2021, 11:47 PMQianbo Wang
08/26/2021, 11:47 PMKen Krugler
08/26/2021, 11:48 PMKen Krugler
08/26/2021, 11:50 PMQianbo Wang
08/26/2021, 11:53 PMKishore G
Yupeng Fu
08/27/2021, 1:07 AMKishore G
Yupeng Fu
08/27/2021, 1:11 AMQianbo Wang
08/27/2021, 6:09 PM