Skip to content
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

recall.enable(): When copying existing data, the start times should probably be set to null (i.e. an open interval start) instead of now() #20

Closed
mreithub opened this issue May 17, 2016 · 0 comments
Milestone

Comments

@mreithub
Copy link
Owner

Right now, recall.enable() copies existing data from the data to the log table using now() as start timestamp. This is kind of a relic from a time when I used two separate timestamp fields (_log_start TIMESTAMPTZ NOT NULL and _log_end TIMESTAMPTZ). Back then, _log_start was non-null, so it couldn't reflect undefined values (although, now that I'm thinking of having the start timestamp of the initial data undefined, a nullable field would've been the better choice even back then).

tstzrange allows us to have infinite intervals for these preexisting records.

Implications:

  • querying for data that's older than when the logging was enabled, you'll get (some or all of - depending on whether some of them have fallen victims of cleanup() yet) the initial data instead of an empty result.
  • Sorting changes: When sorting by LOWER(_log_time), all the initial values end up at the end, when simply sorting by _log_time, the sorting is relatively unaffected, but you can't sort by anything else without also sorting by UPPER(_log_time).
    To properly sort only by the start time (and any other column, but not the end time), you'd have to use something like this: order by coalesce(lower(_log_time), '-infinity') asc or this: order by tstzrange(lower(_log_time), null) asc
  • it brings up the point whether or not it might make sense to have recall.at() filter by the log interval and the timestamp stored in recall._config (i.e. when using it outside of the time range in which it can give you precise data, it'd return an empty result/error instead). I'll create another issue for that though.
@mreithub mreithub modified the milestone: 1.0 May 21, 2016
@mreithub mreithub modified the milestones: 1.0, 0.9.6 May 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant