Open killme2008 opened 1 year ago
I would like to have a try if you don't mind :). Would also like to know a bit more about the requirement for the LRU cache to be implemented. I'm seeing in the current implementation a stmt_id
is used to get/execute the sql plan, and it is passed a parameter for the on_execute
function. Does the LRU cache still need this or it returns a sql plan according to the replacement policy? Thank you!!
@ccjeff Seems we could simply replace the HashMap
with some cache implementation like moka::sync::Cache.
TTL support: https://docs.rs/moka/latest/moka/sync/struct.Cache.html#example-time-based-expirations
What type of enhancement is this?
Performance, Tech debt reduction
What does the enhancement do?
GreptimeDB caches the query or logical plan for prepared statements, It's a
HashMap
withRwLock
inhttps://github.com/GreptimeTeam/greptimedb/blob/128c6ec98c57996de08a12e958feb9695afa2204/src/servers/src/mysql/handler.rs#L54
We can use something like LRU cache which supports TTL to replace the naive implement.
Implementation challenges
No response