horaedb icon indicating copy to clipboard operation
horaedb copied to clipboard

Reduce the cost of massive stale tables

Open ShiKaiWi opened this issue 2 years ago • 1 comments

Describe This Problem

In the current implementation of the storage engine, one table must occupy some resources even if the table may not be used anymore. And the number of such tables grows larger, the waste of the resources grows too, e.g. slow recover, finding the max memory usage in all the tables.

Proposal

I could come up two ways to solve this problem:

  • One way is to support clear these stale tables by introducing TTL mechanism on the table meta data.
  • Another way is to open all the tables lazily to avoid load the stale tables into the memory to manage.

Additional Context

#1278 is an example caused by this issue.

ShiKaiWi avatar Oct 26 '23 03:10 ShiKaiWi

Opening all the tables lazily is a sound method.

ShiKaiWi avatar Nov 13 '23 06:11 ShiKaiWi