Potential Optimizations - OpenSlides/OpenSlides GitHub Wiki

Datastore

  • Indices on events.data: If we notice that certain fields are generally queried more often than others, we can create indices inside the JSONB column data. An example for such a fields would be meeting_id, which is present in a lot of models and may be used for collection field locking and therefore accessed more often.
  • Clear collectionfields tables on datastore start: Locking is only needed to determine if between the gathering of the used data and the sending of the eventual request any changes to the data occured which would invalidate the request. While the datastore is offline, no data can be gathered. Therefore, all positions previous to the (re)start are equivalent from a locking perspective, so all helper tables for locking (namely, collectionfields and events_to_collectionfields) can be emptied e.g. if they become too big.
  • History keyframes: If history usage becomes too slow because too many events must be processed to get the model for a specific position, we can introduce special keyframes for it. This just means that every x positions, we copy all models from the models table to a another table together with the position. This way, when we need a model for position 1100 and we have a keyframe at position 1000, we do not need to build the model from scratch, but can instead just take the model from the keyframe and apply all events with a position >1000. We would however trade space for speed in this case; it must evaluated whether this is worth it or not.
⚠️ **GitHub.com Fallback** ⚠️