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

Special function to invalidate a dictionary key #45438

Open
crakjie opened this issue Jan 19, 2023 · 1 comment
Open

Special function to invalidate a dictionary key #45438

crakjie opened this issue Jan 19, 2023 · 1 comment
Labels
feature minor Priority: minor

Comments

@crakjie
Copy link

crakjie commented Jan 19, 2023

With the usage of cache dictionary or complex_cache_dictionary layout.

Sometime we are able to know if a key have been updated, simply because it was inserted in the dictionary source.

Currently to refresh the value in the cache we either need to rely on staling duration of the key or on a SYSTEM RELOAD DICTIONARY. The first one may be more frequent than the key update and suffer from some lag when a key is updated and reloaded in the cache. The second one just remove all what ever they have been updated or not, which slow done incoming queries that must refresh keys values.

I would propose a solution for this : dictInvalidate('dictionary',<keys>) and/or dictRefresh('dictionary',<keys>) functions.

The use case would be to call those function for each individual keys after insertion, with a materialized view or a subsequent select.

In my opinion the dictRefresh version is probably more interesting because it allow to directly and asynchronously reload of the value. While the dictInvalidate would delay the reloading to the query time.

I have an issue with this for classical dictionaries. I'm not sure it's can be applied to those cases. But if it's is possible I also think it could be a nice feature to avoid memory issue while reloading totally big dictionary that could be reload just partially.

I don't use all dictionary layout but we could suppose thoses function to be a noop if it's not applicable, or throw an error.

@UnamedRus
Copy link
Contributor

Duplicate #41007

@alexey-milovidov alexey-milovidov added the minor Priority: minor label Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature minor Priority: minor
Projects
None yet
Development

No branches or pull requests

3 participants