How does Trello show history so quickly?

后端 未结 3 757
自闭症患者
自闭症患者 2021-01-30 11:23

Trello shows a historial log of everything that any user has done since the board\'s inception. Likewise, if you click on a specific card it shows the history of anything anyone

3条回答
  •  醉话见心
    2021-01-30 12:05

    The easiest way that comes to mind is to have a table like:

    create table HistoryItems (
    ID INT PK,
    UserID INT PK,
    DateTime datetime,
    Data varbinary(max)/varchar(max)/...)
    

    Indexing this on UserID allows for fast retrieval. A covering index would enable fetching the history of an entire user in one disk seek no matter how long it is.

    This table could be clustered on (UserID asc, DateTime desc, ID) so you don't even have to have any index at all and still have optimal performance.

    Any easy problem for a relational database.

提交回复
热议问题