Shape log size for high-churn tables #3609
|
For tables which have a lot of activity with thousands of items added daily, and those items being subjected to n update operations, how does this affect shape log size? I understand compaction was already implemented and LRU GC is being considered, but my initial understanding is the shape logs will grow indefinitely. How to approach this issue for long-lived shapes? |
Answered by
KyleAMathews
Dec 15, 2025
Replies: 1 comment 3 replies
|
Compaction was kinda implemented behind an experimental flag but it's proved a much harder challenge than we expected and it'll probably be removed. Generally the solution we recommend is you add a cache buster key to your query array that updates every so often to force a new shape e.g. this returns a string which updates once a week: function getUTCWeekAndYear() {
const now = new Date();
// Create UTC date at midnight
const utc = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
// ISO week: week 1 contains the first Thursday of the year
// Set to nearest Thursday: current date + 4 - current day (Mon=1, Sun=7)
const dayNum = utc.getUTCDay() || 7; // Convert Sun=0 to Sun=7
utc.setUTCDate(utc.getUTCDate() + 4 - dayNum);
// Get first day of that year
const yearStart = new Date(Date.UTC(utc.getUTCFullYear(), 0, 1));
// Calculate week number: ceil(days since year start / 7)
const weekNum = Math.ceil(((utc - yearStart) / 86400000 + 1) / 7);
return {
week: weekNum,
year: utc.getUTCFullYear() // ISO week-year (may differ from calendar year at boundaries)
};
} |
3 replies
Answer selected by
JarvisH
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compaction was kinda implemented behind an experimental flag but it's proved a much harder challenge than we expected and it'll probably be removed.
Generally the solution we recommend is you add a cache buster key to your query array that updates every so often to force a new shape e.g. this returns a string which updates once a week: