-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TimeFieldIndex #117
base: main
Are you sure you want to change the base?
Add TimeFieldIndex #117
Conversation
6643163
to
e87deac
Compare
e87deac
to
513a746
Compare
Hi @hackerwins, thank you for this PR. I think that indexing Right now I don't see a strong reason to add it to our library but will leave this PR open as a reference or discussion point for others. |
@kisunji Thanks for your review. In my view, I don't think it will cause memory problems much since But it may be just me for now, so I'm curious what other people think. |
I understand the concerns mentioned, I'll just say that we have a use case for this exact implementation (full precision), primarily for sorting. Specifically we track changes to modules in Terraform LS, each with a timestamp and when processing these changes we want to iterate from oldest to newest record. We could also just use incrementing uint counter, but we already use the timestamp to batch changes within a certain timespan, so it seems better to reuse that field than add a new one. I didn't try to compare the memory usage of I'd be curious about the other use cases which involve lookups and/or reduced precision for memory savings. Relatedly I wonder if the precision could be somehow configurable, similar to how letter casing is configurable for |
My team is using
memdb
with atime.Time
field. In my view,time.Time
is a type that can be used in general.I don't know if this is a good way to index the time.Time field, but this PR adds a TimeFieldIndex to make it easy to index time.Time.
Notes for reviewer:
Adding a
Time
field toTestObject
causes panic fromquick.Check
. So I added a separate object,TestObjectWithTime
.golang/go#27017