What is the best approach for updating a non-indexed regular column (not associated with a primary key) in all tables containing it as a duplicate?
ie the user sends something, and this post is duplicated in many tables for quick retrieval. But when this message changes (with editing), it must be updated throughout the database in all tables containing this record (in tables with different and unknown primary keys).
The solutions I think of:
- To display the primary keys in all of these tables, display the mapping table, but this seems to cause the tables to explode (the message is not the only property that can change).
- Use Solr to display, but I'm afraid that I will use it for the wrong purpose.
Any enlightenment will be appreciated.
EDIT (fictional scheme).
What if the message changes? or even username display_name?
CREATE TABLE users ( id uuid, display_name text, PRIMARY KEY ((id)) ); CREATE TABLE posts ( id uuid, post text, poster_id uuid, poster_display_name text tags set<text>, statistics map<int, bigint>, PRIMARY KEY ((id)) ); CREATE TABLE posts_by_user ( user_id uuid, created timeuuid, post text, post_id uuid, tags set<text>, statistics map<int, bigint>, PRIMARY KEY ((id), created) );
source share