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

Allow to include the current version in history table #63

Closed
wants to merge 2 commits into from

Conversation

mcesar
Copy link
Contributor

@mcesar mcesar commented Dec 6, 2023

No description provided.

@mcesar mcesar changed the title Fix tests Allow to include the current version in history table Dec 6, 2023
@dekiesel
Copy link

I'd be pretty interested in this too since this makes it much easier to see current and historic data at a glance.

@simoneb
Copy link
Member

simoneb commented Jan 31, 2024

@mcesar can you please explain what this PR does and the motivation why you would need this?

@mcesar
Copy link
Contributor Author

mcesar commented Feb 2, 2024

@simoneb this PR gives the option to store the current version in history table together with the old versions. When applied, it will provide a easier way to query data given a timestamp. For example, given a table t(id integer, name text, sys_period tstzrange), we want to query the version at a timestamp x:

a. current behavior:

SELECT * FROM t WHERE x <@ sys_period
UNION
SELECT * FROM t_history WHERE x <@ sys_period;

b. with include_current_version_in_history=true:

SELECT * FROM t_history WHERE x <@ sys_period;

@simoneb
Copy link
Member

simoneb commented Feb 2, 2024

Considering that this has a simple solution in user space and that it would deviate from the original implementation that we're trying to adhere to, I don't see a compelling reason to include this feature, but happy to be convinced otherwise

@mcesar
Copy link
Contributor Author

mcesar commented Feb 2, 2024

I see, I assumed that deviation from original implementation was not an issue because of this part of the readme:

Over time, new features have been introduced while maintaining backward compatibility: (...)

@simoneb
Copy link
Member

simoneb commented Feb 2, 2024

It's not an issue per-se, but this has a very simple solution in user space

@dekiesel
Copy link

dekiesel commented Mar 6, 2024

As the number of tables grows so does the number of workarounds.

I am versioning 21 tables and I have to create 21 views when stepping through historic data. This PR would simplify my life by a lot.

@simoneb
Copy link
Member

simoneb commented Mar 6, 2024

If there is demand for this feature, I'm not strongly against including it. We just need to make sure that, if possible, this doesn't result in a breaking change for existing users, and that the default will remain that of not including the current version in the history table.

@rohaldb
Copy link

rohaldb commented Jul 3, 2024

This I would find this extremely useful. Running the union for me is prohibitively expensive at inference time, meaning I then have to introduce a delay to do it periodically using cron.

@leventea1
Copy link
Contributor

leventea1 commented Oct 4, 2024

@mcesar can you update versioning_function_nochecks.sql and document it in Readme as well.
You might also want to consider mcesar#2
FYI @simoneb

@leventea1 leventea1 removed their assignment Oct 4, 2024
Copy link
Contributor

@leventea1 leventea1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kieranswhite
Copy link
Contributor

@mcesar @dekiesel @rohaldb I am going to close this PR as we have taken changes proposed by @mcesar and merged them in to the extension along with a few small additions. It's been released under version v0.6.0. Thanks all!

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

Successfully merging this pull request may close these issues.

6 participants