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
Support expireAfterSeconds
for indexes (TTL)
#2415
Comments
How would this be implemented? Postgres doesn't support this out of the box AFAIK. Create a regular index on a date field and transparently create a cron? |
When create such an index, create a cron entry for postgres like: And in the postgresql, we need to enable pg_cron by running command If you think this is ok, then please assign it to me. |
For some reason, in an older version (from early february) ferretdb did not reject an attempt to create these auto expire ttl columns. However, newer versions do, fwiw. |
That's because we are now more strict on checking unsupported parameters. We could revert that change for that parameter if that's a problem for you. |
No problem, I was able to make connect-mongo handle the expiration itself. I mostly wanted to comment here as breadcrumbs in case someone in the future hits issues when upgrading their version of ferretdb. |
so I checked the roadmap and can't see anywhere that this feature is accommodated. |
@wqhhust do you still plan to implement the TTL index? |
Sorry, I am too busy to do that.
Thanks,
From: Bo Biene ***@***.***>
Date: Thursday, August 17, 2023 at 21:54
To: FerretDB/FerretDB ***@***.***>
Cc: wqhhust ***@***.***>, Mention ***@***.***>
Subject: Re: [FerretDB/FerretDB] Support `expireAfterSeconds` for indexes (TTL) (Issue #2415)
If you think this is ok, then please assign it to me.
@wqhhust<https://github.com/wqhhust> do you still plan to implement the TTL index?
—
Reply to this email directly, view it on GitHub<#2415 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABNN5AIXAHS4WGJOBENVPUTXVYPDFANCNFSM6AAAAAAW3VZALU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
The issue is not abandoned. Please vote for it with 👍 for the description if you need it. |
definitely still need it |
Is there an approximate release date for this solution or any workaround? |
The pg_cron extension is a great idea but it has several drawbacks:
May I suggest another approach?
MongoDB has more optimizations but this may be too soon to implement:
What do you think? I'm not ready to work on this issue right now because:
But if you are interested, I may give it a try, in a best effort mode. |
If it is of any help, here are two other projects which have implemented TTL over a Postgres database second is a project which takes/understands Redis commands but stores the data on a Postgres backend |
Unfortunately, One possible solution is #3339, but details are not clear yet. We will be looking into that issue soon™. |
I thought it was automagicaly deduced by the engine but it turns out you need a user-defined time-based field to create the TTL index on:
https://www.mongodb.com/docs/manual/core/index-ttl/#create-a-ttl-index No need to create a new internal field to manage TTL indexes after all. More details in the documentation. |
With the implementation of capped collection (#3458) the TTL-indexes should be able to be done in a comparable way, or not? |
@AlekSi I'm wondering if you have any plans to implement TTL indices in the fourth quarter of 2023. This feature would be very useful and we would appreciate your feedback on its feasibility and timeline. Thanks for your hard work and dedication to this project. |
I tentatively added it to the Q1 of 2024. |
This issue also came up in testing for compatibility with ApostropheCMS. It sounds like it was a near miss for inclusion in 2.0.0, so perhaps soon? Workarounds exist. |
I'm still hoping it gets included soon and would be all ears about any workarounds. |
The workaround makes sense if you control the application code: include a check for the property in question in your actual query, so results that are too old just don't come back, and do your own purges of stuff older than that periodically. |
What should be done?
https://www.mongodb.com/docs/manual/tutorial/expire-data/
The text was updated successfully, but these errors were encountered: