Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Why not integrating node_last_viewed into node_load()?
Currently seeing smth like this on /user/root/track (devel query dump):
.92 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 109
0.99 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 108
0.93 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 107
1.13 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 106
2.13 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 105
1.15 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 104
0.83 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 103
1.12 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 102
2.43 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 101
1.24 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 99
0.95 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 97
1.26 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 95
0.93 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 94
0.9 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 93
0.93 1 node_last_viewed SELECT timestamp FROM history WHERE uid = '1' AND nid = 75
Too a lot.
Comments
Comment #1
Egon Bianchet CreditAttribution: Egon Bianchet commentedThis would imply an API change, so I'm moving it to cvs
Comment #2
magico CreditAttribution: magico commentedThis would be a HUGE performance optimization!!!
Comment #3
lilou CreditAttribution: lilou commentedComment #4
Jody LynnI don't see how adding this into node_load would improve performance.
Adding a node_last_viewed_multiple function could help though.
Comment #5
xjm(Merging "node system" and "node.module" components for 8.x; disregard.)
Comment #18
quietone CreditAttribution: quietone at PreviousNext commentedWow this was filed against Drupal 4!
@doq, thanks for bringing this up.
The function node_last_viewed was removed in #1120928: Move "history" table into separate History module in 2012. Any performance issues will need a new issue with steps to reproduce on a currently supported version of Drupal.