Optimize node_tag_new()

Created on 24 December 2009, over 15 years ago
Updated 19 March 2025, about 2 months ago

node_tag_new() currently does a merge query on every authenticated page view, to update the {history} table.

afaik history is used for only three purposes:

1. To determine if a node is 'new' for that user or not - whether they ever visited it.

2. To determine if a node has new comments since the last time the user visited it.

3. To determine if the node was updated since the last time the user visited it.

It seems like we could check the node updated and last comment timestamp times, then compare them to the history table, then only do an insert, if one of those three conditions is met - and possibly also every few hours regardless of how many times they've visited the node. This would remove the insert on any repeat page views, and it's not likely to have any real noticeable cost when the value actually needs to be updated. This would be a similar approach to that taken for updating user_access().

📌 Task
Status

Fixed

Version

11.0 🔥

Component

node system

Created by

🇬🇧United Kingdom catch

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024