Great diagnosis!
In fact, it was this small change that broke all node sets that were user lists and should reflect the "recent" users:
Originally, there was this query, which did not use an index on lasttime:
SELECT node_id pick_id,
title pickname,
node_id auth_id,
title authname,
experience rep
FROM node,
user
WHERE node_id = user_id
AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(lasttime
+) < ?)
ORDER BY experience $args{order},
node_id ASC
LIMIT $limit
I eliminated the function on lasttime by converting the date math from math on integers/unix timestamps to math on datetime types:
SELECT node_id pick_id,
title pickname,
node_id auth_id,
title authname,
experience rep
FROM node,
user
WHERE node_id = user_id
AND lasttime > date_sub(NOW(), INTERVAL ? DAY)
ORDER BY experience $args{order},
node_id ASC
LIMIT $limit
which now used days where it should have used seconds:
SELECT node_id pick_id,
title pickname,
node_id auth_id,
title authname,
experience rep
FROM node,
user
WHERE node_id = user_id
AND lasttime > date_sub(NOW(), INTERVAL ? SECOND)
ORDER BY experience $args{order},
node_id ASC
LIMIT $limit
As my excuse, there was a similar-yet-different code path further above, where the same parameters were used for non-user nodes that were in days, instead of seconds :-)). |